In this issue from October 2017: Stronger encapsulation with entity printers; live unit testing in Visual Studio 2017; Code that lies; The dangers of skipping a EULA; The secret weapon for a great career; and why you shouldn’t use Git.
Sharpen the Saw is a somewhat delayed repost of a semi-regular newsletter of information I publish for the professional development of software developers. While targeted primarily at developers working with the Microsoft technology stack, content will cover a wider range of topics.
To subscribe, send me an email and I’ll put you on the list. Membership is moderated.
Techniques
Always a way to improve the code you write every day.
Printers instead of Getters
It’s common enough to suggest that the properties we declare on our business entities should be read-only, elevating them from dumb data carriers into active participants in our business processes.
Taking this a step further, this post suggests that we don’t actually need our properties to be readable at all - that instead, we want our objects to be printable.
I’m not entirely sure about this, but the idea does have a certain attraction.
Software and Updates
A new or upgraded tool can be a beautiful thing.
Live Unit Testing in Visual Studio 2017
One of the most interesting new features in Visual Studio 2017 is Live Unit Testing - where all your unit tests are automatically run for you, in the background, while you’re still editing the code.
This leads to a very fluid development experience, blurring the boundaries between the red-green-refactor phases of test-driven development.
Being Professional
A great developer does more than just write great code.
Don’t make your code Lie
It’s hard enough to read code - especially code written by someone else - without having to worry that the code is misleading you. Code lies when the name you read doesn’t accurately indicate what the code does.
Examples that I’ve encountered include a FindAccount()
method that returns a list (lying about the cardinality of the result), a FileExists()
method that silently deletes zero byte files (lying about the presence of side effects), and a SaveChanges()
method that only added the object to an in-memory batch for later saving (lying about whether the changes were actually saved).
Staying Secure
Staying safe online and writing secure systems are both harder than we think.
Users Agree to Clean Port-a-Potties for WiFi in Terms of Service Stunt
Do you ever read all the details in the EULA you accept when connecting to free WiFi? Me neither. Perhaps we should … more than 22,000 users of Purple agreed to scrub down portable toilets as payment for their free WiFi!
More generally, perhaps we should be paying more attention to the details in those agreements before accepting their terms. This applies to Facebook, Google, Twitter (and yes, Microsoft) as well.
Wildcard
Sometimes the answer is random.
Here’s my secret weapon: I read
There’s more to a good reading habit than just staying up to date with the fast-changing world of the IT industry. Fresh ideas and viewpoints can be the inspiration you need to excel in your chosen career.
I used to read a different career-oriented book every month, though I’ve struggled to keep up that pace in recent years. At the moment, I’m reading xUnit Test Patterns (refactoring and design for unit testing), Team Geek (team dynamics and interpersonal interactions) and You are not so smart (how does the brain work).
What are you reading?
Video of the Week
Take some time to feed your mind.
Please. Stop Using Git.
In this humorous video, Matthew McCullough takes a tongue in cheek look at git and why you absolutely positively shouldn’t be using it.
Comments
blog comments powered by Disqus