Live data from Hacker News

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

news.ycombinator.com

501–510 of 601 posts

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

#501
post #245

At one stage a company I worked for was considering licensing the code for a school time-tabling application, rather than paying the company to do the (fairly minor) changes we required to meet (non-USA) state requirements. The company was started by a couple of teachers, the same people who wrote their product. It was 10s of ks of Pascal code, but with not a single variable name or function name that made any sense;…

Code obfuscation + blackmail negotiations ... awesome company to do business with.

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

#502

A customer-facing dashboard. Yes, a dashboard. How bad can a dashboard be bad you ask? Well, for one, the dashboard had tabs, and each tab was a separate webapp hosted on a separate server. And each team was responsible for developing and maintaining the webapp that their team was incharge of (i.e the User team in charge of Users webapp, Feature1 team incharge of Feature1 webapp). Now add on the fact that different t…

Sounds like many resumes were polished at that company.

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

#503
post #498

Earlier quoted context omitted.

You've violated the terms of service of Oracle Database by insinuating the codebase quality is in any way not superior to any and all competitors. No benchmarks or comparisons may be performed on the Oracle Database Product under threat of grave bodily harm at the discretion of our very depraved CEO.

I doubt the competition (e.g. IBM or Microsoft) has any better code quality. Even PostgreSQL is 1.3M lines of code, so let's get something deliberately written for simplicity. SQLite is just 130k SLoC, so another order of magnitude simpler. And yet, even SQLite has an awful amount of test cases. https://www.sqlite.org/testing.html

I guess that is just because SQL as a standard is not coherent nor something beatifully designed. SQL is mashup of vendor specific features all bashed togehter into one standard.

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

#504
post #431

Earlier quoted context omitted.

I think TDD is the best way to develop (yet). Obviously tests are code, and if you write crappy highly-coupled tests you will end up with only much more messy code. This is a clear example of bad testing. The greatest advantage of TDD is in design, everything should be modular and easy to unit test, so you could: - reproduce bug and verify your bugfix in matter of ms with proper unit test - understand what code does…

A unit test is the least useful kind of test. It requires your design to be "easy to unit test" instead of simple, and if you change something and have to rewrite the test you might miss some logic in both pieces. Plus the tests never break on their own because they're modular, and each time you run a test that was obviously going to pass, you've wasted your time. As long as you have code coverage, better to have lot…

Integration tests are much slower usually, and you are testing tons of things at the same time. Something breaks (like in that example) and you have no idea of what and why went wrong.

If you unit test properly you are unit testing the business logic, that you have to properly divide and write in a modular fashion. If you want to test a more complex scenario, just add initial conditions or behaviors. If you can't do that or don't know how to do that, then you don't know what your code is doing or your code is bad designed. And that may be the case we read above.

Tests rarely break because they help you not breaking the code and functionalities, and they are so fast and efficient on making you realizing that that you don't feel the pain of it.

I can't imagine any example where "easy to unit test" != simple

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

#505

Earlier quoted context omitted.

Yes, both. But maybe one is more important?

I'd argue the tests is more important for example Oracle is still the leading commercial DB, If your product works people will buy it.

Isn't that mostly due to momentum? But if Oracle can't keep up with the features customers need, they'll lose that momentum.

Enterprise software sales cycles are slow, but once they start turning, it's hard to turn them back.

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

#506
post #18

Oracle Database 12.2. It is close to 25 million lines of C code. What an unimaginable horror! You can't change a single line of code in the product without breaking 1000s of existing tests. Generations of programmers have worked on that code under difficult deadlines and filled the code with all kinds of crap. Very complex pieces of logic, memory management, context switching, etc. are all held together with thousand…

Perhaps the most valuable part of this whole thing are the tests. Perhaps with that test bank, one could start from scratch to write a new database.

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

#507
post #454
post #451

Earlier quoted context omitted.

I'm confused by your comment. Your premise is that TDD should die, and your support is comparing it to a "great tool". Should TDD really die, or should people just stop treating things as a silver bullet? I personally love TDD, it helps me reason about my interfaces and reduces some of the more cumbersome parts of development. I don't expect everyone to use TDD and I don't use it all the time. Similarly I'd never tel…

The thing is, when I spend a lot of time thinking about how to make my program type-safe all of my unit tests become either useless or no-ops Integration tests easily survive refactoring, on the other hand

TDD should only drive the public interface of your "module", if your testing your internals your doing it wrong. It will hinder refactoring rather than help.

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

#508

A customer-facing dashboard. Yes, a dashboard. How bad can a dashboard be bad you ask? Well, for one, the dashboard had tabs, and each tab was a separate webapp hosted on a separate server. And each team was responsible for developing and maintaining the webapp that their team was incharge of (i.e the User team in charge of Users webapp, Feature1 team incharge of Feature1 webapp). Now add on the fact that different t…

Sounds like how they do it at Spotify

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

#509
post #498

Earlier quoted context omitted.

I doubt the competition (e.g. IBM or Microsoft) has any better code quality. Even PostgreSQL is 1.3M lines of code, so let's get something deliberately written for simplicity. SQLite is just 130k SLoC, so another order of magnitude simpler. And yet, even SQLite has an awful amount of test cases. https://www.sqlite.org/testing.html

I guess that is just because SQL as a standard is not coherent nor something beatifully designed. SQL is mashup of vendor specific features all bashed togehter into one standard.

There's also a lot of essential complexity there. SQL provides, in essence, a generic interface for entering and analyzing data. Imagine the number of ways to structure and analyze data. Now square that number to get the number of two tests for how two basic features of the language interact with each other. And that's not even near full test coverage.

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

#510
post #366

Earlier quoted context omitted.

Code like this makes me think of the famous line from the film version of Hellraiser: "I have such sights to show you..." Contrast PostgreSQL or... uhh... virtually any other database. Oracle's mess is clearly a result of bad management, not a reflection of the intrinsic difficulty of the problem domain.

The KDB+ database has been around for 20 years. The executable is ~ 500kb. Enterprise software is gross.

> The executable is ~ 500kb.

So... is this good or bad? A Hello World in Go is on the order of 2 MB. That doesn't say anything about code bloat, it just says that Go prefers static over dynamic linking.

Post reply on HN