12 (Really) Controversial Programming Opinions
billthelizard.com
billthelizard.com
The first one, for example, is obviously a joke.
>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 other.
C exists in the middle territory between high (colloquially right now) and "original" low-level programming.
By all accounts, virtually any language that operates relatively close to the semantics of the machine in terms of operations and memory (pointers are a standard abstraction in assembler) is a low-level language.
The only things that detract from C's low-level credentials are that it is more of a hybrid attempt at grafting a harvard machine onto von neumann machines and its functions. The functions/stack are a bit of an abstraction depending on which architecture you're using.
Calling C high level isn't accurate or descriptive, but I'd be willing to concede that it's not truly low-level either if you know enough C to explain why.
You don't, though.
Interesting, though I'm not sure how my knowledge of C is relevant to the conversation.
o
o o
Connect the dots.I cannot find a precise definition, which puts C and Javascript on different levels. Has garbage collection? A big standard library?
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 the only language for which this is true. But it's definitely not generally true for interpreted languages.
Also, C is pretty much the language everything higher-level is implemented in. So once again, at least some exposure to C can help someone conceptualize what's happening on the computer at every level.
(And hint: it's guaranteed not to be impossible since JS is Turing complete)
I haven't given it a lot of thought, but I doubt it makes sense to implement "textbook" algorithms and data structures without pointers.
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.
however you can explore what computer science has to offer without subjecting yourself to C. I think that "computer science" has more to do with "optimizing algorithms for efficiency" and less to do with "staring at stack traces and wondering why gdb is so bad"
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.
6. The use of try/catch exception handling is worse than the use of simple return codes and associated common messaging structures to ferry useful error messages.
I think this really depends on the language. In erlang I absolutely hate exceptions because they don't really make sense in a functional language (which let's say erlang is for the sake of this argument). Threads run functions with only the function's parameters as state. It doesn't make sense to have to worry about a function stopping half way through, especially when most functions already pass up tuples looking like {error,E} or {success,S}. If you have to worry about exceptions as well, now you have to handle the error tuple and the exception case, and usually both cases are getting the same code so you have to go make a new function to call for that case. This gets messy. If a thread crashes it crashes, otherwise it should be passing up the error tuple; there's no reason for exceptions.
On the other hand I think exceptions make a lot of sense in python, and I think the python community has incorporated them in a standard way which makes sense, so that handling exceptions in python is actually easier then passing back different error codes and what-not (no atoms in python).
I do somewhat agree with the OOP criticism as well. I find the best programming achievable is by mixing strategies and not adhering strictly to any one philosophy. Java's OOP is so inflexible and limiting that it takes a significant amount more effort to get basic work done. It may lead to a somewhat more manageable codebase at first, but I feel experience in your language of choice can bridge the gap between such a strict static-typed language vs a more elegant but potentially messier dynamic-typed language in this respect.
Finally I do agree that C should be taught before you learn any other programming language...but not to such a degree that you need to be able to build the best Javascript engine in the world from scratch before you move onto another programming language. The goal of programming is to build software that saves you time, after all - you aren't saving much time with as high a barrier to entry as mastering the fundamentals of C. It is important for theory discussion as well as learning the best way to code a lot of logic in many other languages, but I feel an abstracted language has failed if it hasn't done enough of the work for you to refactor your code properly in the first place. Loop unrolling, seriously? I like that I learned why it's important...but I shouldn't ever have to do that in any decently programmed higher level language.
Error codes on the other hand can be ignored.
PutLionInCage();
PokeLionWithStick();
I'd rather PutLionInCage() throws if there is a problem.
If you write a library are you thinking that everyone is going to use it properly?
My point is that exceptions help people to learn how to use APIs (its kinda like documentation that appears through use!) and exceptions make things _safer_.
I appreciate you could write the above in two try catches but my point is that it would look more wrong. The code above _looks_ fine and that's my point.
I totally agree that exceptions are far superior than checking return values.
If you rely solely on return codes to indicate an invalid state and the caller is free to ignore the error codes, it makes it much easier for the program to continue on doing invalid things - this is akin to wrapping everything with try/catch blocks and suppressing exceptions. Even more, when you do realize something is wrong, a system utilizing exceptions is generally much better at propagating information about the original 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
}// This should never happen.
(Until it does)
I have mixed feelings about checked exceptions. They seem like a great idea in theory - if there are known error states, then making them explicitly known and forcing the consumer to acknowledge them in some way seems reasonable. In practice, a lot of the time the only response to a checked exception is "let it propagate up - there isn't anything useful I can do", which leads to extra code and can be annoying.
Even though I don't have quite the negative feelings toward them others do, if I were involved in designing a new language today, I'd probably vote against including them. It would possibly be nice if a method could explicitly declare which exceptions it was likely to throw, and then an IDE or static analysis tool could use those to aid consumers of the API, without forcing them to deal with every single one.
Interestingly enough, I view Scala's Option construct as being somewhat similar - forcing the consumer to acknowledge that a particular call could return a null value - but it doesn't seem to provoke the same negative visceral reactions that checked exceptions do.
Furthermore if the dev just wraps the entire process in that silent catch then the lion doesn't get poked!
vi vs emacs
OO vs fpEveryone working with Python a little while won't even think about indentation anymore, it just comes natural. It's not a big deal.
Python is often made out in discussions like that to be for begginners only and only amateurs would use it because its slow, not concurrent etc... The truth though is that YouTube, Reddit, Dropbox, Spotify, Discuss, Google, Nasa and many other "real" professionals use Python in a big way.
I tend to ignore such trolls.
Note: If a programmer only writes programs for her own use, "competency", as defined above, is all but irrelevent. Whatever works.
Controversial, but true.
They don't want to admit their mistakes or that someone else might understand things they don't. They actually think they are being smart when they are really being stupid.
Certainly not looking for "votes" with this one. Although I did get an upvote immediately, then a downvote from, who would have guessed, a closed source developer.
I'm not a fan of StackOverflow. There is a lot of stupidity and herd mentality there. It's not where I would look for "competent programmers". Like finding a needle in a haystack.
Finding bugs in Knuth's or NASA's code might be beyond "a reasonably skilled hacker". To find bugs in that code you would likely have to be "highly skilled", above average.
Everyone makes mistakes. Even professionals who are licensed. The idea is to minimise them to achieve a reasonable, expected level of "correctness". Competent does not mean "perfect". It means no stupid mistakes.
In my biased opinion, there's a high tolerance for stupid mistakes in software.
Off the top of my head: seL4, a correct microkernel...pretty nontrivial!
source: http://ertos.nicta.com.au/research/l4.verified/numbers.pml
IMHO, these guys are heros merely for undertaking the task, let alone completing it.
Very, very few non-trivial pieces of code are completely bug-free, and building anything interesting under normal time constraints is really difficult and expensive to prove 100% correct.
So, I guess that point is true, but ultimately not very useful.
The same is true about most software people write--it is also cheap and disposable. Often, having something that works well enough now is better than having something that works well tomorrow. I'm not even talking about being impervious to skilled hackers; even breaking under normal use is not necessarily bad.
Sure, if your software would kill people or destroy things, you have an issue. If your software is very critical and usually above suspicion (like a compiler, say) this would also be a problem. But if you're just writing a web app to share cat pictures or some internal tools or really most any other type of software? It's most often better to be cheap and fragile than good and solid.
My laptop is probably my single most important possession. (Yeah, I'm a student so I don't really have much else :P.) Do I have a Tough Book which is nigh unbreakable? Nope. I have a laptop which is actually fairly easy to mess up. And it is in every practical sense the better choice.
This is, coincidentally, why I think the cynical view of "planned obsolescence" is somewhat shortsighted. Sure, in a sense it's bad that electronic gadgets fall apart after a couple of years. But there's no cynical force behind all this: the simple fact that you wouldn't pay twice as much for a phone which is only more sturdy--but not more capable--is what drives the markets. If you were really worried about it, you would have bought a purpose-built device that would hold up better; instead you bought something cheaper which will break sooner. And this is a perfectly reasonable compromise to make!
I take the opposite view. I like durable software. And that's how I build my systems. If they get trashed, they can be restored in minutes. I'd rather spend my effort preparing simple durable systems that can be restored easily than building complex, fragile systems that would be difficult to reconstruct if something goes wrong. I've heard that sometimes things can go wrong.
I usually end up explaining them like a repeat...until, which usually makes more sense to non-programmers.
For example, anyone who advocates writing only extremely short functions because they leave less room for bugs appears to be wrong in about the same way that someone who thinks that 2+2=5 or that a chainsaw is a good implement for brain surgery is wrong.
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.