Live data from Hacker News

Ask HN: What's the largest amount of bad code you have ever seen work?

news.ycombinator.com

51–60 of 601 posts

Re: Ask HN: What's the largest amount of bad code you have ever seen work?

#51
I've worked on a CMS that was partially done in .NET, Iron Python and used an XSLT templating system to generate HTML for the front end.

The architecture looked like something from the Early Java days.

The system used Iron Python / C# in the following way.

1. A web request would hit the CMS 2. There was a massive switch statement to work out how the query would be rewritten 3. If it the url was prefixed with processor it would attempt to find the processor in the db. 4. The code would then find the python script associated with the processor. 5. The processor would then spin up a command line instance in a hidden command window on windows server. 6. The processor would have to return XML that had to be built up using strings (not element tree for you). 7. This would return the XML to the C# which would then try to render into the XSL Transform.

If at any time this failed. Silent failure. There was no way to debug easily (There was a magic set of flags that had to be set in Visual Studio or wise you couldn't debug the python scripts).

To get the software to build on a new machine. It took a contract 4 months to reverse engineer an XP machine. None of it was documented anywhere.

It used ImageMagick to generate thumbnails on the fly which doesn't work to well with windows server.

The lead engineer was an alcoholic. He used to go to the local pub for 4 hours in the middle of the day and come back smelling like a brewery.

Re: Ask HN: What's the largest amount of bad code you have ever seen work?

#52

My first job was sysadmin of a third tier ISP back in the dialup days. The account management and provisioning system that ran EVERYTHING was probably close to 100k lines of csh. Everything was done via a UI that the shell generated as a sort of curses-style interface. What was horrible about it was that it controlled everything from who got a website, active domains, what POPs users could dial into, metered billing,…

Wow this is legendary. I’d love to direct a short film or tv series that revolves around an IT/software team using a massive csh codebase like this. I’d love to generate some training montage / diagram sequence shots of the system being built by the characters maybe make some cool blender / adobe premiere overlay screen splits of the high level architecture as the team references certain aspects of the system

Re: Ask HN: What's the largest amount of bad code you have ever seen work?

#53

Earlier quoted context omitted.

"Don't touch this" around the main loop can mean being able to make promises about responsiveness, reliability, etc. Frequently there are critical code sections where it is much easier to tell people "don't touch it" rather than training people how to work on it safely.

When that is the case, would it not also be a really good place to explain why not, or provide a link to the place where such an explanation is provided?

In reality there often isn't time.

Getting it done > Getting it done properly as far a management is concerned.

Re: Ask HN: What's the largest amount of bad code you have ever seen work?

#54
12k line code-behind for an ASP.NET page that duplicates PDF files, driven off of a spreadsheet, and adds some additional information at the top of each page. This has generated the majority of a major state's ballots for at least the past 4 elections.

Re: Ask HN: What's the largest amount of bad code you have ever seen work?

#58
post #46

An Angular app with ~50k LOC. Barely any tests and several hand-rolled components, some of which were merged only because the author managed to implore somebody to give them an R+ after a few sprints of the branch just sitting there. A total of 21 people were involved in creating this system and for some insane reason we still had daily standups with almost full attendance.

What's the problem with "hand-rolled components"? Isn't that pretty much the essence of building non-trivial frontend stuff? Or does this have some special meaning in the Angular world?

Re: Ask HN: What's the largest amount of bad code you have ever seen work?

#59

We have absolutely no idea how to write code. I always wonder if it's like this for other branches of engineering too? I wonder if engineers who designed my elevator or airplane had "ok it's very surprising that it's working, let's not touch this" moments. Or chemical engineers synthesize medicines in way nobody but a rockstar guru understands but everyone changes all the time. I wonder if my cellphone is made by mac…

Your 2nd to last one is right I think. Other forms of engineering are constrained by physical world rules. In software we have to recreate reality and redefine and model how the real world system works. Mech eng/ chem eng etc don’t have to recreate reality , physics just works and will always work .

Re: Ask HN: What's the largest amount of bad code you have ever seen work?

#60
Ten years ago I was called in to remediate a new web application which had been subcontracted to an Indian development company. The PHP developers who'd put it together evidently didn't know about classes, and each page in the application was hundreds, sometimes thousands, of lines of spaghetti code, most containing the same duplicated (but subtly changed) blocks providing database connectivity etc. Security had not been a concern either; passwords and credit card details were stored unencrypted in database text fields.

I was called in because, while most of the application worked, some of the requested features were not yet complete. When I made my initial recommendation (scrap the whole thing and start again) I was told the client's board would not agree to that because of the money already invested and the fact that the board had seen a demonstration proving that "most of it worked".

It took two developers eighteen months to beat this sorry mess into a maintainable state while ensuring it remained "usable". It would have taken one third of that time to rewrite it from scratch.

Post reply on HN