In many applications, long functions are very hard to work with. In a legacy codebase, they are often contained in large classes that have many dependencies. The work that it takes to bring such functions and classes into a test harness is often significant and may even be overkill for the changes you need to make.
If the function that you need to work with is large or uses instance variables and functions, consider using Break Out Command Object. To make a long story short, this refactoring technique gets you to move a long function to a new class. Objects…
You’ve been asked to implement a new feature in the Angular application at work. As you sit at your desk and reach for the keyboard a thought pops into your mind: “I can’t be the first one to have to implement something like this. I bet there’s a library that does what I need”.
Good for you. That’s a good reflex to have in today’s open-source world. Why reinvent the wheel when you can just borrow someone else’s wheel? …
I recently upgraded my computer’s RAM to 32GB from 16GB. It was running fine but ever since I started doing more work with Docker containers, it felt like it would get sluggish once in awhile.
With now double the RAM, I figured I’d be golden. It turns out it isn’t that simple. This week, the company I work for decided to start using containers for most of our project’s dependencies, you know, SQL server, Solr, Redis etc… There is quite a few of them, but I’ve never had a problem running them simultaneously on my machine.
docker-compose up later…
In the first and second article in the series we have established that a Bounded Context includes more than just the domain model but extends to the other layers of our system, in a vertical slice.
To better understand how this all plays out, and why this means that a Single-Page Application should be part of it’s server-side API, I decided to map out a simple class diagram over Uncle Bob’s famous clean architecture. First, for comparison, I mapped out the typical MVC application.
In the previous article in this series we arrived at a simple, but rather abstract definition of what a Bounded Context(BC) is. This definition seemed to confirm my intuition that a Single-Page Application(SPA) should be part of the same BC as its server-side API, but does it really?
To my mind, if in the SPA I’m dealing with a
ProductViewModel, the data for which I received from the
api/product/:id endpoint, endpoint that was custom made for the particular use case served by
ProductComponent by members of my team, then we're talking the same Ubiquitous Language.
That is the question I have been pondering these past few weeks. It led to a series of interesting conversations with Steve “ardalis” Smith on our devBetter community Discord server. At the time of these discussions I wasn’t sure of the answer. I was however leaning towards the idea that most Single-Page Applications (SPA) were not Bounded Contexts (BC) but in fact belonged to the BC of their corresponding server-side API.
Steve had the good idea to consult the Twittersphere to see what other developers thought. The results were far from conclusive with only 54% of respondents being of the…
The year is 1453. After 116 years of war, your kingdom, Testadel, is finally at peace. Now is the time to rebuild and strengthen your relationships with your neighbours. To the North lies the fiefdom of Lord PureFunction, who fought valiantly at your side during the war. In an effort to establish stronger commercial ties, you both sign a treaty whereby you promise to supply his keep with as many sheep as you can every month, in exchange for 15 pieces of gold per sheep.