Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
I love this topic.
> Most welcome would be an example with a focus on Adapter / Ports, e.g. abstraction of HTTP client usage / ORM etc.
- Firstly u should recommend your novices reading `Head First Design Patterns`, there is no better book with example on common patterns like Adapter, Strategy, Factories and etc. Very Brain friendly
Secondly, it would be helpful reading them `Clean Architecture by Robert Martin`... this book essentially about all types of architecture, but mostly about onion architecture.
Thirdly, here is already described Architecture Pattern helpful for backend exactly, in pictures. Useful for any 50 shades between monolith and microservices
https://github.com/Mahmoudz/Porto
Useful to read for inspiration at least.
Fourthly examples itself... Limit in message length to describe them. I'll do it in next message -
I work on three clean architectures public access projects written in Golang for now
1) CLI linter tool that parses Freelancer game configs and autofixes to fixed standard https://github.com/darklab8/...
I mostly move by.. inspired by materials above, but not fixed to some architecture specific. I try to find ideal fit by refactoring on my way to some architecture that will be ideally fitting specific tool.
Link leads to code architecture links between packages of application.
Due to unique format of freelancer game configs i needed to write my own inireader parser.
And for quickly accessing and changing values i came naturally to receiving ORM abstraction over it! Which allows me to map only necessary values from ini reader without coming to details about all existing stuff there. -
2) Second tool is autogit. CLI tool to force user writing correctly git messages to Git Conventional Commit standard and based on that providing auto generated changelogs of added features and fixes between releases, and automatically telling next semantic version
https://github.com/darklab8/...
my main goal is finding good packages in code making sense as abstraction? And having simple most minimal interfaces for interacting with them?
Git - package abstracts complexity working with Git-go third party lib
SemVer - implements standard SemVer parsing
SemanticGit implements logic of my application with providing Struct typed outputs
Changelog purely for rendering logic into Markdown
Validator -> Validating rules to parsed commits
Well, and reusable actions, which are without CLI interface details yet
So, i tried finding single responsibility packages in my architecture here. I feel i succeeded. -
3) https://github.com/darklab8/...
Third tool is already web tool and already third global refactorization of it. Discord bot to provide users info about tracked in game objects -> space game bases, flying players.
Made 6 package abstractions, third of which are launched as paralleled processed together. (They could have been separate microservices, but it made sense having it all monolith with having architecture at the level of packages)
Configurator is this Storage/Repository abstraction over database with user settings.
Scrappy - scraps data in loop, stores somewhere and provides access to it to other applications
Listener - listens to Discord messages and recirect input to CLI cobra-cli library in Consoler
Consoler takes user input and renders answers back
Discorder -> Abstraction to simplify interactions with Discord API/Discordgo third party library. CRUD basically to send/get/dete message
Viewer renders user view tables in a loop -
What i achieved in each example? Writing first testable code architecture. Each one should be having relatively good coverage :thinking:
Should be simple enough for me to handle as single developer (that is why no microservices for now, only clearly defined packages)
in darkbot/third app, i made explicit escape from Discord framework libraries forcing their own architecture to implement commands/background loops like it is in Discord.py. With redirect of input to CLI library and outputing from it, i have simple to test code
Well, and i tried utilizing static typed advantages to maximum. So almost no to untyped maps as possible, no overusage of hacky reflects of Golang. I went with structs/generics/interfaces and etc which worked best for static typed in Golang.
Each code architecture looks like one directional tree without cyclic dependencies :) I tried to define as clear as possible code isolational layers between them which made sense -
P.S. Code Complete by McConnel is very good book which helped me finally understanding what i wish achieve in my code in terms of its interfaces and code complexity. Very useful book about everything intro to code architecture, from writing cleaner/readable stuff, to telling everything else at least briefly.
-
I usually recommend people
Learning OOP
then reading Code Complete by McConnel
then probably Head First Design Patterns
then i stress on reading Unit testing best principles and practices by Vladimir Khorikov, this book explains WHY we need unit testing and other types of testing and what goals can be achieved in it
and TDD by kent beck
then only diving into deeper Clean Achitecture by Robert Martin
and reading stuff like Refactoring by Martin Fowler.
Architecture at its first goal should be testable, so than sooner they dive into Unit testing then better. It is even kind of more important to read it first and sooner than Code Complete and Head First Design Patterns. In order for them to comprehend materials of next books with keeping testing in mind.
So may be better learning in this order first
DSA + OOP -> then Unit testing/TDD -> Then code architecture (Code Complete)+Design Patterns -> Clean architecture/Refactoring -
P.P.S. My projects aren't really big, but oh well, bigger than one file code examples at least :)
each my project has real users in mind... well and already used by those users
+ each one of them goes with written CI workflows
for that matter, could be useful one day reading for them about Software Development lifecycle. That planning/analysis/design exists (System Design)
book System Design and Analysis by Alan Dennis (already eighth edition) exists to inroduce them to bigger picture. That useful to think about tool development from the point of user usage cases which can be refactored even before single code line written. that gathering requirements is useful.
It all gives kind of bigger picture again, this time about planning project from the top of architecture in comparison to TDD/refactoring which encourages developing more from bottom. Golden balance is in between. -
@darkwind
Wanted to take some vacation time before answering, gonna take a closer look at the mentioned projects.
Thanks a lot for the detailed answers, project links and the book recommendations.
I'm gonna be blunt - not to be rude, just to make sure you understand my position.
I'm not looking to educate the new devs in a nicely manner. That is not only beyond my job description, but I would burn out faster than a candle that was lit with kerosene.
I often look for example projects or well done projects, which go beyond the usual basic trivia stuff - for 2 reasons:
1) Personal interest
2) Well, being blunt - to rub it in the devs face till they cry.
2 might sound harsh and like I'm a bad person, which I admit I am, at least partially.
But I'm doing this job since 12 years plus now - I'm really tired of developers excuses.
A good developer says: Yeah, that was shit, sorry. We still have a few of them in our company, otherwise I'd have ran away already :)
But the "last generation" of new recruits...
They are cocky wannabes, who think they know everything. Untouchable, cause everyone needs devs.
Admitting faults? Nope, instead they try to put the blame on someone else. I know quite a few ranters here, when they write "my ticket description is 500 words long without containing any info"… I do absolutely believe them.
But I don't believe our new devs. :) It's the tickets fault, nobody told them sth, asking questions was too much of a burden, thinking about different solutions wouldn't fit the time frame, etc.
I've never heard so much whining and bitching like in the last years...
So I'm not trying to be nice. I'm more about putting up a defense line, a nice documentation of several links and whenever the crying starts, I will hand out that link and give them reasons to cry by pointing out all of their flaws.
I wouldn't do that outside an 1:1 session, but I think there will be plenty of these one on one sessions. -
We / management teams already started restructuring a bit, because I'm not the only one who is really pissed and unhappy about the current state of affairs.
This will be a really, really, really shitty year. After 3 really really really shitty years.
I just hope that the next year will get better, or I might really start looking for a new job. -
@IntrusionCM ergh. To be honest it sounds like u was poisoned by toxic mentality. And you contribute to toxicity distribution in your company.
Sure, i understand your frustration. But i believe overconfident arrogant people are rare to encounter. Usually interviews plus trial period are meant to weed them out.
Ergh... Well I remember I needed to deal with them at previous job... And people like them actually did pretty much emotional damage to me too... But surely it is impossible for everyone to be arrogant jerks 😉 stick to the ones who aren't (if everyone is arrogant jerk at your company, then you are rotten, or your company is rotten and time to leave company xD)
Sharing is caring, I try to accept patience dealing with any kind of people. If people aren't educatable, I just don't give them my time 🤔 well, which you are already doing with declaring them all not educatable
It probably will be an unanswered question, but let's try.
Does anyone know of a large project using onion / hexagonal/ ddd or similar architecture with free access to the source code...
Or an example of said architectures that goes beyond "trivial dumb example".
The new recruits need... A lot of brushing up (I'd be for electro shock treatment and other stuff, but somehow HR thinks I'm joking).
As said, most examples I found are too basic. On the other hand, if I write now a good example, I'd need to do it in either my free time (nope, just nope) or jiggle it in somewhere in company time (aka it will be never finished nor be in a useful state).
Programming language preferred would be Java, but as I'm fluent in most languages except the forbidden ones (JavaScript and it's friends) ...
Anything would be helpful.
Most welcome would be an example with a focus on Adapter / Ports, e.g. abstraction of HTTP client usage / ORM etc.
Thanks.
rant
i'm too old for that shit
monkey training
need resources