The Open/Closed Principle
The Open-Closed Principle is responsible for the “O” of the S.O.L.I.D principles. Originally coined by Bertrand Meyer, it states that:
Software entities (classes, modules, functions, etc.) should be open for extension but closed for modification.
It seems like an incredibly simple principle, but it’s behind most of the best practices we us...
4 Unhealthy developer habits and what to do about them
All professions have occupational hazards and risks, and software development is no exception. While it’s true that we rarely have to deal with man-eating sharks or explosions, ignoring some of our profession’s challenges can lead to lots of trouble.
The good news is that most of our problems are the result of some form of neglect. Fixing them ...
Ruby modules in-depth
Modules are incredibly flexible and powerful constructs that help you organize your code in a more… modular way. They let you package related functionality in a cohesive unit you can use to extend the behavior of objects and classes.
Using modules to bundle together related behavior
Ruby gives you two options to bundle behavior into units: clas...
RESTful Services: what they are, and what they aren't
REST is one of the most important concepts in today’s web-centric development circles. You’ve probably heard about it even if your main focus isn’t web development. Despite its popularity, there’s a lot of confusion about what it really is. Let’s take a look at some concepts to better understand what it means to be RESTful.
It all starts with a...
Things I wish I had known when I started programming, Part 3
Yepp, more things I wish I’d known when I started, 3rd edition.
You can find the first article in the series here.
And the previous article here
Beware of the arrogance trap
Arrogance is one of the worst traits a professional can develop.
It’s not only about how it affects our relationship with other people, but that’s also worth considerin...
The Single Responsibility Principle
The Single Responsibility Principle is probably the most confusing of all 5 S.O.L.I.D principles. It took me quite a while to understand why it’s important and where to apply it. The phrasing has changed through the years, but in most places, you will find a variant of the following idea:
A module should have one, and only one, reason to cha...
Defensive Programming Fundamentals
When your program starts running in production, the conditions and cases you thought impossible will happen, period. In reality, it’s impossible to ensure that your code will have optimal running conditions all the time. As a developer, you’d like to ensure your projects will be able to cope with the imperfections of the real world. That is why ...
Writing good variable names
There are only two hard things in Computer Science: cache invalidation and naming things
_Phil Karlton
Despite being one of the easiest ways of improving the quality of code, writing good variable names is perhaps the most overlooked skill in a developer’s toolbox. Sharpening your naming chops is a sure way of improving your code’s readabi...
Things I wish I had known when I started programming, Part 2
Let’s take a look at some other things I wish I’d known when I started my career.
You can find the first article in the series here.
Write your own side projects
Do you know what’s one of the best ways of polishing your software writing skills?
Sitting down and writing your own software projects. Shocking, isn’t it?
Programming is a practic...
Duck typing and the importance of good public interfaces
If it walks like a duck and it quacks like a duck, then it must be a duck
We saw in a previous article that it’s much better to depend on abstractions than on concrete classes. Concretions are more likely to change than abstractions, and those changes will ripple through our codebase affecting all the classes that depend on them.
We also lear...
Things I wish I had known when I started programming, Part 1
Learning to program is a long journey, and it can take years of constant effort to become good at it.
When I started writing my first lines of code, I felt super excited that I could make a machine do things. Granted, they were very simple things, but I felt I could achieve anything with this cool new skill. After a while, I started to notice t...
Dependency Injection and the famous DIP
Dependency injection is one of those techniques that carries around a bad reputation for being overly complicated and hard to understand. In reality, DI (you guessed it, dependency injection) doesn’t need any complex framework or fancy library to be useful—you can start using it very easily.
Let’s start with an example class Robot that uses an ...
Welcome to Brains To Bytes
Hello!, and welcome to Brains To Bytes.
Software development is an incredibly exciting field full of opportunities and great ideas. It’s also unlike lots of other crafts in an important sense: the end product, instead of being a tangible thing, is materialized thought running inside a chip.
This notion of programming as a translation of your i...
103 post articles, 6 pages.