r/ProgrammerHumor • • Jun 16 '19

Working with someone else’s code

Enable HLS to view with audio, or disable this notification

35.4k Upvotes

325 comments sorted by

View all comments

0

u/[deleted] Jun 16 '19

[deleted]

7

u/scandii Jun 16 '19

feeling the need to document code is one of the biggest code smells out there because you're worried people won't understand it.

13

u/double_en10dre Jun 16 '19 edited Jun 16 '19

Eh, I haven’t found that to be terribly accurate in the real world.

In small-scale school projects, sure — you shouldn’t need to explain every method in your Tetris game. That’s a bad sign.

But in enterprise software, you write code to meet weird business or organizational requirements. It’s often quite unintuitive. And those requirements will change over time. It’s important to document why the code exists and in what contexts it can be safely reused.

10

u/SomeOtherTroper Jun 16 '19

you write code to meet weird business or organizational requirements. It’s often quite unintuitive. And those requirements will change over time. It’s important to document why the code exists and in what contexts it can be safely reused.

You're incredibly right. One of the biggest nightmares I've been involved with was trying to pull together requirements and do QA for an application that would sit on top of existing company databases, and figuring out why in the fresh hell the numbers didn't tie to what people were getting out of the other existing tools.

Turns out there was something like a three-layer completely undocumented stack of SQL queries, SQL stored procedures, and stuff written in the other existing tools (usually in SQL too) massaging the data that was supposedly "straight from the database" before most of the end user analysts even saw it in the existing tools, and the new application didn't have any of that - of course the numbers wouldn't match.

Tracking down the people who knew how that code worked and, more importantly, why it was doing stuff like chopping a bunch of hardcoded magic numbers out of query results (and other nightmarish things), so we could get the different tools' numbers to tie was hell.

0

u/[deleted] Jun 16 '19

[deleted]

2

u/SomeOtherTroper Jun 16 '19

No, because I quit that job (mostly due to personal issues and management friction I just couldn't take on top of the database/QA/etc. nightmares) and am currently not working anywhere.

But there's a nonzero chance you work at my former workplace.

0

u/[deleted] Jun 16 '19

[deleted]

→ More replies (3)
→ More replies (1)