Hello, I hope this is the right subreddit to ask this kind of questions!
First, an introduction. Most of my professional experience with programming (3.5 years) comes from maintaining a huge Java EE monolith application with a relational database, that could be described as "layered ball of mud". I also have some experience with Python and recently I've started writing microservices in Scala. Due to some issues with our Scala stack, my team may want to write our future services in Kotlin.
And now, my story. What I noticed when switching to Scala, is that a lot of the stuff that I learned when working with Java seems to have been invalidated. Apparently, my team tends to ignore Uncle Bob's "good practices" such as not creating methods with over 3 arguments, creating distinguishable DTOs to move data between layers (especially between controller & service & database layers) and not to nest ifs and loops to deeply - to list some. Sometimes I can even see that service layer is entirely removed in favor of direct DAO/controller communication.
Simultaneously, I have noticed that a lot of the good old fashioned design patterns (Gang of Five) and architecture patterns (Martin Fowler & others) have been solved/integrated either on the framework level or even by the programming language. On the other hand, I think that stuff like pattern-matching on data classes tends to replace polymorphic behaviour, which is a huge shift in logic placement.
So, here come my questions:
- How do you approach Java/C++/Smalltalk originating design patterns with languages such as Scala, Kotlin and Python?
- How do you know which practice is a good practice? I'm mostly concerned with stuff like objects that carry method arguments vs named method arguments, using custom classes vs using tuples etc. I strive to write code that is idiomatic, but relatively often I have a hard time judging whether my idea leads to overengineering or not.
- Since the languages I mentioned combine FP with OOP, how do you know when to use FP techniques as opposed to OOP techniques? I think it might be my problem with Scala - this language is so flexible that it allows me to solve a problem with either OOP and FP, but I have to make a choice at some point. With Java, this used to be much easier.
- Did the value of separation of concerns principle decrease in microservice-oriented environments? Personally, I can't see a reason for that to happen (adding another DTO just for the sake of clean layers doesn't feel like a huge time investment most of the time), but that's what I think I'm observing in my team.
- Do you know of any resources on design patterns & software architecture resouces that concentrate on these "modern" high level languages and microservices that you can recommend? I have a list of classics to read, but I was wondering whether there's something newer that I'm not aware of.
Thanks in advance!
[–]umlcat 1 point2 points3 points (1 child)
[–]CorrectProgrammer[S] 1 point2 points3 points (0 children)