BAM Weblog

Don't write code on line #45

Brian McKenna — 2016-02-22

There’s an argument going on in the DynamoDB community right now. Should you write code on line #45 or not. I strongly believe that line #45 should be left empty. Here’s why.

Line 45 is below the fold

Terminals are 24 lines high by default. If you write any code on line #45 then programmers won’t immediately notice it. If you leave line #45 empty then the programmer won’t miss out on anything. We spend more time reading code than writing it, so make sure the code can be seen.

Line 45 is unpractical

I’ve tried learning line #45 many times but I’ve never easily picked it up. If you look around the web you’ll find lots of different tutorials trying to teach you how to write code on line #45 and they’re full of abstract details. I just want to write some code. The current lines I use don’t make it this hard.

I got on IRC and someone told me that I was looking at the wrong tutorials and they had written some exercises instead. I’m sorry, but you can’t expect those lowly other industry programmers to spend time doing exercises. When you get a bug in production code, you can’t waste time working through exercises for line #45 and especially when you’re on call at 3 in the morning.

Line 45 is unnecessary

As far as I know there’s no programming language which really requires you to put any code on line #45. Since it’s not required, we should try and avoid it. I think everyone agrees that having no code on line #45 is more simple than having code on line #45.

Everything should be made as simple as possible, but not simpler.

You don’t have to delete the line, just leave it blank.

Lines 1, 39 and 60 are better

I know it’s subjective but syntax really does matter. Anyone who has trained a junior developer knows that lines #39 and #60 are more intuitive. It does take a bit more time to write code which belongs on line #1 but everyone has become familiar with how it works by now. We shouldn’t go screwing with existing idioms by writing code on line #45 when schools are mostly teaching using line #1 instead.

Conclusion

Some of us have been writing code without line #45 for decades. We’ve shipped dozens of applications serving millions of users. It’s a solid and well understood method of programming. Trying to be clever by using line #45 is not serving your users and it’s just massaging your ego. Be kind to the poor ops people at midnight who have to keep your site live and have to step through line #45 in their debuggers.

Line #45 - we don’t need it.

Please enable JavaScript to view the comments powered by Disqus.