Programming

Fractality of Flocking Rules

Posted on

I spent something like $50 on 99 Bottles of OOP when it came out. That could have bought me 60 Mars Bars, or even 0.005 Bitcoins! But I have been telling people to buy this book as it is an investment in their career. I’m going to share some of that value here, but to […]

Programming

TypeScript: Depend Only on What You Need

Posted on

This is a problem that is not unique to TypeScript, although it is perhaps easier to solve in TypeScript than in many other languages. It all comes down to one of the fundamental and fractal units of architecture… depend only on what you need. There are two things that make this a hard principle to […]

Programming

TypeScript Using Classes as Interfaces

Posted on

The practice of using classes as interfaces in TypeScript is most commonly promoted in the Angular style guide, which says (emphasis mine): Consider using a class instead of an interface. The recommendation is to think about using a concrete class as an interface using the implements keyword. I am hoping to convince you to do […]

Programming

Signs You Broke the Interface Segregation Principle

Posted on

I have written quite a lot about how to follow SOLID principles, but one thing that can be useful is examples of where a principle is not being followed. What does your code look like when it wants to tell you something? Here are the signs that you broke the Interface Segregation Principle (ISP). Here […]

Programming

Test-Driven Development and Duplication

Posted on

I have run a good number of test-driven development coding dojos (and behaviour-driven development ones), and participated in plenty of them too. The most common errors I have found can be classified as: Trying to find abstractions too early Drastic code changes under the banner of “refactoring” Both of these problems are solved by practising […]

Programming

Object Orientation Isn’t Just Objects

Posted on

When dealing with object-oriented design, it is all too easy to fixate on the objects themselves. In a way, the objects are highly visible and very tangible. The problem with this fixation is that there is an equally important, but harder to visualise partner to all of these objects, and that is the relationships. I […]

Programming

Stop Shooting at the Invisible Ghost

Posted on

Writing clean code is what you must do in order to call yourself a professional. There is no reasonable excuse for doing anything less than your best. So says the title page of Clean Code – before even a foreword or introduction. If you are object-oriented programmer you will have heard of Uncle Bob’s book, […]

Programming

Hide Away Your Units

Posted on

If you have an object in your code, and that object has some kind of measurement, you might well have done this: class Desk { constructor( public width: number, public depth: number, public height: number ) {} } But this will almost certainly lead to some issues… for example, you store your values as centimeters […]

Programming

Programming Books Should Go Beyond Syntax

Posted on

When I was invited to write Pro TypeScript for Apress, the pitch I prepared with my ace Editor, Gwenan, included a unique selling point. That USP was to go beyond the normal syntactical lessons of how to write various expressions using the programming language and talk in reasonable detail about how to apply some design […]

Programming

Alarm Bells in Object Oriented Programming

Posted on

I had a great discussion with a friend on the kind of things that can act as early indicators of poor code design in object oriented programming and I was surprised at how different our views were on this topic. I routinely get alerted to problems in code design by certain patterns that, while not […]