Skip to content

The Original Coder blog Posts

Featured Post

Welcome to my blog!

I’ll mostly be posting about software architecture & development since that’s what I know best. There will also be some posts about IT, the cloud, the Internet and similar stuff. Occasionally I may toss in a piece of trivia or a quote. If you have thoughts, ideas or questions please leave a comment!

Comments closed

PGP & KeyBase.io

High quality security is a good thing. Many years ago (early 90s) Phil Zimmermann released this thing called Pretty Good Privacy (PGP) that used public & private keys to enable people to sign & encrypt data. Its a really good core design and very high security. When it came out I wrote an early Windows GUI to try and make it easier for most users and exchanged a couple of emails with Mr. Zimmermann. But unfortunately PGP never caught on because it was complicated to use and requires building a network of trusted keys (so that you know who a key really belongs to).

I just recently found out about Keybase.io which is a system that provides secure chat & file sharing and uses PGP at its core. It also acts as a system for distributing keys and providing the identity of those keys. I’ve only played around on it for a little bit but it seems like this might finally be a good, viable way to enable widespread use of PGP!

Leave a Comment

DI is not IoC

Dependency Injection (DI) helps to enable Inversion of Control (IoC), but DI itself is not IoC because truly moving the locus of control outward requires an architecture that wraps and invokes the DI. An example of this would be ASP.NET MVC which uses DI to instantiate the controllers and other objects needed to process web requests. That is IoC, but the libraries that implement DI (“containers”) are not themselves IoC containers they are DI containers. Calling them IoC containers is inaccurate.

Leave a Comment

CyberPunk 2077

I am not a fanboy. I don’t get excited about upcoming games. But OMG I’ve been following CyberPunk 2077 for awhile and it now has a release date! April 2020! For the first time ever I think I’m going to have to pre-order a Collector’s Edition game!

I’ll explain. Way, way, way back in college (in the 1090s) I got introduced to the CyberPunk RPG and I loved it. Then the CyberPunk 2020 edition came out and it was even better. I played RPGs when I was young but nothing ever captivated me as much as CyberPunk. I even loved the novels set in the genre (it is stil, to this day, my favorite genre for books & movies).

I don’t play games all that often but The Witcher III from CD Projekt Red was one of the best I ever played. Then I found out that their next title would be CyberPunk 2077. They are basing it on the CyberPunk 2020 RPG and they have the author of that game on staff helping them develop it! I have never in my life been this interested in a video game.

And then I was watching the latest trailer / video of the game and it was just as awesome as the ones I had seen before. Right up to the point that Kenu Reves shows up in the video right at the end as a character! Have you ever seen Johnny Mnomonic?

So this is what it feels like to be a fanboy. For this, I’m okay with it.

https://www.cyberpunk.net/us/en/

CyberPunk 2077 @ Steam

Leave a Comment

The Service Locator Pattern

Developers keep referring to Service Locator as an anti-pattern. If that is the case then ASP.NET MVC and every IoC container I’ve ever seen must be wrong because they use it.

The interface for accessing an IoC container is an implementation of the Service Locator pattern. You’re asking for some particular interface (aka a service) and its giving you back an instance (if it can).

Under the hood ASP.NET MVC uses a service locator (which almost always happens to be an IoC container) to new-up Controllers for handling incoming HTTP requests.

Service Locators can certainly be used incorrectly or where they should not, but they are not an anti-pattern. They are a specific tool in what should be an immense toolbox for solving certain types of problems. Sometimes they are the best choice. Sometimes they are a terrible choice. But the pattern itself is not at fault.

For more read Service Locator vs Dependency-Injection which goes into more detail and is also a very fun read. I’d mention the author’s name, but I can’t seen to find a name associated with the blog.

Leave a Comment

Original Coder Libraries w/Layers Architecture

I’ve just pushed a new version of the Original Coder Libraries up to GitHub that includes the first draft of the Layers library and architecture.

The libraries are hosted on GitHub: The Original Coder Libraries

This push includes the first version of the Layers architectural library I’ve been working on. It is based on similar architectures I’ve used on a few different projects in the past which proved to be very helpful. From a features and maturity standpoint this could probably be considered the 3rd incarnation (once they are completed, still in alpha).

The library makes it incredibly easy and efficient to build software systems using layers. Especially systems that deal with data that need CRUD (Create, Read, Update and Delete) operations. Using the library it will be possible to implement a full set of CRUD endpoints for a resource (an entity / database table / or the like) in about 100 lines of code.

I’ve included a project named LayerApiMockup that provides an example of what setting up and implementing will be like with the library. It still needs a bit of work and I need to add the add-on libraries for implementing specific technologies (Entity Framework, ASP.NET MVC, etc) but this is a good start.

1 Comment

The funniest IT story

I literally almost fell out of my chair laughing during the first part of this.

The case of the 500 -mile emaill

A long time ago I worked as a UNIX, Linux and network administrator. I’ve had to figure out some very odd networking issues and have also rewritten a sendmail.cf file from scratch. So maybe that’s partially why I found this story to be so very amusing.

