Live data from Hacker News

12 (Really) Controversial Programming Opinions

billthelizard.com

51–60 of 61 posts

Re: 12 (Really) Controversial Programming Opinions

#51
post #39

Earlier quoted context omitted.

Hmm, can you give an example of a typical "learning CS" level algorithm that you can't implement in, say, JavaScript?

B-Tree indexes in JavaScript

Googling around, I see a number of implementations. What's wrong with them, and why do you feel this is impossible?

(And hint: it's guaranteed not to be impossible since JS is Turing complete)

Re: 12 (Really) Controversial Programming Opinions

#52

Earlier quoted context omitted.

Hmm, can you give an example of a typical "learning CS" level algorithm that you can't implement in, say, JavaScript?

Not an algorithm, but used in many. Pointers.

Emulating pointers in JS is pretty easy; you just wrap the values in objects or arrays.

Re: 12 (Really) Controversial Programming Opinions

#53

Earlier quoted context omitted.

Knuth's code has bugs. NASA's code has bugs. I don't think our species has produced even one nontrivial correct program, much less a programmer who's competent (which I take to mean a large portion of their work is 100% correct). Our profession is passing through the mercury-and-leeches phase medicine once went through. Someday our descendants will look back from their error monad formal proofs or something and cring…

>I don't think our species has produced even one nontrivial correct program Off the top of my head: seL4, a correct microkernel...pretty nontrivial!

Wow, I'm pleased to see that's no longer totally beyond us, though the price is still very high (LtU says fifty dev-years!)

Re: 12 (Really) Controversial Programming Opinions

#54
post #3

Wow, mostly terrible advice.

Can you elaborate?

I find it odd that I have to, other than 7 and 10, which I'm not saying are necessarily always good advice, the rest are just terrible advice that I think are self evidently terrible advice. Experience has taught me nearly exactly the opposite; the advice strikes me as bad programmers who only know one language generalizing their poor procedural skills across domains they don't understand.

Of course, that's the point of the article, "Really" controversial. Seems most people voted those opinions down as poor advice, which they're correct in doing.

Re: 12 (Really) Controversial Programming Opinions

#55
post #50

Earlier quoted context omitted.

Hmm, can you give an example of a typical "learning CS" level algorithm that you can't implement in, say, JavaScript?

You could probably implement any of them in JavaScript, but it would be sort of silly, because the actual runtime complexity and memory usage aren't really going to be close to what they "should be" due to the interpreter. I haven't given it a lot of thought, but I doubt it makes sense to implement "textbook" algorithms and data structures without pointers.

As I said in another thread, you can get the same functionality as pointers by using arrays or objects, which are always passed around by reference.

You're right that this is an inefficient way to implement those algorithms, but I disagree that that makes it silly. The purpose of writing those algorithms is to learn how they work, not to use them in practice. Generally, if you're using them in practice, you shouldn't be rolling your own in the first place.

Re: 12 (Really) Controversial Programming Opinions

#56
post #42

Earlier quoted context omitted.

Not if you live in the 2012

Originally, the term "high-level" meant that programs were portable between machine architectures. You can do this in C, but in assembly. This is a precise definition. I cannot find a precise definition, which puts C and Javascript on different levels. Has garbage collection? A big standard library?

I think there's a spectrum around how many different ways the machine could choose to execute what you wrote. E.g., V8 creates hidden classes rather than naïvely following the prototype chain, where C pretty much dictates how things are actually laid out in memory.

Re: 12 (Really) Controversial Programming Opinions

#57
post #44

One opinion of mine is "code is also configuration". If you structure the code right, I see nothing wrong with putting stuff that many people see as configuration in the code. I do Java programming, and I think that frameworks like Spring are overrated. There is nothing very different from stitching together dependency injection with XML than with Java code. It is a pattern, not a framework. But the Spring trend is h…

I err on the side of http://en.wikipedia.org/wiki/Rule_of_least_power. While it's true that code is data, arbitrary code is a form of data that's exceptionally hard to analyze or repurpose. Text config rules out stuff like dynamically-composed names of objects and properties (which you can't search-and-replace).

Re: 12 (Really) Controversial Programming Opinions

#58

Earlier quoted context omitted.

I don't. Exceptions in general FORCE a developer to deal with the problem. They can slap a developer in the face if they're abusing the API. Error codes on the other hand can be ignored. PutLionInCage(); PokeLionWithStick(); I'd rather PutLionInCage() throws if there is a problem.

Exceptions in general FORCE a developer to deal with the problem. There are good arguments in favour of exceptions, but I don't think this is one of them. If Java has taught us anything, it is that trying to force someone to handle exceptions just causes a lot of code that says: catch (Exception e) { // silently ignore e }

Sure you can do that but the programmer is FORCED to make the choice to write that. Also the code _looks_ wrong like that.

Furthermore if the dev just wraps the entire process in that silent catch then the lion doesn't get poked!

Re: 12 (Really) Controversial Programming Opinions

#59
post #33
post #16

guys, >The first language should NOT be the easy one, it should be >one that sets up the student's mind and prepare it for >serious computer science. >C is perfect for that, it forces students to think about >memory and all the low level stuff, as one low-level programmer to another, I hate to break it to you, but "low level programming" is not "serious computer science". the two have very little to do with each othe…

That's pretty true. However, in C, you can actually write interesting data structures and algorithms that come up in computer science. I think that makes for good "theory meets practice"-based learning. I'm not saying all algorithms classes should incorporate writing C code all the time. But probably every budding computer scientist or software engineer should take at least one such class. I'm also not saying C is th…

I like this quote from Knuth: "People who are more than casually interested in computers should have at least some idea of what the underlying hardware is like. Otherwise the programs they write will be pretty weird."

C is only marginally closer to the hardware than other languages, and programmers really should be aware of even lower level concepts, but I think learning C is a hugely useful and relatively digestible step towards really understanding what's going on.

Re: 12 (Really) Controversial Programming Opinions

#60

Earlier quoted context omitted.

>I don't think our species has produced even one nontrivial correct program Off the top of my head: seL4, a correct microkernel...pretty nontrivial!

Wow, I'm pleased to see that's no longer totally beyond us, though the price is still very high (LtU says fifty dev-years!)

It was actually about 28 py, but that number would come down to 10 if they were to do it again.

source: http://ertos.nicta.com.au/research/l4.verified/numbers.pml

Post reply on HN