Skip to main content

Posts

Showing posts from October, 2015

Coding In the Real World

As a student when confronted with a problem, I would end up coding it and thinking - how do the professionals do this?For some reason I had the impression that once I entered the industry I would find enlightenment. Discovering the one true way to write high quality, professional code.It turns out that code in industry is not too far removed from the code I was writing back when I knew very little.Code in the real world can be:messy or cleanhard or easy to understandsimple or complexeasy or hard to changeor any combination of the aboveVery rarely will you be confronted with a problem that is difficult. Most challenges typically are formed around individuals and processes, rather than day to day coding. Years later I finally have the answer. Code in the real world is not that much different to code we were all writing when we first started out.If I could offer myself some advice back in those early days it would be to follow KISS, YAGNI and DRY religiously. The rest will fall into plac…

Set Based Design

Each morning newspapers hit the newstands without fail. Live broadcasts are the same. Come show time they hit the air without fail. You can probably think of more examples of deadlines that are constantly achieved. So why does software development accept missed deadlines? Software development not only encourages software to be late, it has become accepted or just another risk to the project by default.SolutionImplementing Lean Software Development introduces the concept of Set Based Design (SBD). SBD provides an answer on how to never miss a deadline every again, providing the deadline is feasible. SBD will allow software to constantly hit deadlines just as newspapers and TV shows do.SBD requires multiple teams to implement the same functionality split over several sets (versions) of work. Each team works independently and in parallel to fulfil the same goal. This is in stark contrast to normal proceedings where each team is usually assigned to separate projects. At the end of the dea…

Header Interfaces vs Role Interfaces

In some languages such as C++ you must define header interfaces. These constructs define how a public type is exposed in terms of its public interface. Other languages take a different route. C# or Java do not require headers but they are still very much in circulation. This unfortunately brings along some unwanted side effects.Header InterfacesHeader interfaces are a one to one mapping of public methods that match the type it is defining. In other words, they are recreating the overhead of headers in languages that do not need them.Header interfaces tend to break the Interface Segregation Principle.Harder to switch objects via DI as you are forced to implement all members even if you do not use the whole interface.Prone to breakages as the one to one mapping means any change is breaking.Role InterfacesRole interfaces define the role an object plays. Due to various roles having different responsibilities they are usually grouped by functionality. Role interfaces are usually combined w…

Abstractions in Code, Details in Metadata

I've programmed many games - each one was special in its own way. One in particular stands out early in my university studies, a top down shooter. It was not graphics, gameplay, or sound that made it stand out however. It was the lesson it taught me about software development.Level OneWith the deadline for completion of the project looming, time was running out. The core game engine was complete but other than the first level there was nothing else for the player to do. With more marks awarded for various components I decided to add a second level.At the time the game consisted of a source file called level.cs. This contained parts of functionality explicit to every level that I would need. It also contained code specific to the first level. My solution was to extract a base class and introduce level.cs and level1.cs. This worked. The addition of level two was not as easy. The second level required a considerable amount of additional code, despite the shared functionality. A slow …