Credit where credit is due, I came across this on Reddit:

Card Card

Leave a Comment

Senior Developers & S.O.L.I.D. Principals

The S.O.L.I.D. principals didn’t exist when I was learning to program and by the time I had heard of them I had been working at a senior level for years. Once I heard about them I had a quick look, thought they were all pretty obvious and paid no more attention.

Let me clarify that. The principals that make up S.O.L.I.D. are pretty basic stuff. Junior developers will get them wrong all the time. Mid-level developers will mostly get them right but will still make mistakes. By the time a developer starts to transition into a senior role they should always be applying these sorts of basic principals correctly and mostly automatically. A developer who has been working at the senior level for a few years should never even need to think about such things consciously.

Just like people don’t consciously think about how to walk/run, how to use punctuation when writing or how to park their car after they have been doing any of those for a few years. Experienced authors and drivers don’t think about any of the basics of doing those tasks. Which is why people can commute from home to work and not even be able to remember the drive. For this same reason the S.O.L.I.D. principals should be being applied at a subconscious level by senior developers.

Which just recently has become a pain for me. Now that S.O.L.I.D. is all the rage every interviewer seems compelled to drill developers on all of the details. Try to remember all of the low-level spelling and grammar rules you use when writing. If you’ve been out of school for at least a few years I bet you can’t remember most, if any, of them. You don’t need to anymore, just like I haven’t needed to think on such a basic level for years when programming. Those basic principals are automatic and forcing them back into the conscious level isn’t a benefit and doesn’t improve anything.

Interviews just a couple/few years ago weren’t asking such basic questions during senior level interviews. These types of basic interviewing questions are not going to land good senior developers. Someone who is book smart or spent time cramming before the interview could answer those even if they weren’t a developer. But the more in depth questions that can’t be crammed for and require real (senior level) experience not just book learning aren’t getting asked as often (or at all) during senior level interviews now.

Leave a Comment

Initial release of Original Coder Libraries!

I’ve created the Original-Coder-Libraries repository on GitHub and uploaded some source code to get things started! They are licensed under the GNU LGPL v3.

The libraries currently contain approximately 3,500 lines of C# according to code metrics. This is a tiny fraction of what I have in my personal libraries and I’ll be adding more in the future.

The OriginalCoder.Common library includes:

  • Abstract base class for implementing IDisposable
  • Abstract base class for implementing IDiposable that also automatically cleans up registered children.
  • Exception classes for use in Original Coder libraries
  • Comprehensive set of extension methods for reading and writing XML using Linq to XML
  • Interfaces and classes for returning messages and operation results (mostly intended for use with Web APIs)
  • Extension methods for working with enumerations
  • Centralized application configuration for working with DateTimes (such as which formats to use for user display vs data storage).
  • Many useful DateTime extension methods
  • Extension methods for working with Type
  • Extension methods for calculating a cryptographic hash of a disk file
  • Standard interfaces for defining common properties on classes (Name, Description, Summary, WhenCreated, WhenDeleted, etc).
  • Extension methods for working with standard object property interfaces.

The OriginalCoder.Data library includes:

  • Standard interfaces for defining common data properties on classes (WhenCreated, WhenUpdated, WhenDeleted, IsActive).
  • Extension methods for working with standard object property interfaces.
  • Standard interfaces for defining unique key properties on classes (Id, Uid, Key)
  • Extension methods for working with standard key interfaces.

Repository: https://github.com/TheOriginalCoder/Original-Coder-Libraries

Leave a Comment

My Definitions for the S.O.L.I.D. Principals

The 5 principals which make this up were bundled together as the S.O.L.I.D. principals in the early 2000s. These describe basic concepts that are required to write good code. So it is very important for novice, junior and mid-level programmers to put real thought into these and get good at applying the concepts correctly and consistently. The better a programmer gets at these the less time they should need to spend thinking about them.

As I mentioned these are very important basic programming concepts that need to be learned, mastered and (eventually) internalized by software engineers. But I personally think the language often used to define and explain the underlying concepts is a bit cryptic or overly complex. Below is my attempt at conveying these concepts.

(S) Single Responsibility Principal

Don’t mix multiple (especially unrelated) capabilities / functionalities together in one class. Make separate, more narrowly defined classes for each distinct capability. Classes that have a more defined / narrow purpose are easier to learn, apply, maintain and also reuse. Note that this applies to any division of code (methods, classes, interfaces, modules, libraries, etc).

(O) Open Closed Principal

Great concept, not so great name.

Once functionality has been crated and is in use don’t modify it in a way that would break existing code! At the same time there should also be a way to extend or alter the behavior of the previously written code (without rewriting or copy/paste) that won’t break code that uses it.

A good way to do this is through the use of abstract base classes and inheritance. The core functionality for performing a task should be written into a base class. A concrete descendant class will inherit that functionality and allow it to be used. That concrete class should not be changed in a way that breaks existing once in use. But new concrete classes and possibly a new level of abstract class can be added that extends or changes the functionality without impacting existing concrete classes.

(L) Liskov Substitution Principal

A rather complicated way of defining a good concept.

