Live data from Hacker News

How to Write Unmaintainable Code (1999)

doc.ic.ac.uk

41–50 of 72 posts

Re: How to Write Unmaintainable Code (1999)

#41
post #11

They are missing the creatieve use of your version control system. First, make sure none of your commits actually build out of the box; forget a file for a few revisions, accidentally check in a corrupted XML file, etc. Create a "trunkV2" directory, and keep committing to both trunk and trunkV2. Add a third trunk inside the "branches" tree (/branches/featureX/newTrunk; I have seen this n practice, with random custome…

Within the same repo, have two branches: database and Database and alternate between them.

Re: How to Write Unmaintainable Code (1999)

#42
post #5

> You earn extra Brownie points whenever the beginning and end of a block appear on separate pages in a printed listing. I'm aware that this is from 1997-1999, but I'm curious: Do people still print out source code for better reading?

I am a mechanical engineer and lots of my friends have a thesis where appendix 3 is a bunch of printed MATLAB code. Of course in this case it doesn't matter because no one will ever read it.

Re: How to Write Unmaintainable Code (1999)

#43
post #11

They are missing the creatieve use of your version control system. First, make sure none of your commits actually build out of the box; forget a file for a few revisions, accidentally check in a corrupted XML file, etc. Create a "trunkV2" directory, and keep committing to both trunk and trunkV2. Add a third trunk inside the "branches" tree (/branches/featureX/newTrunk; I have seen this n practice, with random custome…

Branching:

Copy folder X, paste it and name it 'X-branch-'

Make sure that is not in the same format as any previously used, if you run out of formats, change the ordering or add your name, e.g.:

'140215-kraftman-MAIN-BRANCH2'

Re: How to Write Unmaintainable Code (1999)

#44
post #11

They are missing the creatieve use of your version control system. First, make sure none of your commits actually build out of the box; forget a file for a few revisions, accidentally check in a corrupted XML file, etc. Create a "trunkV2" directory, and keep committing to both trunk and trunkV2. Add a third trunk inside the "branches" tree (/branches/featureX/newTrunk; I have seen this n practice, with random custome…

Yes, I'm sure that git can irrevocably destroy any source code, you don't even need to know anything about git for that. As an added bonus, you can have as much differently broken “repositories” of the same project as you like.

Re: How to Write Unmaintainable Code (1999)

#45

There's only one rule: 1. Don't write fast running behavioural tests that verify the software is working as required. With fast running tests I can maintain any old crap. Well, technically speaking I can rewrite it, but no-one will mind.

Write tests that ensure each subroutine is called with specific parameters, so that functionally identical modifications cause the test to fail. Any change to the code now requires a change to several tests.

Isn't that what TDD is all about? The logical consequence is code that vitally depends on the existence of specific tests.

Re: How to Write Unmaintainable Code (1999)

#46

How about obfuscated MUMPS? P R I N T S (A,L)=1,(S,T)=I N G G I V E N A O F A=L:L:S Q:U=A R E S B=E L O W (A*A),! I S (U,R,E)=T H 1 N K I T=S G O O D

Does readable MUMPS even exist?

Yeah but it's not proper style.

Re: How to Write Unmaintainable Code (1999)

#48
post #40

Earlier quoted context omitted.

> I'm aware that this is from 1997-1999, but I'm curious: Do people still print out source code for better reading? I know a bunch of embedded C programmers who have been doing it for a long time who do this regularly. They know their stuff. They don't print out the whole codebase, just a few pages of whatever they're working on, then they annotate it with a pen while thinking about whatever problems they are solving…

I can imagine this being more helpful if you lacked access to a debugger, and lacked the time (or desire) to build debugging tools by other means... Which I imagine is plausible in that context.

No, they have debuggers and modern dev tools. They just prefer to read code from paper when they have to really focus on it for a long time.

Re: How to Write Unmaintainable Code (1999)

#49
And yet give me a code base with clear contracts, narrow interfaces and minimal dependencies with EVERY ONE of these so-called 'violations'...all of which are are trivial to contend with if you have a good software architecture.

Am wondering when our industry will see this forest for the trees...

Re: How to Write Unmaintainable Code (1999)

#50
post #5

> You earn extra Brownie points whenever the beginning and end of a block appear on separate pages in a printed listing. I'm aware that this is from 1997-1999, but I'm curious: Do people still print out source code for better reading?

I haven't recently, but I have 4 monitors at work. I use emacs with follow mode and multiple buffers opened so I can see lots of text at once. But when I only had one monitor, I printed a lot of things out. The difference is like trying to drive a car in the winter with only a 1'x1' patch of clear windshield versus having the entire view.
Post reply on HN