Live data from Hacker News

Torvalds' quote about good programmers

programmers.stackexchange.com

81–90 of 108 posts

Re: Torvalds' quote about good programmers

#81
post #22

Next week on Hacker News: Bad Programmers worry about their code. Good programmers ship. "Bad programmers [technique A on programming KPI metric N1]. Good programmers [technique B on programming KPI metric N1]." Responses: Someone will ask, "What about metric N2?" And someone will say, "What about technique C?" Someone will post a personal anecdote showing that people really underestimate the value of A. Someone will…

10 people learn about techniques A, B, and C who didn't before. 10 other people start thinking in terms of metrics N1 and N2 who weren't before. We learn and improve collectively. I think that is a pretty amazing thing about the internet and boards like this. That's not to say that some things don't get passed around a lot , but that's generally because they're worthwhile enough to make sure that everyone gets a look…

Sure, and after six months, 5 of those 10 people learn more stuff and the 5 others become dogmatic mouth pieces for technique A,B and C.

The ideal approach is to not just teach someone a new approach but to make it clear that they have to keep learning rather than giving them the impression that they've finally found the holy grail of programming.

Re: Torvalds' quote about good programmers

#82
post #4

This is one of the few programming quotes that is not just abstract crap, but one thing you can use to improve your programming skills 10x IMHO. Something like 10 years ago I was lucky enough that a guy told me and explained me this stuff, that I was starting to understand myself btw, and programming suddenly changed for me. If you get the data structures right, the first effect is that the code becomes much simpler…

any concrete examples you can point to?

Try to implement the game Asteroids without a thought about data structures, just start programming it procedurally as it comes to you. See how far you get in, say four hours. Find a graphics library, of course.

Then, use a very simple object oriented model, where everything on-screen (asteroids, ships, enemy ships, shots) has a draw method, a move method, a create method, and an I'm-hit method, together with logical internal state like position and velocity. See how far you get in the same four hours.

Note how much easier it is to do the second way. That's the power of data structures (and, admittedly, some simple oo ideas, deployed in a lightweight way).

Re: Torvalds' quote about good programmers

#83
Maybe this is a dumb quesion , but I don't get how you would write code without thinking about your data structures?

Most of the code I write is manipulating a data structure in some way, I have no idea how I would even know where to begin with at least some idea about which structure I should be using.

Re: Torvalds' quote about good programmers

#84

Maybe this is a dumb quesion , but I don't get how you would write code without thinking about your data structures? Most of the code I write is manipulating a data structure in some way, I have no idea how I would even know where to begin with at least some idea about which structure I should be using.

The data structure you choose will have a profound impact on the code you write, so choose wisely.

Re: Torvalds' quote about good programmers

#85
post #71

This article was posted here a while ago: http://www.dodgycoder.net/2012/07/old-school-developers-achi... It mentions that Ken Thompson "starts his projects by designing the data structures and then works bottom up". Adapting this approach solved several problems I was having during development.

A similar technique that's among my favorites: Write the inner loop first.

Useful in graphics work, perhaps not so much if writing a Web server or database engine.

Re: Torvalds' quote about good programmers

#86
it occurs to me that when you're programming functionally, especially in a functional language, you must think about your data's structure and types first (or fight a whole lot with the language). if linus is correct, could a strength of FP be that it naturally herds its users down the path of the 'good programmer'?

Re: Torvalds' quote about good programmers

#87
post #55
post #34

Earlier quoted context omitted.

Suppose you want to manage the marital status of some people. You could have one data structure, here a table in a database, where you keep (name, status) tuples. This is bad, for many reason: what if someone changes name? If you need to allow undoing, how can you know which was the previous status before "maried" has been entered (widow? Single?) A better data structure here is an event table (who, did what, when),…

You're completely neglecting how the data will be used, by using an rcs like data storage of deltas you penalize the common case of wanting to query the current state efficiently. A better way would be to store a person table without name and a marital status but use it a a primary key into a detail table that has multiple rows for any individual along with dates so you have a row representing the persons state, marr…

What you describe is just a denormalization of my solution. You are already optimizing a proposal that was designed as a very short example of a better data structure. That's absurd. If you need to access often the current marital status you can cache it, store it on the client, use a materialized view, write it in a file along with other info, etc.

I would advice personally against the plain denormalization you propose (if I understood it well), because it means your application logic will have to handle it, and your data structure will not produce a very simple straight forward code that is the appendage of good data structure.

Re: Torvalds' quote about good programmers

#88
post #82

Earlier quoted context omitted.

any concrete examples you can point to?

Try to implement the game Asteroids without a thought about data structures, just start programming it procedurally as it comes to you. See how far you get in, say four hours. Find a graphics library, of course. Then, use a very simple object oriented model, where everything on-screen (asteroids, ships, enemy ships, shots) has a draw method, a move method, a create method, and an I'm-hit method, together with logical…

This is the power of designing before you code. Nothing to do with data structures. Data structures are part of the design but you're focusing on the object oriented design aspect.

Re: Torvalds' quote about good programmers

#89
post #52
post #17

This is approximately the same reason as why I start out writing most of my programs by creating a bunch of types, and why I find dynamic programming languages uncomfortable to use. I'm less and less a fan of the ceremony of object orientation, but I think there's a lot to be said for having a succinct formalized statement of your data structures up front. Once you understand the data structures, the code is usually…

It sounds like you'd really like Haskell. It gives you a far more succinct way to represent your data. Since the overhead of creating a new type is very low, you also become far more likely to express more of your logic in the types. I always start my Haskell projects by laying out the data types. The type declarations are very readable--you can just skim over them to see what's going on. This means that you can get…

This is a very apropos recommendation. I love the way Haskell makes you think like this. Even better I love how you can continue to apply that kind of thinking to programming in any other language.

Re: Torvalds' quote about good programmers

#90

Earlier quoted context omitted.

I've always, only half-snarkily, said that if you have never had to maintain/modify someone else's code then you probably write code like an asshole. Writing code that is both easy to understand and maintain and correct can be difficult, lots of people just go for the latter. Unfortunately as you pointed out, especially in large companies, people can get promoted before the deficiencies of their previous work become…

> Writing code that is both easy to understand and maintain and correct can be difficult, lots of people just go for the latter. They believe they go for the latter, but actually they don't. If their code was easy to understand and correct, it would have fewer defects to begin with. Your second paragraph I totally agree with. I've dealt with such code. Sometimes, I can halve its volume simply by applying local correc…

'correct' is always only about a given specification, that is right for a limited period of time, assuming needs are well understood. It is very well possible to write satisfactory code one day that becomes inadequate the next.

I won't deny the presence of bugs though, there is endless evidence that bugs always exist.

Post reply on HN