I've been on both sides of this issue in the span of my career. I've joined companies with absolutely horrific code, and I've hired people who thought my code was shit. My advice is don't complain and don't attempt any significant rewrites for the first 6 months or so. Your job at first is simply to understand the code and demonstrate that you are able make improvements to it without breaking everything. Doing so wil…
I would add to this by adding tests gradually during this time. If there is no understanding from management that this is needed, do it guerilla style and do it anyway, maybe at a smaller scale. In my mind, unit tests is not what you want to start with with a messy legacy codebase. It takes a huge amount of effort testing lots of already working code. Add unit tests for any new code, but try and implement tests for t…
Ask HN: Codebase at my work is a complete mess, what should I do?
331–340 of 346 posts
Re: Ask HN: Codebase at my work is a complete mess, what should I do?
#332Earlier quoted context omitted.
And some people are sick to their back teeth of listening to new devs come in and whine about poor code without understanding any of the context. Perhaps you do know better than everyone else, but you ought to make damn sure of it before you open your mouth
The first course of action if you find some ugly/bad code is to ask a dev with more history with the codebase why it's like that. In my experience 9 times out of 10 the answer is "we know, it's like that because of reason but we haven't had the time to fix it yet".
Re: Ask HN: Codebase at my work is a complete mess, what should I do?
#333Earlier quoted context omitted.
I would add to this by adding tests gradually during this time. If there is no understanding from management that this is needed, do it guerilla style and do it anyway, maybe at a smaller scale. In my mind, unit tests is not what you want to start with with a messy legacy codebase. It takes a huge amount of effort testing lots of already working code. Add unit tests for any new code, but try and implement tests for t…
Any practical suggestions on how to bootstrap testing (unit and/or UI) for an existing project that has never seen any? Or any recommended resources I could read up on?
Start with areas that are the most valuable to the business. Not only does this more easily show the (business) value of testing, but it helps keep you from introducing a very visible and very bad looking regression. Anything dealing with money (especially billing) is probably a good indicator. Be warned, here be dragons.
That being said, don't verify your testing setup with business critical tests. Verify your setup (to yourself and other devs) with the quickest thing you can accomplish. The business critical ones are your (team's) short term goal.
Pick out the X most important logic paths (e.g. customer checkout or some subsection of that). Work on regression testing that over the next few months.
Make sure your tests are both automated and actually get run. The latter is more important than the former.
Ideally, your tests will prevent a nasty bug from going in and will immediately prove the business value of your testing efforts. This will establish the trust you need to continue testing and refactoring.
Re: Ask HN: Codebase at my work is a complete mess, what should I do?
#334Earlier quoted context omitted.
I would add to this by adding tests gradually during this time. If there is no understanding from management that this is needed, do it guerilla style and do it anyway, maybe at a smaller scale. In my mind, unit tests is not what you want to start with with a messy legacy codebase. It takes a huge amount of effort testing lots of already working code. Add unit tests for any new code, but try and implement tests for t…
Any practical suggestions on how to bootstrap testing (unit and/or UI) for an existing project that has never seen any? Or any recommended resources I could read up on?
The first step is to stop the bleeding so begin adding unit tests for any new code you write and be sure to factor this effort in with your sprint estimations.
In parallel work top down with high level integration tests written against feature flows. E.g., As a user when I select this then I expect this. This doesn't mean you need to actually use BDD gherkin library for your test runner but at least frame the context of these in that regard since you don't care about the minute details of the underlying code, just the experience of the user story.
And lastly, don't just write tests to write tests, try to understand what is important to cover against because there is nothing worse than maintaining barely useful tests wired up to legacy data fixtures.
Re: Ask HN: Codebase at my work is a complete mess, what should I do?
#335Re: Ask HN: Codebase at my work is a complete mess, what should I do?
#336Earlier quoted context omitted.
"Successful" by literally any measure.
Success, in this context, means having solved some problem for a meaningful length of time.
Re: Ask HN: Codebase at my work is a complete mess, what should I do?
#337Earlier quoted context omitted.
I would add to this by adding tests gradually during this time. If there is no understanding from management that this is needed, do it guerilla style and do it anyway, maybe at a smaller scale. In my mind, unit tests is not what you want to start with with a messy legacy codebase. It takes a huge amount of effort testing lots of already working code. Add unit tests for any new code, but try and implement tests for t…
Any practical suggestions on how to bootstrap testing (unit and/or UI) for an existing project that has never seen any? Or any recommended resources I could read up on?
Re: Ask HN: Codebase at my work is a complete mess, what should I do?
#338Earlier quoted context omitted.
The first course of action if you find some ugly/bad code is to ask a dev with more history with the codebase why it's like that. In my experience 9 times out of 10 the answer is "we know, it's like that because of reason but we haven't had the time to fix it yet".
Surely in a commercial setting the primary factor is RoI rather than time? Will rewriting this old, stable, code increase profits or substantial reduce revenue impacting risks? #notacoder
This is not applicable to every piece of code and roi should always be kept in mind but I'm my experience it is almost always the case
Re: Ask HN: Codebase at my work is a complete mess, what should I do?
#339While I agree you should not attempt significant rewrites right away, and spend time to develop your knowledge of system... don't just sit back and wait. That won't help solve the problem.
1. Be up front about your opinions and rally the group around the long-term goal to improve code quality. Do it in a positive manner where it's clear that you want to make an impact and help make changes for the better! (not just complaints) 2. Explain your reasoning clearly (testing, code quality, engineer happiness, etc) and ask for input / get buy-in. Open up the discussion. 3. Bring this feedback up consistently as an important part of your experience at this company (in 1-1's, and other team meetings) Good ways to do this are when discussing OKRs, retrospectives, etc.
Believe that YOU have the ability to spark a change and develop real pride amongst the team! If you don't feel this is possible, this is not the right place for you.
Re: Ask HN: Codebase at my work is a complete mess, what should I do?
#340Earlier quoted context omitted.
You really can’t, it’s not productive to assume this a skill you need or is beneficial (although it can be) and if people pick up your code and joke, laugh, or belittle without context, as in this case, it’s not your fault, don’t let it effect you. You’ll find the vast majority of developers are childish and immature, and not very good at their jobs, that’s been my experience at least.
Right, duly noted. I'm actually speaking completely generally though; I'm falling apart at this universally speaking. Perhaps I just need to learn how to debate? When I'm presented with a context in which I need to prepare any sort of defense, 51% of my brain will sometimes go silly, and I'll get really anxious and irrationally fearful and tense up. Things rapidly go south from there; the biggest side-effect is that…
Your recall may improve if you hand write your notes versus typing them out.