Ask HN: What book will make me a better big project programmer?
28 points| coding_animal | 7 years ago
I have 10 years of experience, but I’m new to Java. Which book should I start with that will help me make the code better for everyone?
28 points| coding_animal | 7 years ago
I have 10 years of experience, but I’m new to Java. Which book should I start with that will help me make the code better for everyone?
tluyben2|7 years ago
What did you do before this? Because Java projects are usually overarchitected but so are many OO projects in other languages. Many times it started with a clean design pattern (which was already often a bad idea but it fit) and then got a million things bolted on over time.
Again; hope someone has better advice but it sounds like you got some bad code there and that might or might not be repearable. 100k is not so much, especially in Java, but way too much for a rewrite so personally I would disappear for a week with the codebase to see what can be done and then suggest doing it or, if it turns out really bad and there is no funding/understanding for fixing it, look for another job.
BjoernKW|7 years ago
Any useful suggestions necessarily will have to remain at a pretty high altitude, though, simply because no two large applications are completely alike.
Other than that there are a few general principles and guidelines you might want to follow:
- the Boy Scout Rule: When you’re working on a particular piece of code and you see something weird or overly complex try to clean up the code. Start small while doing so. Don’t try to refactor everything at once.
- Before refactoring or otherwise introducing significant changes try to write unit tests that ensure the previous, expected behaviour still is present when you’re done with your refactoring.
- Having inherited a Java codebase (i.e. one written in a strongly rather than weakly typed language) probably will prove to be a boon further down the line. If you break something many errors will show up immediately during compilation and not just once the application is in production.
- This allows you to refactor relentlessly and make full use of the refactoring features of an advanced IDE such as IntelliJ IDEA.
Speaking of tools: You’ll want the best tools available to help you with this daunting task, i.e.
- state-of-the-art CI / CD
- IntelliJ IDEA Ultimate licences for every developer (or whichever IDE you prefer, just don’t try to be cheap at the expense of productivity)
- an automated code quality checking and code exploration tool such as SonarQube.
toolslive|7 years ago
Component Software: Beyond Object-Oriented Programming (Clemens Szyperski) https://www.amazon.com/Component-Software-Beyond-Object-Orie...
It's not a guide on how to do it, but it explains the ecosystem and forces in play (like why good components get rewritten, while bad ones persist). Once you understand these things you will have a better compass.
hackermailman|7 years ago
croo|7 years ago
To work with legacy code I recommend Working with Legacy Code by Martin Fowler. Lots of good ideas for handling messy codebase are described there.
dnt404-1|7 years ago
coding_animal|7 years ago
afpx|7 years ago
Basically, it’s not about the code. It’s about the form following the function. That is, first, deeply understand the context and purpose of the software, and the structure will follow.
I also recommend “Domain Driven Design” by Evans. But, a warning - it’s dry. There are a lot of “DDD in Java” code examples out there.
You could go back amd re-read “Code Complete”, and other early Microsoft Press books. Though, some are probably dated.
The Robert Martin books can be also useful, at least in thinking about how to maintain low coupling, high cohesion.
Oh, and “Working with Legacy Code”
Unfortunately, none are specifically Java related. How to structure systems is an art that requires practice. So, maybe start off with some small toy projects, just to get warmed up.
muzani|7 years ago
gruffgirl16|7 years ago
yesenadam|7 years ago
crb002|7 years ago
kojeovo|7 years ago
coding_animal|7 years ago