5 ms·
I came into a position where my first job was to make a certain process scalable. The code had all of the smells of bad design - huge monolithic classes, in a h
by scarface74 9y ago
I came into a position where my first job was to make a certain process scalable. The code had all of the smells of bad design - huge monolithic classes, in a huge monolithic solution with unrelated projects. The less mature me would have said this crap needs to be rewritten. Now I would like to consider myself more practical:
1. Form the monolithic repo and start taking out unneeded projects and classes and recompiling often.
2. Encapsulate the entire executable in a Docker container
3. Use AWS’s ECS, Fargate, and Autoscaling.
Now we have scalability.
For maintainability, every time you touch a part of the code, extract the functionality into a lambda microserve.
The code that never changes, doesn’t need to be touched and you slowly start decreasing the size of the monolith and it’s easier to find bottlenecks and make changes without affecting other parts of the code. Replace “lambda expressions” with microservices/separate modules etc as appropriate for your use case.
- twic 9y ago> For maintainability, every time you touch a part of the code, extract the functionality into a lambda microserve. Funny, for maintainability, every i time i touched a Lambda microservice, i would integrate it into a single codebase.
- mattnewton 9y agoI like to think you are at the same company, doing a modern day version of this: http://kinosjourney.wikia.com/wiki/Three_Men_on_the_Rails_—On_the_Rails— http://kinosjourney.wikia.com/wiki/Three_Men_on_the_Rails_—O... Spoilers: (really even if you aren’t into animation I promise this episode of kino’s journey is worth it and stands on it’s own, turn back now): the first man is polishing the tracks, the second man is removing them, and the third is laying down new tracks. Each was hired years apart, and with large distances and no communication, each does not know that the others continue to work behind them to undo their life’s work.
- scarface74 9y agoThe end goal is to get rid of servers completely. By keeping the services small you enforce a culture of small, loosely coupled, single purpose functionality. Especially helpful when you're either dealing with jr. Developers or developers who have been at one company for 10 years and never learned how to properly structure code.
- zdragnar 9y agoIn my (albeit limited) experience, projects which consist primarily of lambdas suffer one of two problems: - the code is awful, because lambdas were an excuse to keep bad developers in their own playpens (aka juniors and those who don't learn) - the code is just fine, and would be easier to maintain if most of the lambdas were combined back into one or more "monoliths"
- scarface74 9y agoI agree, if you don't have junior developers (or worse outsourced developers), it is easier to maintain a well constructed monolith that has separate, focused modules, and clear boundaries between the modules. Microservices help contain the damage of bad programmer skills.
- zdragnar 9y agoI guess my point wasn't that damage containment was a perk. I view it instead as a lack of support- either cultural or structural- from the more experienced developers. Microservice / faas may help mask it, but you're still stuck with a lot of bad code... Only now, there's less oversight and / or accountability.
- scarface74 9y agoYes but the biggest issue with maintaining "bad code" is it's brittle. You make a change one place and it breaks something else down stream. With a microservice, the invariants are well known and the boundaries are clear. It's easy to know whether you are introducing a breaking change and just create a new version at a different endpoint.
- zdragnar 9y agoYou're not wrong, but I think missing my point. This is how we end up with a hackathon golang microservice saving a company 50k a month when a simple correction to poorly written code would have done the same thing. Granted, I only skimmed bits of that article, so I'm not sure those were the exact details, but it makes for a nice analogy.