Live data from Hacker News

Torvalds' quote about good programmers

programmers.stackexchange.com

31–40 of 108 posts

Re: Torvalds' quote about good programmers

#32
post #12

You can normally fix bad code - fixing bad data structures is not usually easy or even possible. It's why I've still not fully bought in to 'release early release often'. I prefer to defer releasing for production use until really satisfied with the structures - this way you have no barrier to ripping the foundations up. If not 100% comfortable with the model - prototype a bare metal improved one (schemaless DBs ftw)…

I'm in the position of maintaining a legacy codebase. I feel like I've shown up half-way through a game of Jenga and management still wants me to play the game with the same speed as the guy who played the 1st half. Meanwhile, he's been promoted to start work on a brand-new Jenga tower since he's demonstrated such remarkable success in the past. I just want everyone to stop playing Jenga.

If only there was a way to measure programmers on the robustness and potential of their code, and not just on "they wrote a lot of it."

The system seems to be that it is much more advantageous to your career to rapidly produce gobs of spaghetti -- and confound everyone around you -- than to build elegant code that enables everyone around you. You look better when everyone but you is confounded; you look replaceable when everyone around you can extract as much value out of your clean, powerful code as you can.

Re: Torvalds' quote about good programmers

#34
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?

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), then not only you know the marital status but you know where it comes from, and can build much more on this data.

Re: Torvalds' quote about good programmers

#35
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…

"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."

Classes. There are your types. Python has them. Ruby has them. Javascript has them. . . .

Re: Torvalds' quote about good programmers

#37
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…

Data structures != Types

Dynamic languages are not an argument to make bad use of data structures in any way, it changes nothing.

Re: Torvalds' quote about good programmers

#38
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…

Data structures != Types Dynamic languages are not an argument to make bad use of data structures in any way, it changes nothing.

I think you missed my point. I wasn't arguing against bad use of data structures; just for a formalized, checked description of the data structures used in the program.

I have in the past written preprocessors for this purpose. A simple language just to describe the types used in the program, with the output being the implementation language's definition of the type, as necessary. I've even done it in Javascript, in a very roundabout way - was JScript.net, producing XML, which was consumed at runtime to create classes dynamically, which in turn were used by a dynamic programming language.

I'll go a long way to get a simple up-front map of the program's data in a checked format.

Re: Torvalds' quote about good programmers

#39
This is Normalization rearing its head. A properly normalized database can be extended without needing refactoring and does not have modification anomalies. There is a formal process to normalization. There is no such equivalent in code, but a poorly normalized data model virtually guarantees that any code wrapped around it will be messy. Conversely, mediocre code wrapped around a clean data model (less common in the wild) is much more amenable to incremental improvement.

Re: Torvalds' quote about good programmers

#40
post #35
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…

"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." Classes. There are your types. Python has them. Ruby has them. Javascript has them. . . .

If you can't see see the qualitative difference between algebraic data types and Javascript classes, there's no point discussing things.
Post reply on HN