|
I always used such a style. Now, I know it has a father.
|
|
|
|
|
I always thought of the Allman style as "readable" style as opposed to "space-saving publishing" style. Matching braces always allowed me quicker reading of where blocks began and ended. I never knew Allman existed as I programmed Macs and other PCs.
|
|
|
|
|
I'm unaware that I suffer from any.
But, related to "negative integers", one misconception which I have seen at least one person state is the idea that signed integers (twos complement) are lower level (more native to the hardware) than unsigned integers -- that the CPU has to work harder to perform unsigned math. I'm pretty sure that I saw someone state that you should avoid using unsigned integers because they're slower!
|
|
|
|
|
Yes, I don't think that applies for most CPUs however, it is fairly well known that in programming GPUs with CUDA it is much better to use signed integers than unsigned because the overflow handling is much faster. Nvidia's GPU cores are known for having many odd limitations.
"They have a consciousness, they have a life, they have a soul! Damn you! Let the rabbits wear glasses! Save our brothers! Can I get an amen?"
|
|
|
|
|
1. That OO is a good idea.
2. That exceptions are a good way to handle errors.
|
|
|
|
|
|
That other programmers knew what they were doing
|
|
|
|
|
|
That async execution does not mean it's parallel/threaded and it has varied behavior depending on the runtime.
To alcohol! The cause of, and solution to, all of life's problems - Homer Simpson
Our heads are round so our thoughts can change direction - Francis Picabia
|
|
|
|
|
The longest programming misconception I've ever held is that JavaScript (ECMAScript) is "bad". It took me a long time to see JavaScript as (just another "assembly language") but I've finally made "peace" with JavaScript. I think...
|
|
|
|
|
This is how twos complement works. There are a lot of older architectures that use this.
|
|
|
|
|
That foreach loops in PHP scope and clean up their memory references. Spoiler, they do not! I fixed quite a few long outstanding bugs with unset() calls when I figured this out. I know its in the documentation but I bet quite a few of us don't RTFM on the looping structures.
|
|
|
|
|
For 30 years, I have thought readability was the "truth". Then I bought a book called "Clean Code" by Robert C. Martin and found clean code was this convoluted set of rules of hard to read code that made no sense. I am now aware that "readability" means "machine readability".
|
|
|
|
|
For clarity, are you saying that the rules in 'Clean Code' are convoluted and make no sense, or that your earlier definition of 'clean code (readability?)' was nonsensical?
|
|
|
|
|
I was implying that "Clean Code" rules were convoluted, but after reading it, I was clearly questioning my own rules as well. The confusion was deliberate!
|
|
|
|
|
That Visual C++ could be written to be understandable and comprehensible. But, then again...
|
|
|
|
|
That functional programming might be useful for anything. At first it seemed to me that, due to its recursive nature, it might be good for writing compilers. This was a misconception I held for nearly two minutes, which, as any GPU will tell you, is an eternity!
|
|
|
|
|
Functional programming has fascinated me! But not enough to ever write a single line of code. Every time I come across one of those sites saying FP is going to solve all the problems that exist in programming I read it with curiosity. But I've never seen a single site that delves into the guts of what it would take to do a significant program, such as a word processor. Everything I've read indicates (between the lines) that when tackling such a problem FP would actually get in the way of accomplishing the goal. With their newer tree structure use it may be possible, but it still seems like a complete pain, and a memory-intensive hog. If anyone ever comes across a 'create a word processor with FP' site let me know!
|
|
|
|
|
Yeah. I actually tried it to see what it would be like... the answer is that it's effectively a thought experiment - nothing much more than that. With something like F#, you can also pretty much break the rules and start writing C# with different syntax, and in effect, that's what you end up doing: the functional thing ends up becoming nothing much more than a more cumbersome way to declare fairly standard methods. I don't think it could ever be used to write actual systems - such as your word processor, and every time I've tried to get someone who evangelizes this stuff to explain how it would be done, they just get angry. So I win!
|
|
|
|
|
Thanks for sharing your experience. For a while I was confused, because I heard that full systems were made in lisp, which my reading made me think was functional. A few months ago I actually dug deeper into that and found that lisp isn't an 'only-functional' language, and my 'A-Ha!' light turned on! So I'm still waiting for someone to show me my word processor example!
If I'm not mistaken, another disadvantage of doing one fully functional is there is no way to really organize and see the code as you can with OO. Functions everywhere! But maybe I don't understand it enough. It just seems like a pain in the ass.
|
|
|
|
|
I had no idea C actually has (or had, haven't updated since ANSI C) a goto statement in it.
(not that it's in anyway sane to use)
|
|
|
|
|
I agree. For many years I assumed that C, C++ and C# had no GOTO - then I saw it in some example code somewhere and was shocked!
I still didn't use it myself - I've never had the need for it - I was just surprised it existed.
- I would love to change the world, but they won’t give me the source code.
|
|
|
|
|
C# too?
|
|
|
|
|
Yes, apparently.
- I would love to change the world, but they won’t give me the source code.
|
|
|
|
|
Not strictly programming, but regarding HTTPS protocol. For a long while I was convinced that sending sensitive data in the query string of an HTTPS request was insecure, because I believed the URL (including the querystring) was un-encrypted. At the time I was working with a financial services company with many third parties sending data around in pseudo-webservices. I refused to deal with 3rd parties that insisted on passing data in the querystring, and insisted on POSTing it instead. It took a while (many months) before I realised that when using HTTPS protocols, the client and host negotiate first and the actual URL (with querystring) is only sent once keys are exchanged and can therefore be encrypted over the wire. It just seems counter-intuitive that a string I can type into the browser address bar, or into Fiddler, or set as a string for a WebRequest address, would actually get encrypted before sending.
Nobody ever actually called me out over it though, and a few companies changed their interfaces as a result.
|
|
|
|