Live data from Hacker News

Hopefully more controversial programming opinions

prog21.dadgum.com

101–103 of 103 posts

Re: Hopefully more controversial programming opinions

#101

Earlier quoted context omitted.

1) This error looks like it can't be recovered from. Just throw UnrecoverableError("Config file not found"), and you're done. The code is just as readable. Now if you also need to easily catch it, you need better pattern matching than Java and C++ can give you (Ocaml works well). Again, the code will readily display the relevant string. With C++ and Java, okay, drop the string. But try to limit the scope of your exce…

Regarding 1)... Yes, in this particular case you could just throw an UnrecoverableError (or whatever) and pass a string with a message of what went wrong to its constructor. But that wasn't my point at all. I wasn't trying to make a point about how to structure code or deal with errors/exceptions, I was trying to make a point about naming conventions. My example could just as easily have been something like: "PtgSL.…

The long name, of course.

Now whatever you do, long names should be reserved to infrequently used things. If a long name litters your program, you'd better use a shorter one. Conversely, short names belong to frequently used things. This is because a long name is a cognitive burden. On the other hand, one needs to learn what is behind each label, and don't want to forget it.

Fortunately, good long names (such as "PatagonianSeaLion") tend to be about very specific things. So specific that you rarely need them. But there can be bad long names, like "System_Out_Println". Something this pervasive should never have such a long name.

Re: Hopefully more controversial programming opinions

#102
post #99
post #88

Earlier quoted context omitted.

Yes, the 'minor scaffolding' has side effects. That's why I said it wasn't controversial.

The side effects in the scaffolding are purely an implementation detail. For non-interactive use (like a compiler) you could implement the program as a function taking and returning a string.

How would I invoke a compiler that isn't interactive? The act of invoking it is the interactivity.

Re: Hopefully more controversial programming opinions

#103
post #54
post #40

Earlier quoted context omitted.

To make something fast or to make something scale you don't need a proof. You need a profiler.

A profiler is for micro optimisations. A profiler won't let you go from bubble to quick sort for example.

You are operating under the assumption that the performance of an average piece of software is algorithmically limited, this is almost never the case. In average software the core performance characteristics are typically bound by far simpler issues, such as excessive database queries.

A profiler is not good at speed up an algorithm, but a profiler is THE tool you need to speed up a system, and most optimization in the wild is system optimization, not algorithm optimization.

This particular example is a perfect case study in how excessive focus on computer science can lead you astray in software engineering.

Post reply on HN