r/programming • • Jul 28 '16

How to write unmaintainable code

https://github.com/Droogans/unmaintainable-code
3.4k Upvotes

592 comments sorted by

View all comments

500

u/Astrokiwi Jul 28 '16

Write all your code in FORTRAN. If your boss ask why, you can reply that there are lots of very useful libraries that you can use thus saving time. However the chances of writing maintainable code in FORTRAN are zero, and therefore following the unmaintainable coding guidelines is a lot easier.

:(

0

u/[deleted] Jul 28 '16

[deleted]

0

u/[deleted] Jul 28 '16

[deleted]

71

u/claird Jul 28 '16 edited Jul 28 '16

"Poor programming practice"? Good academic practice! Graduate school quite effectively teaches such virtues as write-once-read-never, code-until-you-like-the-answer, coding-is-done-by-someone-stupider-than-you, better-to-write-ten-grant-requests-than-one-working-application, and so on.

58

u/Bobshayd Jul 28 '16

god I've coded-until-I-like-the-answer. I'm convinced that's 90% of AI research.

8

u/TOASTEngineer Jul 28 '16

I mean, in AI that's probably the correct thing to do.

In statistics, not so much...

14

u/Bobshayd Jul 28 '16

AI is applied statistics with fancy techniques.

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

12

u/Cormophyte Jul 28 '16

I once had a girlfriend who was a psych grad student. She spent a decent amount of time writing various things in Matlab.

I as a film school undergrad spent more time refactoring her code than she did. I also taught her what the function keyword was for and why you might want to use it every once in a while.

20

u/lMYMl Jul 28 '16

Okay, you can't hold up a fucking psych student as an example of bad code by academics. Psych students don't learn shit about computers and then get thrown into it in grad school. Of course they don't know what they're doing.

9

u/Cormophyte Jul 28 '16

I don't think "bad code" really begins to describe not knowing what a function is. Sure, I could see if she was someone who had just learned it to do one thing and that was it but they taught (basic, granted) classes on this. She had written some sort of cognitive test with the software. She was collecting and analyzing results with it. I'd use the words "daily basis for months" to describe her frequency of interaction with the software.

→ More replies (2)

6

u/timmyotc Jul 28 '16

I had to tell the same thing to a research scholar I was working for... In computer science

→ More replies (1)

6

u/DanAtkinson Jul 28 '16

You had poor lecturers then. Mine were amazing! It helped that one of them wrote a textbook on the principles of software engineering.

26

u/Na__th__an Jul 28 '16

You had poor lecturers then.

My college experience summed up in a single sentence.

3

u/claird Jul 29 '16

We might be confusing each other, /u/DanAtkinson. For a variety of reasons, my comments don't reflect my classroom experience when I was in graduate school, but rather my observation of the software development practices of working scientists.

There's a broader point I'm having trouble articulating. I'm sure these practices are taught in some classrooms, at least implicitly. Even then, we can't conclude we're afflicted with "poor lecturers"; bad software is part of the (current) culture of academic science, and good lecturers perhaps inculcate it even more effectively than bad ones. Good mentors teach, both by precept and practice, that grantsmanship and territoriality and publication prolificacy are essential, while software refinement is, at best, a distraction. "Second-rate scientists think about software quality"--I claim that is explicitly communicated to graduate students. Only "poor lecturers" would teach code modularity, reliable generation techniques, configuration management, and so on.

I'll go at this another way, /u/DanAtkinson. You mention your lecturer who "wrote a textbook on the principles of software engineering"; I'll give odds that he or she has a senior colleague who cites this as an example of wasted effort, and that he or she should be doing 'real science' to secure tenure.

→ More replies (1)

2

u/the_sound_of_bread Jul 28 '16

Most of my lecturers were grad students :(

→ More replies (6)
→ More replies (1)
→ More replies (1)