News for hackers. Stuff that matters.
Re:Ask HN: Codebase at my work is a complete mess, what shou... by freetime2 on Thursday August 23, 2018 @02:53AM (#17825133)
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 will win you the trust and respect of your teammates, whereas if you come right out of the gate trying to rewrite everything there is a very good chance you will make yourself look like an ass by spending a lot of time and energy introducing bugs into a previously-stable area of the code. Once you have a decent understanding of how and why the code is the way it is, and the trust of your teammates, then you can invest effort into fixing the highest-priority issues with the code.

Being able to read and work effectively in legacy code is an essential skill for any software engineer. For now you should just try to focus on fixing bugs and implementing new features, and take pleasure in the fact that you are improving the project and developing a handful of hard and soft professional skills.

That being said - there should be a limit to how much bullshit you put up with. If after six months to a year you still find that you hate the job, and a better opportunity comes along, then go ahead and take it.

Re:Ask HN: Codebase at my work is a complete mess, what shou... by oaiey on Thursday August 23, 2018 @03:49AM (#17825378)
> Being able to read and work effectively in legacy code is an essential skill for any software engineer.

This is key advise. It makes the difference between a person who enjoys the art of coding and a professional who get paid for work. Basically you have to first proof why the invest of rewriting brings any financial benefit. Till then, be professional and maintain it.

Re:Ask HN: Codebase at my work is a complete mess, what shou... by some_account on Thursday August 23, 2018 @05:53AM (#17825928)
Just to offer a different opinion here: I think happiness at work is the most important thing for me personally, and I have no patience for legacy codebases that look like shit.

I mean, you are offering good advice for a person that wants to fit in as his highest priority, no doubt about that. But there are people (like me) who don't enjoy working deep down in complicated shitty code to the degree that I don't even want to be a programmer in such environments.

There are ways to mitigate this. Join companies that care about clean code and micro services. Work in the cloud. Avoid enterprise. Those advices can be hugely important for someone who just hates those kind of gigs where you feel like you don't want to be there even.

Re:Ask HN: Codebase at my work is a complete mess, what shou... by Xylakant on Thursday August 23, 2018 @06:49AM (#17826118)
I consider the ability to work with legacy codebases an essential skill. If you can’t do that, you’ll be changing jobs like other people change underwear.

Any codebase that sees real usage will accumulate cruft, odd behavior and legacy code over time. Dealing with that and assessing what’s worth refactoring and what’s best cut or even just left as it is to reach a business goal is the skill that differentiates a seasoned engineer from a code monkey. That shitty legacy code is often what brings in the money to sustain the company, otherwise it would have been turned off long ago.

Microservices don’t help much in that regard: each micro service can look squeaky clean from a code perspective and the whole system can still behave in shitty, unpredictable ways. (Been there, seen that)

It’s also not about fitting in: taking on a shitty codebase and transforming it into something better is an outstanding skill and requires constant communication with all stakeholders, especially when you want to cut legacy stuff. It’s certainly not something for people that prefer a quiet corner.

Re:Ask HN: Codebase at my work is a complete mess, what shou... by mrhappyunhappy on Thursday August 23, 2018 @07:23AM (#17826282)
Are you saying you don’t change underwear often? ;)
Re:Ask HN: Codebase at my work is a complete mess, what shou... by Xylakant on Thursday August 23, 2018 @07:28AM (#17826302)
Not every few hours and I’ve seen people quit a job between starting late on the first day and an early lunch break. So literally faster than I usually change my underwear.
Re:Ask HN: Codebase at my work is a complete mess, what shou... by Ultimatt on Thursday August 23, 2018 @07:40AM (#17826358)
These people should have asked to see a sample of what they were going to have to work on.
Re:Ask HN: Codebase at my work is a complete mess, what shou... by Xylakant on Thursday August 23, 2018 @07:44AM (#17826381)
They didn’t even have a look at the code. Their task would have been to write and maintain end-user documentation and they left before they even had computer and stuff set up. Just never came back from lunch. Said they’d not feel up to the task. I was just a student at that time, so I can’t really say if that was a hiring fuckup or just an odd person. Certainly one of the weirder things to witness in my career.
Re:Ask HN: Codebase at my work is a complete mess, what shou... by aurelianito on Thursday August 23, 2018 @11:24AM (#17828006)
Most likely explanation is that this person received a better job offer and did not wanted to let your company know.
Re:Ask HN: Codebase at my work is a complete mess, what shou... by akerro on Thursday August 23, 2018 @07:58AM (#17826453)
>and micro services. Work in the cloud. Avoid enterprise.

How is this even related? Worst code I've seen was in financial sector, but the project is so huge that is no chance of upgrading it without complete rewrite, 65% of code when I left it was still in Java5 with no option to upgrade to 7 any time soon, it's just too big, so we can understand why it's shit. Second worst code was in a startup, micro-service oriented code, k8s, dockers, javaEE, angularJS and angularIO + TypeScript. There was literally shit, HTML injection in chat-box, >200 JSON endpoints with something that mimics REST (it was closer to CURD than to REST), SQL injection using JSON objects was possible, deployment of new version of a microservice usually took 4-5hours, only if any of model classes haven't been changed. Now I work on medical software, the only split we have is frontend has own repo, backend has own repo, two monoliths. Best code I've ever seen, perfect organisation, good class and field names, easy navigation. I see completely no relation between code quality and microservices/monoliths, what I see it that sane people write good code.

Sure, enterprise is slower with moving with technologies, but that's because they're bigger and decision on upgrading Tomcat to the latest version might cost thousands monthly if there is a single performance regression. It doesn't mean that code is shit because they still use jQuery instead ReactJS.

>Work in the cloud

How is that supposed to help? Moderns devs already have to know JSON, XML, XSD, 2 IDEs, 10 testing framework, at least 2 frontend frameworks and languages, at least 2 backend frameworks and languages, so here, have this k8s YAML configuration and this docker-compose and Dockerfile so you can... avoid shitty code? Also, have this microservice oriented stack, learn how to do distributed logging, autoscaling, self-healing architecture, deploy chaos monkeys in your cluster.

Re:Ask HN: Codebase at my work is a complete mess, what shou... by oaiey on Thursday August 23, 2018 @09:49AM (#17827196)
Thanks. Saved me a response :) I am in an Enterprise and we have deployed cruft code into the cloud :) and were even cloud native or whatever bullshit bingo brings up next in terms :)
Re:Ask HN: Codebase at my work is a complete mess, what shou... by nineteen999 on Thursday August 23, 2018 @08:46PM (#17831897)
Some of the worst code bases I have ever seen are cloud-based SaaS products. Including one that was bought by a large database vendor in the last 12 months for north of $US1B.
Re:Ask HN: Codebase at my work is a complete mess, what shou... by dhanaraj0 on Saturday August 25, 2018 @11:37PM (#17844100)
Aconex by Oracle?
Re:Ask HN: Codebase at my work is a complete mess, what shou... by nineteen999 on Sunday August 26, 2018 @04:40PM (#17847773)
Not going to name names unfortunately, especially not to an account created for the purposes of posting one specific comment.
Re:Ask HN: Codebase at my work is a complete mess, what shou... by matt_morgan on Thursday August 23, 2018 @07:40AM (#17826354)
People can make their own decisions about this, yes. But an important point I love seeing in a top comment is that almost always it's hard to inherit someone else's code. It almost always looks bad at first. I'm more of a manager than a coder but I've worked a lot of small places and I can tell you, every coder who has worked for me has tried hard to keep code clean, and every coder who's replaced those coders has thought the code was a mess. The only time this didn't happen was when there was really a team of coders working together. Any single coder is almost always going to produce code that looks messy to anyone else. You can say you're not going to work on code like that, but in my experience you're also choosing, in that case, never to work for a small place.
Re:Ask HN: Codebase at my work is a complete mess, what shou... by oaiey on Thursday August 23, 2018 @09:42AM (#17827154)
Well, that makes you a colleague who I would not want to have around. Someone who only cherry picks his duties and cannot work beyond greenfield projects.

I agree that work should produce happiness. And I agree there are places where the work is not everyone's fit (e.g. bureaucratic customizations). But being not able to cope with bad code is a no go in my opinion.

Re:Ask HN: Codebase at my work is a complete mess, what shou... by j0057 on Thursday August 23, 2018 @07:57AM (#17826450)
With microservices, clean code becomes largely irrelevant compared to other concerns such as logging, monitoring, tracing, API patterns, configurability, scalability, timeouts, retry logic, circuit breakers, etc. If the code sucks, you can just take 2 days and completely rewrite the codebase, whereas if the microservice doesn't adhere to 12factor.net, you're in for unwelcome surprises.

That said, any codebase that has seen a few years of maintenance and further development is going to look complicated, especially if you're too young and inexperienced to recognize that each of the annoying edge cases was put there to fix real production issues. Rewriting sounds like a good fix, but it will take a very long time and in the best case you'll end up with a newer codebase that looks just as complicated to a person just entering the business as the one you were attempting to replace.

Re:Ask HN: Codebase at my work is a complete mess, what shou... by elb0w on Thursday August 23, 2018 @07:05AM (#17826201)
I can appreciate this point of view but I think you are missing out. We learn as programmer's by making mistakes and experience. Familiarizing yourself with a crappy codebase (you didn't write) not only helps you get better at debugging but holds a wealth of experience of what not to do. As you don't write shitty code yourself, how else will you learn to deal with these problems? Everything we do should be to further our own skill set. My first real programming job was working with quants who wrote 1k single procedure Perl scripts, you had to scroll your editor to the right to see all the indentation from conditionals. When I look back it's one of my most valuable learning experiences.
Re:Ask HN: Codebase at my work is a complete mess, what shou... by man2525 on Thursday August 23, 2018 @11:08AM (#17827869)
Working on legacy codebases better designed than I could have come up with hasn't been much of an improvement for me. There is a certain quality of "habitable" for a codebase that tends to get tossed when people create a tightly abstracted object-oriented design. Peter Norvig and Richard Gabriel in their writings mention organizing software "fractally" from top to bottom, which I haven't really been able to figure out yet, other than it must involve some careful use of repetition. Apparently, it can help create those qualities.
Re:Ask HN: Codebase at my work is a complete mess, what shou... by jfroma on Thursday August 23, 2018 @06:12AM (#17825997)
Excellent advice, I agree 100% with this.

Also I want to add that allocating time for a refactoring or fixing legacy code is hard to justify most of the time. Instead I try to follow the "boy scout rule":

On every bug fix or new feature you work on "Leave Things BETTER than you found them". An small change like properly naming a class or a variable, or just writing a readme file explaining something will help you and your team in the future.

https://medium.com/@biratkirat/step-8-the-boy-scout-rule-rob...

Re:Ask HN: Codebase at my work is a complete mess, what shou... by albumdropped on Thursday August 23, 2018 @11:55AM (#17828299)
+1
Re:Ask HN: Codebase at my work is a complete mess, what shou... by LandR on Thursday August 23, 2018 @04:44AM (#17825612)
>> My advice is don't complain and don't attempt any significant rewrites for the first 6 months or so.

I would agree with this, you need to be careful. I've seen a friend start at a new company with a horrendous code base, bring up the issues and be let go because they hurt / offended the existing developers.

SOme people are really precious about their shitty code and can't take criticism, esepcially in small companies.

So get through your probation period then you can maybe start making noises.

Re:Ask HN: Codebase at my work is a complete mess, what shou... by zorked on Thursday August 23, 2018 @05:03AM (#17825697)
> SOme people are really precious about their shitty code and can't take criticism, esepcially in small companies.

It's very easy to criticize, often not easy to understand the situation where the bad code was written. Maybe the hastily-written code was the thing that saved a company from bankruptcy and was written by dedicated engineers, and bringing your friend to fix it was the plan all along, and what they needed was someone to fix the code and not decry everybody as stupid.

[I'm not saying this is what actually happened to your friend. I don't know your friend :)]

Re:Ask HN: Codebase at my work is a complete mess, what shou... by Aaargh20318 on Thursday August 23, 2018 @07:35AM (#17826334)
> It's very easy to criticize, often not easy to understand the situation where the bad code was written.

A lot of people seem to think that criticism of the code is the same as criticism of the person who wrote the code. They are not the same thing. Root knows I've written plenty of crappy code over the years for very valid reasons. You are not your code, saying the code sucks doesn't mean I think you suck.

Re:Ask HN: Codebase at my work is a complete mess, what shou... by laughingpine on Thursday August 23, 2018 @10:26AM (#17827506)
> You are not your code, saying the code sucks doesn't mean I think you suck.

Some people take _any_ criticism of their code personally regardless of how constructive you are being.

I have had a person completely blow up at me for simply asking (literally a question - a valid question) "why did you choose to use a BindingList instead of a List?"

Maybe it was how I phrased it? People are tough to get sometimes.

Re:Ask HN: Codebase at my work is a complete mess, what shou... by circlefavshape on Thursday August 23, 2018 @06:54AM (#17826147)
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
Re:Ask HN: Codebase at my work is a complete mess, what shou... by Aaargh20318 on Thursday August 23, 2018 @07:31AM (#17826320)
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 shou... by pbhjpbhj on Thursday August 23, 2018 @08:45AM (#17826748)
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

Re:Ask HN: Codebase at my work is a complete mess, what shou... by imdark on Friday August 24, 2018 @03:06PM (#17837120)
It really does depend, any code, especially bad code, is very rarely bug free. So if you ever need to fix a bug the amount of time you will need to spend and revenue you might lose during the time might be worth the refactor beforehand In my experience, software or product development is never really "done" Customers, users and business will ask for new features and change of old features, external dependencies and used services will change, hardware will change Not being able to move fast enough, train new engineers and adjust to changing requirements will have a cost If I can't trust my codebase not to break on any new change it will be much much harder and more time consuming ie expensive to maintain it

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 shou... by anewone on Thursday August 23, 2018 @09:57AM (#17827249)
Same thing. The time is the investment. There are always projects with better RoI so a rewrite is constantly at the bottom of the pile. "We'll get to it someday."
Re:Ask HN: Codebase at my work is a complete mess, what shou... by TheGrumpyBrit on Thursday August 23, 2018 @09:54AM (#17827233)
Often, it's a simple case of business need. As long as the offices are clean, the business doesn't really care if the cleaning cupboard is tidy.

It applies to a lot of business areas. If you want to introduce new processes or fix any problems, you need to justify why you want to do that, and "This isn't very pretty" isn't generally considered a good enough reason. If something works, nobody ever got into trouble for leaving it alone.

Re:Ask HN: Codebase at my work is a complete mess, what shou... by maxsilver on Thursday August 23, 2018 @09:57AM (#17827248)
> Surely in a commercial setting the primary factor is RoI rather than time

If it's a smaller company (op mentioned 50-100 people) they might not even know what RoI is, and/or might not care about it.

Re:Ask HN: Codebase at my work is a complete mess, what shou... by pbhjpbhj on Thursday August 23, 2018 @10:37AM (#17827612)
That's a strange comment, surely it's impossible to stay in business and not understand RoI to some degree.
Re:Ask HN: Codebase at my work is a complete mess, what shou... by jaclaz on Friday August 24, 2018 @08:59AM (#17834639)
Not necessarily related to code, more or less you just re-wrote a sort of Chesterton's Fence:

https://en.wikipedia.org/wiki/Wikipedia:Chesterton's_fence

Re:Ask HN: Codebase at my work is a complete mess, what shou... by mattmanser on Friday August 24, 2018 @04:20AM (#17833541)
I think if it's so frequent that you're sick to your back teeth of listening to people complain about your code, it's probably a really sure sign that something is very wrong with the code.
Re:Ask HN: Codebase at my work is a complete mess, what shou... by circlefavshape on Friday August 24, 2018 @05:02AM (#17833689)
Haha, good answer :) It's rarely my code they're whining about though
Re:Ask HN: Codebase at my work is a complete mess, what shou... by Aaargh20318 on Thursday August 23, 2018 @07:24AM (#17826286)
> I would agree with this, you need to be careful. I've seen a friend start at a new company with a horrendous code base, bring up the issues and be let go because they hurt / offended the existing developers.

I'm not sure if I agree. As a programmer I feel my primary responsibility is towards the code, not the company, not my colleagues feelings, not the customer. There are other roles who speak for them (sales, product owner, managers, etc.), I speak for the code.

When you get into the office in the morning, you hang both your coat and your ego on the coat rack, you can pick them back up when you leave. If someone can improve the code by tossing away 3 years of my work, then by all means. Doesn't matter if the person who suggested it is a senior with 20 years experience or the fresh out of college guy/girl who started just last week. You judge the idea on it's own merits, not by who suggested it.

I really don't get the tendency of allistic people to involve emotions in parts of their life where it's not helpful at all.

Re:Ask HN: Codebase at my work is a complete mess, what shou... by GVIrish on Thursday August 23, 2018 @11:30AM (#17828048)
I agree that ideas should be judged on their merits but you're still dealing with human beings. Someone could approach a bad codebase and say, "Here are some ways we could improve X, Y, and Z," but you could have another person say, "This was done in the stupidest way possible, we have to throw all this crap out."

If someone approaches things politely and professionally then no one should have a problem with constructive suggestions for improvement. But people sometimes approach things in a combative or disrespectful manner and that's when you run into problems.

Re:Ask HN: Codebase at my work is a complete mess, what shou... by saganus on Thursday August 23, 2018 @01:10PM (#17828910)
> If someone can improve the code by tossing away 3 years of my work

But how do you objectively measure "improvement of the code"?

Maybe it's something fairly obvious like better performance, less bugs, etc, but a lot of times it's very hard to tell if there was actually an improvement or just a different way of doing the same thing, except at the added cost of re-implementing those 3 years of work.

And for the record, I agree with you in that you (we) should leave your ego at the door, and if some young whippersnapper can do better than you, then you should be able to leverage that and increase the productivity/performance of the team/company.

However I've seen it happen many times where someone thinks they will improve the code but in reality (like others have said) they don't have the correct context and forget about a lot of stuff that their "improvement" should take into account but doesn't... and then once they do the "aha!" moment kicks in and they realize why it wasn't as easy to improve as they first thought.

Re:Ask HN: Codebase at my work is a complete mess, what shou... by LandR on Thursday August 23, 2018 @07:28AM (#17826306)
> When you get into the office in the morning, you hang both your coat and your ego on the coat rack, you can pick them back up when you leave. If someone can improve the code by tossing away 3 years of my work, then by all means. Doesn't matter if the person who suggested it is a senior with 20 years experience or the fresh out of college guy/girl who started just last week. You judge the idea on it's own merits, not by who suggested it.

>I really don't get the tendency of allistic people to involve emotions in parts of their life where it's not helpful at all.

I complete agree

Re:Ask HN: Codebase at my work is a complete mess, what shou... by wool_gather on Thursday August 23, 2018 @08:26AM (#17826631)
> You judge the idea on it's own merits, not by who suggested it. > I really don't get the tendency [...] to involve emotions [...]

You're absolutely right: if someone has a good idea for improvement, it should be adopted regardless of who they are.

The difficulty is that the suggestion of a total rewrite is not-infrequently prompted by a mostly-emotional reaction. It may not be taking all the important objective factors into account, so you have to be careful to assess whether it truly is a good idea.

Re:Ask HN: Codebase at my work is a complete mess, what shou... by raztogt21 on Thursday August 23, 2018 @11:30AM (#17828051)
Disagree, joined a company 3 months ago. Started a huge refactor the first week in. Then, a bigger refactor the second month in. I feel I've already earn my credentials with these 3 refactors.

The directors and the team leader appreciate the honesty and my initiative to make the codebase healthier.

Like Ray Dalio says, 'don't tolerate shit'.

P.D: I rewrote a huge section of the application on Vue2 with SFC's. The other three developers who wrote backend mostly, tried to do the FrontEnd, but made a complete mess.

Re:Ask HN: Codebase at my work is a complete mess, what shou... by TheGrumpyBrit on Thursday August 23, 2018 @09:47AM (#17827182)
In the meantime, use an issue tracker to keep a handle on all the stuff you actually need to do to bring this code up to speed. If a test needs creating, add an issue for it. I'd personally not keep this in a tracker that your manager uses to track metrics, but keep it separate and build it up.

If it's really a rewrite job, you'll end up with a lot of entries in there of varying size and complexity. You can start moving those issues across to whatever issue tracker your boss does keep an eye on as you get to them.

That way, you're not just walking in, announcing that the entire lot is garbage, and wasting time rewriting it all (which is what the business will think you're doing if the current implementation is at least vaguely functional), but you're gaining familiarity with the code and compiling a decent sized todo list that you can present at the appropriate time, as well as a list of fairly quick wins that you can get done when you have some downtime.

Re:Ask HN: Codebase at my work is a complete mess, what shou... by sandos on Friday August 24, 2018 @04:27AM (#17833567)
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 the entire system, functional/integration tests are also easier to argue for in terms for direct benefit for the customer. Unit tests are more for the developer and is harder to argue for.

Adding tests makes it easier to confidently refactor the code later on.

Re:Ask HN: Codebase at my work is a complete mess, what shou... by afx on Friday August 24, 2018 @08:29AM (#17834483)
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 shou... by epicide on Friday August 24, 2018 @09:22AM (#17834756)
Particular resources and guides are gonna depend heavily on language/frameworks/etc.

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 shou... by _drFaust on Friday August 24, 2018 @09:45AM (#17834883)
Hmm.. it's definitely tough to begin on a codebase with 0% coverage.

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 shou... by softawre on Friday August 24, 2018 @01:35PM (#17836398)
Re:Ask HN: Codebase at my work is a complete mess, what shou... by topmonk on Thursday August 23, 2018 @04:33AM (#17825557)
I agree here, but keep copious notes. I've found mind mapping software, like freemind is good for this. It will help keep you sane.

Without that, IMO trying to internalize large amounts of badly written code can negatively affect your brain's ability to come up with good, well written code. All those bad ideas and patterns become the first things that pop into your mind when you try and solve problems.

“When you stare into the void, the void stares back into you” sort of thing...

Re:Ask HN: Codebase at my work is a complete mess, what shou... by Hates_ on Thursday August 23, 2018 @05:07AM (#17825712)
Do you have any example of how you use mind mapping. I've tried a few times to use it but have yet to find a good way to layout my notes/thoughts in a map.
Re:Ask HN: Codebase at my work is a complete mess, what shou... by topmonk on Thursday August 23, 2018 @07:44AM (#17826379)
I don't have any hard and fast rules, but if it is a big complicated project I don't usually try and come up with a single coherent diagram of my thoughts. Instead, I start out with a node for the date, and a child node for a subject, and child node of that with a sentence or two concerning a topic I'm working on. If there are more details to it, problems, questions, etc. they become sub-nodes of that, and so on.

I don't usually change the details of nodes that I already worked on, but rather write what has changed in a new node with the same name but under a later date node. I find that it becomes a mess if I try and keep every node updated to what I currently think about it, because too much information builds up to efficiently do so. Also, a lot of what I write only make sense in the context of what I wrote on other subjects during the same time period, so if I change one, I end up having to rewrite more and more, which eventually becomes a big mess.

The main benefit is that I can go through my notes quickly, skipping minutia of topics I'm not interested in simply by not reading the details of a node. I used to use a text file, and that was a very big problem, because not only would the amount of text that I'd have to go through became daunting. Also, I sometimes found it hard to interpret what I wrote, which means I wouldn't know if it applied to the problem I was working on or not.

However, in contrast to the above, I do try and make a definitive structure if it's a small topic or a quick idea for a new project or something simple like vacation plans.

BTW, it also works very well for taking notes for a class or self-study.

Re:Ask HN: Codebase at my work is a complete mess, what shou... by sriku on Thursday August 23, 2018 @04:19AM (#17825506)
One way to deal with it is to understand why the mess in the first place. You may find reasons to forgive the mess. If you're looking at a startup that had to try a lot of things perhaps (and when the team was junior) hitting on the workable idea later, maybe they just did what they had to do. The forgivance may also give you the incentive to improve it. A good measure is whether the shitty code does something worthwhile and interesting. Might get you to a point of empathy.

Edit: "you" = OP

Re:Ask HN: Codebase at my work is a complete mess, what shou... by curun1r on Thursday August 23, 2018 @11:35AM (#17828090)
That 6 months is also a great opportunity to establish a test suite. It's dangerous to tell management that the code is bad. It's not dangerous to say that it needs tests, since that's an industry best practice and there are objectively no tests, and that you believe that a certain amount of your time needs to be devoted to paying back some of that testing debt. Then, when 6 months rolls around, you either have the confidence to do a major refactor/rewrite or leave and give the person who comes after you the test suite necessary to do the next step.

Plus, to my mind, there's no better way to start understanding a new codebase than to start with tests, either writing them or reading the existing suite.

Re:Ask HN: Codebase at my work is a complete mess, what shou... by eyezick on Thursday August 23, 2018 @05:12AM (#17825736)
To add on to this, you can still improve the code quality while building on it by adding tests as you go, so you can have some solace and also sanity when testing your own code.
Re:Ask HN: Codebase at my work is a complete mess, what shou... by vatotemking on Thursday August 23, 2018 @08:46AM (#17826758)
> My advice is don't complain and don't attempt any significant rewrites for the first 6 months or so.

Even if I didnt do anything, the code keeps breaking!

Re:Ask HN: Codebase at my work is a complete mess, what shou... by miry on Thursday August 23, 2018 @04:19AM (#17825507)
I came to this also. In first months of work is learning process: practices, workflows and processes. Then you should introduce changes via retrospectives. The same solution for outsource companies, that joined to old project. There are no time for such thing as debates which eggs are better. It should be introduce smoothly.
Re:Ask HN: Codebase at my work is a complete mess, what shou... by cooervo on Thursday August 23, 2018 @05:11AM (#17825735)
excellent advice.