Live data from Hacker News

12 (Really) Controversial Programming Opinions

billthelizard.com

21–30 of 61 posts

Re: 12 (Really) Controversial Programming Opinions

#21

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.

If you need an exception here, you're just a bad programmer. It's your fault you didn't explicitly check that the lock was functional before poking that lion! /s

Sure but are you telling me you always work on teams where everyone is shit hot?

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.

Re: 12 (Really) Controversial Programming Opinions

#22

I do sort of agree with the try/catch criticism. I know what it achieves and why we need it but I don't agree that it's the best or even most intuitive error handling mechanism. I personally prefer returning error messages in place of or alongside expected data structure outputs, such as the common paradigm in JavaScript where async functions return error info (or null) as the first parameter in the supplied callback…

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.

They don't necessarily force the developer to deal with the problem, unless you're talking about checked exceptions (which are a whole other controversial programming opinion). What they do accomplish, in my opinion, is more deterministic behavior and easier debugging.

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.

Re: 12 (Really) Controversial Programming Opinions

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

Ironically C is technically a high level language anyways.

Re: 12 (Really) Controversial Programming Opinions

#24

Earlier quoted context omitted.

If you need an exception here, you're just a bad programmer. It's your fault you didn't explicitly check that the lock was functional before poking that lion! /s

Sure but are you telling me you always work on teams where everyone is shit hot? 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…

Hah, I guess my post could have used a sarcasm tag :)

I totally agree that exceptions are far superior than checking return values.

Re: 12 (Really) Controversial Programming Opinions

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

Ironically C is technically a high level language anyways.

'ish.

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.

Re: 12 (Really) Controversial Programming Opinions

#27
post #14

Mostly opinions of an angry C programmer. Disagree with all of them. Too context specific. For example, testing. It is generally a good idea, but you don't always want to invest the time if it will have a negative return. Small projects or throw away work are two conditions where this would be true.

These are NOT his opinions but the opinion of several different people who answered the original StackOverflow question.

The first one, for example, is obviously a joke.

Re: 12 (Really) Controversial Programming Opinions

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

Ironically C is technically a high level language anyways.

Not if you live in the 2012

Re: 12 (Really) Controversial Programming Opinions

#29
post #9

There can only be controversy when either the truth isn't clear, or it doesn't matter. If we knew the answer, and it mattered, everyone would do it that way (and those who didn't would lose to those who did). e.g. religious wars: vi vs emacs OO vs fp

I don't agree at all. I don't think Galileo would agree, either.

Re: 12 (Really) Controversial Programming Opinions

#30
Really surprised at the amount of hate for Python significant indentation. I've only used Python a little, and I expected to hate that too, but found it wasn't really so bad. I thought my experience was pretty common, and that by now most people either thought it was a great idea or at least found it tolerable. But "it was a bad idea" is currently favored 43 to 5. Maybe not many Pythonistas have seen this page yet.
Post reply on HN