Live data from Hacker News

Write Less Code

mikegrouchy.com

1–10 of 54 posts

Re: Write Less Code

#2
Any day that has a negative LOC count is a good day :)

This usually means I found a good refactoring, or a good abstraction that removes a lot of stuff that is now boilerplate.

If I can also add a feature with a negative net LOC count, it is a gold-star day :)

That being said, sometimes just dumping a pile of code that passes tests, but is large (bloated), unwieldy and redundant is the right move. It give me something to refactor and abstract, and gets things done.

It's all about balance.

Re: Write Less Code

#3
Code you never write never breaks. It has astonished me how much code people can crank out. It does not astonish me that they spend most of their time maintaining things they've written.

Re: Write Less Code

#4
From a product owner's or designer's perspective this would be "add less features" which is an equally good idea and also requires less code.

Re: Write Less Code

#6
I find as a general rule, the more that my application tries to abstract and protect the user from the "technical" nature of the platform the more code I have to write.

For example I produced a CMS that was intended to be used by content writers who were not technical. However as the complexity of the website increased (more dynamic content on pages etc) I had to write a lot of code because there were a lot of exceptional cases "I want this side bar to appear on all of these types of pages apart from these 3 because of condition X and this other one because of condition Y". This means that my code ends up being an enormous pile of if statements with a huge number of database flags at the backend and checkboxes on the front end.

In the end it proved more effort efficient to produce a simple tag language for the front end and expose that to the designers and content writers, this took a lot of complexity out of the back end which could then concentrate on providing the primitives for the tag language.

You do move some complexity to the front end here for sure, but people are often better at specifying what it is they mean if they can actually generate and tweak it to some extent themselves and show the result rather than trying to explain everything in an email.

Another great example of this is Unix command line utilities , the basic interface for many of these has remained relatively unchanged since the 80s whereas GUI applications seem to be continuously redesigned.

Re: Write Less Code

#7

I find as a general rule, the more that my application tries to abstract and protect the user from the "technical" nature of the platform the more code I have to write. For example I produced a CMS that was intended to be used by content writers who were not technical. However as the complexity of the website increased (more dynamic content on pages etc) I had to write a lot of code because there were a lot of except…

Part of the zen of Python is "Flat is better than nested". Until recently, I always thought of this at a code block/function level. Recently I realized that this is also important when modularizing and adding layers of abstraction. The more layers of abstraction (from foo.bar.baz import Baz) you add, the more code you write and have to "keep in your mind". This presentation by Jack Diederich at PyCon 2012 really opened my eyes to the potential problems of adding layers of abstraction via modules and classes: http://pyvideo.org/video/880/stop-writing-classes

Re: Write Less Code

#8
I would go even further: to be a good developer you have to hate programming. If you like to fiddle too much, you'll waste time messing around and bikeshedding instead of taking your time to think about the problem at hand at a more fundamental level. Sometimes you solve a programming issue without writing even one line of code, but challenging the business requirements instead. It's important to be holistic.

Re: Write Less Code

#9
the job of a designer is it, to let things look beautiful in different ways: in the way it looks, it feels, how to use it and so on. i wouldn't say that i'm only a software engineer, but also a software designer.

  code == ui
code has to look beautiful, it should feel good to work with, easy to use, etc.

maybe this is all about the zen of coding.

Re: Write Less Code

#10

Any day that has a negative LOC count is a good day :) This usually means I found a good refactoring, or a good abstraction that removes a lot of stuff that is now boilerplate. If I can also add a feature with a negative net LOC count, it is a gold-star day :) That being said, sometimes just dumping a pile of code that passes tests, but is large (bloated), unwieldy and redundant is the right move. It give me somethin…

I’m with you. The most rewarding thing about diving into a large codebase is that you have many opportunities to refactor while you add features. At my current job I add only marginally more code than I delete. Feels good. :)
Post reply on HN