Live data from Hacker News

Ask HN: Have you ever inherited a code base you thought was well done?

news.ycombinator.com

61–70 of 151 posts

Re: Ask HN: Have you ever inherited a code base you thought was well done?

#61
I once inherited a Verilog-A interpreter made by some guys at Motorola. My boss said the code was awful, I found it really nice, structured and well commented.

I ripped it off and replaced with a compiler with waay better performance. It was appreciated but I think my code, while more effective wasn't as nice to look at.

Re: Ask HN: Have you ever inherited a code base you thought was well done?

#62
post #34

The codebase I'm working on now is what I consider an exemplary Ruby on Rails project. It is 14 years old and still going strong. It is structured exactly like you'd expect a Rails project to be structured. The gems the authors chosen have been reliable so far with few exceptions. We regularly step into sections of code that are 5 or even 10 years old, and modify/extend them with no issue. Even brand new programmers…

Yes. I'm working on an actively developed rails product that is close to 10 years old. All the stuff that just followed the "rails way" is still super easy to work with to this day. All the "experiments" (you find these in any old code base as developers and fads come and go) in "decoupling from rails" or whatever are extremely fragile and difficult to work with.

This applies to almost any programming language - things done "the standard way" will survive decently well (or have obvious migration paths) - things done "your own way" will be more fragile.

Of course, languages vary on how much they have a "standard way" of doing things.

Re: Ask HN: Have you ever inherited a code base you thought was well done?

#63
Yes-- working right now on a tool that uses Rust compiler internals. A previous contributor made a module with a clean interface to almost all of the compiler analyses I needed and without much compiler cruft. Coming across it was a borderline religious experience.

Re: Ask HN: Have you ever inherited a code base you thought was well done?

#64
Yes, I work on an 11 year old Ruby on Rails codebase, and except for a few sections that are a little overengineered and crufty (Asset compilation..... enough said), the bulk of the codebase and the entirety of the "business logic" is really easy to understand and navigate. About the only time new engineers ever have problems finding something is when it's defined in a "has_" macro with dynamic interpolation, but those cases are pretty rare, and you generally learn to recognize them over time. And certainly it makes using and sharing the code much easier when those larger pieces of repetition are extracted (for example, we have an "acts_as_markdown :column_name" macro that defines e.g. column_name_as_html and column_name_as_plain_text methods). And the validation/callback structure makes it really easy to add new features without having to worry about breaking old ones, and the testing experience with rspec is second-to-none.

Re: Ask HN: Have you ever inherited a code base you thought was well done?

#65
post #44

I once inherited an old ASP.NET Web Forms code base, I was a solo developer at that time. I hated it, on my young and inexperienced eyes “everything was a mess”. It didn’t follow any good practice. The code didn’t have any layer, most of the code was written in the view and it didn’t follow the DRY principle, it had just a few libraries to share some code, so there was a lot of repetition. Of course, I started “impro…

Ugly code is often ugly because the ugly part is visible, like the piping in your basement.

Pretty code is often pretty because the ugly part is hidden, like the piping in your bathroom.

I know where I'd much rather have a bug (leak), personally.

Re: Ask HN: Have you ever inherited a code base you thought was well done?

#67
Sure, about three years ago I picked up a Gatsby project.

The codebase was just… normal, it was fine. Really two simple for there to be anything I would object to.

It was, however, my first exposure to Gatsby. I had struggled in the past with the older approaches to React SSR, absolutely eye-opening, changed everything about the way I work.

Re: Ask HN: Have you ever inherited a code base you thought was well done?

#68
One that I inherited that's around 10 to 12 years old now, I think it was designed reasonably well. Certainly some things I would do differently, and some flaws, but I think they knew what they were doing and did a good, or at least decent, design.

Since it was written in a language and framework for which I have no particular expertise, I'm judging this purely off the things I do know -- the rough structure of an MVC, and database design. Maybe the way they used the framework is poor, but it looked decent to my untrained (in language and framework) eyes.

Re: Ask HN: Have you ever inherited a code base you thought was well done?

#69
post #42

I would argue that a lot of the time, people do not inherit a "bad" codebase. They inherit a codebase that successfully made enough of the right quality-vs-speed tradeoffs to survive long enough to be inherited by someone other than its original author. It's easy to spend a day with a codebase (that others spent years writing) and call it "bad". I'd argue it even feels pretty good to take that stance of superiority.…

> They inherit a codebase that successfully made enough of the right quality-vs-speed tradeoffs Or was lucky enough that all the choices they made did not blow up yet. I totally understand the value of technical debt. But I have also seen in the wild cases where people thought the codebase was great simply because they hadn't run into cases where its rotten core would be exposed. Yet.

Yeah that’s my current place. When I got there management didn’t even realize how bad the code was or that spending 70% of dev power on big fixes wasn’t acceptable.

Re: Ask HN: Have you ever inherited a code base you thought was well done?

#70
post #34

The codebase I'm working on now is what I consider an exemplary Ruby on Rails project. It is 14 years old and still going strong. It is structured exactly like you'd expect a Rails project to be structured. The gems the authors chosen have been reliable so far with few exceptions. We regularly step into sections of code that are 5 or even 10 years old, and modify/extend them with no issue. Even brand new programmers…

> It is 14 years old

Curious - what version of Rails is it running on?

Post reply on HN