Skip to main content

Posts

Showing posts from December, 2015

Year in Review 2015

JanuaryStarted the year with reasons as to why technical blogging is useful and recommended.Kick started a series of posts themed around simplicity, recommending to abstract data use and not data access.FebruaryA series of posts on abstractions.The power of Value Objects as a key refactoring.MarchConcluded the series on abstractions.The Dependency Elimination Principle and Reused Abstraction Principle have been two of the biggest changes I've made in my coding habits this year.AprilA follow up to one of my previous posts around the use of getters and setters.I realised I had failed at maintaining and managing URIs for the content on the site.The end of the month saw a focus on two simple topics that can clean up duplication in tests and remove obscurity from assertions.MayA focus on tasking and planning in software development.Two core techniques of producing a Walking Skeleton and Mob Programming have proved invaluable.JuneProvided two techniques that allow continuous delivery of…

Recommended Reading List 2015

In a similar manner to previousyears here is my recommended reading list for 2015. As before some of these books have been released for a while, but these are some of my highlights for various reasons.CodeDependency Injection in .NETI had put off reading this book for a while despite numerous teams having a copy. It turns out a good chunk of the book is applicable to any language, with the later third being dedicated to actual .NET solutions. The other two thirds of the book has expanded my understanding of DI.Effective Java: A Programming Language GuideMany developers recommend this book even for non Java development. Many of the tips and advice included we not new to myself but the book provided further insight and explanation. A good summary of best practices for any OO developers.Web Application Security, A Beginner's GuideA good introductory book on security which provided a useful refresher for myself as well as providing a platform for further research on some of the key ar…

Reducing Conditional Logic to a Single Location

My Anti If Campaign post still generates a lot of questions and discussion. In summary:Conditional statements are not bad. They are a core programming construct.If you are working in an OO language, type checks are probably not the best solution to your problem. Rely on polymorphism.You need to perform conditional checks somewhere. In my first example the conditional check was pushed into routing. The conditional statement in this case had been offloaded to the consumer.A recent real world example was refactored which highlighted the points previously, but inverts the problem and solution. How do you remove conditional statements if your system itself has to make the decisions internally?ExampleThe simplified example shows the result of invoking a third party service. This result contained a flag indicating either success or failure. Effectively there were two hidden types here. Finally the result was returned based on the HTTP status code.After the result of the third party call, the…

ReactJS and JSHint

The ReactJS Getting Started Guide states that the recommended way of using React is combined with npm.This is great but poses a problem when trying to use JSHint. The default example outputs a single JS file containing both your code and the React library. The end result is the bundle when linted contains code you don't and shouldn't need to care about.The guide does provide a solution, though not as clear as it probably should be. Offline Transforms. These will transform your jsx files into plain Javascript without bundling react alongside.babel --presets react app.js --out-file main.jsSimply take the result of the transform and perform your linting process.jshint main.jsThis may seem obvious but I did lose some time realising the benefit of offline transforms.Offline transforms do require that you either bundle the transformed file with React, or you simply include the standalone JS scripts in your html. This can be done after the fact. JSHint can then play nicely with your …