Posts

Being a Senior Developer is more than being a long serving developer

Like many people, I started my development career from another role. I taught myself coding and then built software to help the business and myself. It was well received, but I did not feel like a "real" developer yet. This experience convinced me that software was what I wanted to do, so I looked for a junior developer role. This wasn't easy, most companies want people who can come in and start being productive right away, and there were many skills I lacked from not working in a "true" software development environment. Eventually, after much persistence, I was taken in as a junior developer for a large finance company. When handing in my resignation to my non-dev-shop company, I was offered a pay rise to more than I would be getting in the new role at the finance company. I was also offered a new position, the position of "Senior" developer. Now I had a choice. I could stay, and drive development projects, leading a team of newly hir

Ways to Spot Single Responsibility Violations

Classes should only have one reason to change. We should attempt to increase cohesion between things that change for the same reason, and decrease the coupling between things that change for different reasons. Classes should do one thing and one thing well. Violations of the Single Responsibility Principle can cause code to be difficult to test and maintain, and can make it easier for bugs to manifest. There are a few symptoms of SRP violations which can give warning signs of these issues. Large classes/methods Obviously large classes and methods do not always point to SRP violations as there may be a requirement for a significant amount of logic. However, it is usually a good sign. Large methods are more likely to point to an SRP violation than large classes, or at least too much cyclomatic complexity. You'll become aware of this when you attempt to cover the method with test cases, and realise there are excessive test combinations required. Too many injected depe

Microsoft Certified Solutions Developer!

Image
After 3 years, 3 exams, and an excessive amount of study I have achieved the Microsoft Certified Solutions Developer - Web Applications certification. I realise that many people don't put a huge amount of emphasis on exams, valuing real world experience instead. But I have found that what I learned studying for these exams has been extremely valuable to my profession, helping me make more informed decisions in my day to day work. There is no substitute for real world experience, but real world experience leaves a lot of gaps and doesn't always teach the best habits. The exams have enabled me to fill in these gaps and develop a real technical proficiency which I may not have had without them. Update:  Born to Learn just posted this blog talking about a recent study which found 4 advantages certified staff have over non-certified staff, there are some interesting findings! https://borntolearn.mslearn.net/b/weblog/archive/2016/01/25/four-solid-reasons-to-hire-certi

Amazing Things You Can Do With Azure Storage Queues

Image
Load Balancing and Workload distribution Queues can be used to organise the distribution of a workload across multiple processors. A common technique is to post messages to a queue which are a key to a task which needs to be performed, and have multiple worker processes pick these tasks from the queue to perform in parallel. This can be combined with other storage mechanisms to perform complex tasks. Say you were trying to render an animation. The queue could be loaded with keys, which point to an entity in Table storage. This entity could contain the Url of an image stored in blob storage. A worker process would pick up the message from the queue, reference the entity from the table and download the image from blob storage. It could then perform compute intensive tasks on the image while other worker processes picked up other images. In this way, cloud storage can be used to augment worker roles and perform powerful parallel operations. Asynchronous Processing and Temporal

Calling Long Running Methods Asynchronously

Image
When you are able to call an async method, do it using async and await or by making your method return a Task: p ublic async Task < string > RequestData ( Uri uri ) {     WebClient webClient = new WebClient ();     return await webClient.DownloadStringTaskAsync ( uri ); } // Rely on underlying Tasks whenever possible. public Task < string > RequestDataAsync ( Uri uri ) {     WebClient webClient = new WebClient ();     return webClient.DownloadStringTaskAsync ( uri ); } // Rely on underlying Tasks whenever possible. Dealing with synchronous calls When the method you are calling is not asynchronous, wrap the method in a task delegate:   public Task < string > RequestDataAsync ( Uri uri ) {     return Task .Run < string >(         () =>         {             WebClient webClient = new WebClient ();             return webClient.DownloadString ( uri );         }); } // Create Tasks when you have no

NuGet Like a Boss: Part 1 - Don't Check in Packages

Image
After suffering like many with so many Package Restore woes in my projects I decided to make notes on the best way to deal with Nuget packages. Ignore the packages folder Not doing this means you check in the packages which are huge. This is annoying and kind of defeats the purpose of Nuget. When you ignore (and therefore don't check in) your packages folder, anyone getting your source code can run package restore on the solution and Nuget will download the packages automatically. How? First, add a file named .tfignore . This may require some Command prompt renaming as some set ups don't like files beginning with a dot. When you get past this annoyance, open the file in notepad and enter the following: \packages That tells TFS to ignore the packages folder. For some bizarre reason, this doesn't include the respositories.config file. You'll need to add a second line as follows: !\packages\repositories.config You'd think this would be it, but you may

Developing for the Cloud - An Introduction

Image
When you create a web application for the cloud, there are many things that need to be done differently. It's not just a case of saying "I'm doing cloud" and all you're really doing is putting it on someone else's VM. Doing this, the costs are much higher than if the application is designed with cloud in mind. This might be fine from an infrastructure point of view, but the cloud can have profound impacts on development from the ground up. Azure allows us, and also forces us, to engineer our applications completely differently. Forces? Well, this is because when you're hosting in an App Service plan, you're billed based on compute time and resource usage. This forces you to write more efficient code. You can't just write code that performs unnecessary operations and get away with it - the efficiency of code now directly translates to dollars. This demands that you think twice when writing code, espcially loops, to ensure you're being