In software engineering, dependency injection is a technique in which an object receives other objects that it depends on. These other objects are called dependencies. In the typical “using” relationship the receiving object is called a client and the passed (that is, “injected“) object is called a service.
The code that passes the service to the client can be many kinds of things and is called the injector. Instead of the client specifying which service it will use, the injector tells the client what service to use. The “injection” refers to the passing of a dependency (a service) into the object (a client) that would use it.
Substitutability is a principle in object-oriented programming stating that, in a computer program, if S is a subtype of T, then objects of type T may be replaced with objects of type S (i.e. an object of type T may be substituted with any object of a subtype S) without altering any of the desirable properties of the program (correctness, task performed, etc.). More formally, the Liskov substitution principle (LSP) is a particular definition of a subtyping relation, called (strong) behavioral subtyping, that was initially introduced by Barbara Liskov in a 1987.
The Liskov Substitution Principle is the third of Robert C. Martin’s SOLID design principles. It extends the Open/Closed principle and enables you to replace objects of a parent class with objects of a subclass without breaking the application. This requires all subclasses to behave in the same way as the parent class.
“Functions that use pointers or references to base classes must be able to use objects of derived classes without knowing it.” – Robert C. Martin
A violation of this behaviour would imply your code is not SOLID and it may be prone to malfunctioning.
I think that one of the most intimidating experiences, when you try to contribute to an existing codebase, is to obtain an overview of the project. How many times have you felt the urge to help with an open-source project in GitHub but immediately felt like it was an overwhelming task? I might have stumbled upon a possible solution or at least a way to ease your journey when facing this issue.
Since I finished the first version of GoPlantUml, I have received excellent feedback from users and contributors. However, the most interesting one was from users that generated the diagrams but did not understand how to see it. GoPlantUML is a library by design. Although it works as a command, its purpose is to generate plantuml diagrams from your local code. But the key is that is is a library and not a command. So it occurred to a friend of mine and me that we could build a service using this library to generate diagrams from public repositories. And consequently, www.dumels.com was born.
I often found myself with a lack of motivation when it comes to working on a project. But all that changed after I showed GoPlantUML to the great people at Reddit. This post is about how an open-source project can spark a new passion for work and how I am enjoying every minute of it.
GoPlantUML is open-source software that I wrote as a training exercise. I stumbled by accident with the ast library in Golang, and I discovered that I could quickly parse Golang code. Immediately, I realized I could use it to create a diagram of my projects using PlantUML, and thus GoPlantUML was born.
If you agree that nothing paints a better picture of your software project like a well maintained UML class diagram, then this post is for you.
I have been fascinated with Golang because of the versatility of the language. I wanted to take advantage of the Golang parser and a great software called PlantUML (http://plantuml.com/) to create a program that will translate my Golang code into a neat class diagram.
One of the most exciting aspects of the software development process is experiencing the steps leading to a pleasing solution to your problem. That moment when, after some time of thoroughly brainstorming, everything falls into place. I had such a moment today, and I would like to share my story.
This morning I was faced with a simple dilemma. I needed to perform a GET request containing a large payload to the server, but I didn’t want to show it in the URL. The reason for the GET request is that I wanted to give the user the ability to download a file with a click of a button. The purpose of the large payload, the requirements for this file. You see, this file is a zip archive that the service will dynamically construct and deliver to the user. The issue is it can potentially contain thousands of files inside, and I didn’t want to clutter the URL with this payload.
That is when it hit me! I have been using Redis for some time now, and I thought this would be a great use of it. With that in mind, I set up to develop the following idea.