Descendant classes should not break either the explicit nor implicit contract of the parent class. Descendant classes should be implemented in a manner that allows them to be dropped in as replacements to the parent class without requiring any code that expects the parent class to be changed. The key here is that it is more than just signature level compatibility (list of methods, parameters, and types). The expected behavior must also remain the same!

Note that this isn’t limited to classes. This concept should be applied anyplace where substitution is allowed by the programming language or system. Which means this also applies to interfaces. This would also apply to multiple DLLs that expose the same method signatures (which is sometimes used to implement plug-ins or extensions). Anyplace substitution is possible care should be taken to ensure the behaviors are consistent.

(I) Interface Segregation Principal

This is the same general concept that underlies the Single Responsibility Principal but applied specifically to interfaces. Its the same underlying concept, it doesn’t need 2 separate principals.

(D) Dependency Inversion Principal

This is the least obvious of the bunch, possibly because this way of thinking and the frameworks / technologies needed to support it are more recent. Or maybe because this principal is emergent and not stand alone; It becomes possible due to other principals.

The idea here is that classes which require instances of other classes (or interfaces) to perform their work should not instantiate specific concrete implementations within their code. This has the effect of embedding the decision as to which concrete implementation to use in a place where it is difficult to change. This also typically results in these choices being embedded in many different places throughout a software system.

The concept behind the Open/Close principal encourages inheritance and abstractions. The concept behind the Liskov principal states that all implementations of something that allows substitution (such as classes and interfaces) must be interchangeable. If we’re applying both of those concepts consistently its a shame to make substitutions difficult by hard-coding and embedding those decisions all over the place in the code.

Bingo! And that’s why Dependency Inversion sprung up. To standardize and centralize the ability to use substitution in a software system.

Currently the most common preference for implementing this capability is the Dependency Injection pattern where concrete instances are passed into a class via its constructor. But that is not the only option, any pattern that extracts and centralizes these decisions could be used. One such alternative is the Service Locator pattern which, in some cases, can be preferable to Dependency Injection.

It is worth noting that the Dependency Inversion principal is the only one of the bunch that isn’t universally applicable. Not all applications need DI. I would likely argue that all large or complex systems probably should use it. But small systems or one-offs that aren’t expecting to be maintained probably don’t.

Leave a Comment

My Home Network

In addition to extensive experience working in Software Architecture and Engineering/Development I’ve also worked professionally as a System Administrator, Network Engineer and Database Administrator. Which means I’m very used to setting up and running servers and networks.

I use those skills to provide myself with an excellent and optimized computing environment for my home office. Yes, admittedly, its overkill. But this way I have lots of options and very few limitations which is how I like it. This nicely supports My Natural Environment (my software development workstation I wrote about the other day)

Primarily my systems run Microsoft operation systems and servers (though I do have a smattering of Linux and others).

  • 2 physical servers setup for virtualization (lots of cores & RAM)
  • 3 Active Directory Domain Controllers (one physical, two virtual)
  • Microsoft SQL Server (running on SSD RAID-1 storage)
  • Development server that runs my visual control and internal web server
  • 33.5 TB of RAID-6 via Microsoft Server with data deduplication
  • 16 TB of RAID-5 backup storage (ONAP SAN)
  • 400 Mbit Internet connection and 2 dedicated firewalls
  • Various managed network switches
  • Everything powered by active UPSes
Half-rack for my most recent server builds.

I bought a nice half-rack cabinet last year to start transitioning my servers into a more manageable environment. I’ve converted a couple of companies (years ago) from individual servers and components sitting on tables to racks in the past and it was so much better. Finally got around to doing it for myself (or at least starting the process).

But my server closet is still the hub of my home computing where the Internet connection comes in and connects to my 2 firewalls and connects to the network switches for distribution. Also where a couple of my older servers are located. Its messy compared to the new rack cabinet but still effective. Eventually I’ll put all of this into a 2nd half-rack which will be better.

My server closet (effective but messy)

When I moved in to this house I converted one of the closets into a mini server room. I had an electrical outlet added and you can’t see it but I’ve got a small air conditioning unit and a bunch of UPSes sitting on the floor below the servers (which are on a shelf). I also wired the whole house for CAT-5 networking and there are 2 patch panels in the upper left of the closet which are also not visible.

I have two firewalls. I have a Sonos hardware firewall that the Internet connection plugs into and serves all of the general household computing (media devices, IoT devices, Alexa, Wemo, LIFX, etc). Then I have another, more beefy firewall that protects all of my real computing assets (workstation, servers, etc) and through the Sonos for Internet access. That may seem excessive, but IoT devices are notoriously unsafe and I don’t want my home office getting hacked just because I like to using Alexa to turn on and off my lights!

Plus its not displayed (and never will be) but I’ve also got 2 separate home alarm systems with 24 hour monitoring, one of which is a video surveillance system that records the entire outside of the house plus all of the doors and exposed windows. That all has backups and redundancies of course because I don’t want anyone walking off with my home office equipment!

Leave a Comment
Site and all contents Copyright © 2019 James B. Higgins. All Rights Reserved.