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…
"My current theory is that programming is quite literally writing."
41–50 of 199 posts
Re: "My current theory is that programming is quite literally writing."
#42Oh 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 writing a novel, you do.
Re: "My current theory is that programming is quite literally writing."
#43I 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.
Re: "My current theory is that programming is quite literally writing."
#44I'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.
socket.close(); window.close(); file.close()Re: "My current theory is that programming is quite literally writing."
#45Earlier 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.
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."
#46Re: "My current theory is that programming is quite literally writing."
#47His 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.
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."
#48Most 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…
I wonder what the average startup codebase looks like?
Re: "My current theory is that programming is quite literally writing."
#49So 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...
"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."
#50Earlier 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.