Live data from Hacker News

"My current theory is that programming is quite literally writing."

ask.slashdot.org

41–50 of 199 posts

Re: "My current theory is that programming is quite literally writing."

#41
post #16

Most code sucks because we have the fluency equivalent of 3 year olds trying to write a novel. Let's get a little more specific... Most code sucks because the programmer: - didn't name his variables what the really were - didn't understand variable state - didn't understand variable scope - didn't understand the basic concepts of iteration - didn't understand any of the algorithms he needed - wrote the same lines of…

All of those are absolutely true, and many of them reduce to one thing - didn't have a frickin' clue what the code was supposed to do I remember reading the old cartoon (and it was already old when I saw it 25 years ago) of the manager saying "You guys start writing code, I'll go find out what they want", and swearing I would never be that kind of manager only to find, all those years later, that many of my programme…

You say that on a site where the ethos is "start building a company and product now, we'll figure out what it should do later" - because that's a way that works.

Re: "My current theory is that programming is quite literally writing."

#42
post #10

Oh come on. Programming is not writing. When you're reading a novel you don't have to worry about concurrent access to a resource, threads, asynchronous events, or even much less conditional branching. With all due respect, I think this is just an inane post. That said, I can't blame the guy for dropping software development and moving to Japan to teach ESL. I often entertain similar fantasies all the time - programm…

When you're reading a novel you don't have to worry about concurrent access to a resource, threads, asynchronous events, or even much less conditional branching.

When you're writing a novel, you do.

Re: "My current theory is that programming is quite literally writing."

#43
post #29

I find it fascinating that Python seems to be the only language which created a word to describe idiomatic code: pythonic. Having learned Python as a first programming language I always try to gain an idiomatic understanding of the language which allows myself to think in Python.

Other languages call such code... idiomatic :-)

Re: "My current theory is that programming is quite literally writing."

#44
post #6

I'm a little suspect if this analogy goes beyond "theoretical understanding without practical experience is worthless". You could draw a similar analogy between architects who know everything about architecture but don't know how to design proper buildings because they have no experience. Or painter who knows everything about technique but can't paint a horse and so on. It is easy to find differences between good wri…

Uniformity in code is bad - it tells you that there's a common concern or pattern which should be factored out. Uniformity in code style is essential, the same way it is for prose.

Is it? In prose you say "first he rushed to the exit door, then he leaped down the stairs, finally he ran to get the train" while in programming it is better to write

    socket.close(); window.close(); file.close()

Re: "My current theory is that programming is quite literally writing."

#45

Earlier quoted context omitted.

All of those are absolutely true, and many of them reduce to one thing - didn't have a frickin' clue what the code was supposed to do I remember reading the old cartoon (and it was already old when I saw it 25 years ago) of the manager saying "You guys start writing code, I'll go find out what they want", and swearing I would never be that kind of manager only to find, all those years later, that many of my programme…

You say that on a site where the ethos is "start building a company and product now, we'll figure out what it should do later" - because that's a way that works.

I think the ethos here is clearly different than you suggest. Trying to build a product without having an idea what it should do is not a way that works.

Being open to refining your idea or pivoting as you go is a horse of a different color.

But trying to write code without a clear purpose in mind is the equivalent of monkeys banging away at typewriters, to return to our "writing" metaphor.

Re: "My current theory is that programming is quite literally writing."

#46
This discussion brings to mind Robert Lefkowitz's Pycon keynote from 2007 on Programming Literacy, very similar to this video from Stanford: http://www.youtube.com/watch?v=Own-89vxYF8. He is definitely an advocate of literate programming and basically says we will all be able to read programs when they can be written in English and not in code.

Re: "My current theory is that programming is quite literally writing."

#47
post #39
post #20

His theory might be true if you were only talking about writing a program from scratch. But programming is a lot more than that, because except for the smallest, most trivial exercises, programming is a team sport. Which means you need to be able to understand somebody else's code, and you also need to be able to modify it in a way that makes sense. You can have a program which is beautifully structured, and factored…

Ask a novelist about the pains they have when the extremely clean, excellent plot fails due to some small point, and they have to adjust it.

I can think of a number of novels where it's obvious some scenes got moved around for plot reasons, and their were continuity errors or other ways in which the seams showed.

But novelists only have to deal with that for maybe a year or so; programmers have to deal with this problem for potentially decades, and at that point it's a completely different problem just because the scale is different.

Re: "My current theory is that programming is quite literally writing."

#48
post #16

Most code sucks because we have the fluency equivalent of 3 year olds trying to write a novel. Let's get a little more specific... Most code sucks because the programmer: - didn't name his variables what the really were - didn't understand variable state - didn't understand variable scope - didn't understand the basic concepts of iteration - didn't understand any of the algorithms he needed - wrote the same lines of…

meh. i work at a small shop. most of the code i see that sucks was written by competent programmers under high schedule pressure. the code is clearly not well understood anymore, but if you trace the history you can see it's due to a few years of tacking on features as quickly as possible. the technical debt surely slows us down sometimes, but hey that was a business decision, maybe even a correct one! core business functionality is rock solid, its mostly UI code that sucks.

I wonder what the average startup codebase looks like?

Re: "My current theory is that programming is quite literally writing."

#49
post #19
post #5

So what's good example code? Sadly (and tellingly) it's not necessarily the most successful code (success comes from meeting user needs, not from good code), but how else can you judge it, apart from reading it. This is made worse because it's hard to tell if code is necessarily complex without understanding the problem it solves, which may be complex. Further, if you don't yet know what good code is, how can you rec…

Sadly (and tellingly) it's not necessarily the most successful code (success comes from meeting user needs, not from good code), but how else can you judge it, apart from reading it. Schools have suggested reading lists. Do they have the same for code reading ? Fortunately, on the Internet, we have experienced people to help us: http://www.hnsearch.com/search#request/all&q=%22good+cod...

Interesting. You could teach blocks of code in a similar manner to the way poetry is taught.

"Why did the author do this?"

"What effect do you get when reading this block?"

Re: "My current theory is that programming is quite literally writing."

#50
post #47
post #39

Earlier quoted context omitted.

Ask a novelist about the pains they have when the extremely clean, excellent plot fails due to some small point, and they have to adjust it.

I can think of a number of novels where it's obvious some scenes got moved around for plot reasons, and their were continuity errors or other ways in which the seams showed. But novelists only have to deal with that for maybe a year or so; programmers have to deal with this problem for potentially decades, and at that point it's a completely different problem just because the scale is different.

I'm working my way through Stephen Donaldson's latest Thomas Convenant novel (book 9), a series he started writing in the 70's (first book published in '77). He expects to have the final book (book 10) completed by Fall 2013
Post reply on HN