Live data from Hacker News

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

news.ycombinator.com

51–60 of 151 posts

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

#51

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.…

> But I would advise taking time to consider whether it's actually, within the lens of yesterday (or 2 years ago)... good?

Other than to soothe egos, this almost never matters, because the person inheriting someone else’s code doesn’t live 2 years ago and can’t be blamed for not having the prior context (establishing that context is the job of the original author and is why documentation matters).

If you find yourself in the thankless position of having to reverse engineer intent and especially if you have an unsympathetic manager ready to lecture you about how you should magically read the mind of the original author, start looking for a new job and hack/slash away as much of the old code as possible to do the job that you’re asked to do.

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

#52

Not someone else's code but I had the strange experience recently of revisiting an old project of mine (DNS server written in typescript + deno) and being intimidated by the quality of my own code . I had those familiar feelings of "I could never write code like this" or "I'd never have thought to do it like that!" or "This person must really know their shit". Turns out it was me all along and I'd just forgotten I'd…

would love to look at it and possibly learn something. Is it open source?

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

#53
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.

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

#55
I worked on QRes (airline reservation system) while a contractor at ITA after it had been eaten by El Goog, but before it had been fully digested. It was really neat. It was written in Common Lisp, but that's not what made it cool other than in a superficial I-like-Lisp sense. But it was written by old Lisp wizards, and their meticulous attention to detail, including maintainability. It took just a couple of M-. in Emacs/SLIME to find what I was looking for and everything was structured clearly and easy to maintain/change.

And the testing! It came with its own testing DSL that allowed you to specify templates of expected XML results and check that the actual response from the live web service matched the template. A new test could be written in a handful of lines. The test suite was HUGE and comprehensive, and when adding a new test it was easy to find a group of similar tests to put it in. I never enjoyed writing test code as much as I did on that project, and that's how it should be for every project.

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

#56
Had to support an XML/SOAP interface to a legacy system that ran on AS/400, it was written in somewhat modern PHP, documented and formatted very well. Modular and easy to follow. I was very impressed. Had a very classic code feel to it where every source file had a massive comment section listing all the functions and explaining a bunch of stuff.

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

#57
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…

Same here. Knew nothing about Ruby before, the cleanliness and ease of deployment and database migrations/rollbacks with capistrano and rake made a great impression!

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

#58
I once inherited a reasonably good code base. It wasn't a large project but it did have a certain complexity; it was a web application to write and manage HTML-formatted e-mail templates that the company then sent for various purposes from different applications.

It had no testing and documentation was little more than a brief overview in the internal wiki so at first it didn't feel very welcoming. But then the code turned out to be quite well organized and approachable. I added to it a couple of features that had been ignored for some time and the code really made sense. It guided you quickly towards the correct places you'd need to work on.

Ultimately the project itself was somewhat flawed because nobody wants to layout and maintain e-mail templates, specially when somebody insists that they want "100% pixel-perfect coverage on all e-mail clients including Outlook Express 5.01" -in 2014-.

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

#59
Yes – I believe the author took the Design Patterns book and went to town.

The classes were small (What helped, I believe, was him coming from a Ruby / RoR background (extensive OOP usage) and the fact that this was his 2nd attempt at writing this, after he wrote a similar library in Ruby.

I think about some code to this day and try to emulate wherever possible. Although I think the guy that wrote it was also a very smart person and experienced programmer, so I don't beat myself up if I can't quite make it to that standard.

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

#60
Yes, at YouTube I inherited the Pilot Studio iOS codebase from Will Kiefer. This included a solid iOS application framework and a couple really nice prototypes. We hired some great folks, extended "PilotKit" quite a bit, and built a dozen incredible apps with it (Motion Stills, and the UX experiments that became YouTube Live and YouTube Stories, plus a bunch of fun internal stuff).
Post reply on HN