|
I use Allman for C# but for Javascript(mostly Typescript) is make use of K&R.
I do this because it's the generally accepted style for both languages and I am used to swapping between them.
It's also because working as part of a small team within a larger group(a team of 5 developers within a group of 20+ developers) it's easier to follow the generally accepted standards, or rather code doesn't get past code review if it doesn't follow those standards.
At home I do the same, using Allman for C# and K&R for Typescript or any other form of Javascript - it just kind of 'feels' right.
“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens
|
|
|
|
|
I try to do the same, but am working on a Java project that's using alman because the lead dev's brain locks up trying to do any other styles. He wanted to do C# capitalization rules too, but eventually yielded on that part because Android Studio's autocomplete is strictly case sensitive, and having to try and remember different casing styles for our code vs android code was blowing up everyone else's brains.
Did you ever see history portrayed as an old man with a wise brow and pulseless heart, weighing all things in the balance of reason?
Is not rather the genius of history like an eternal, imploring maiden, full of fire, with a burning heart and flaming soul, humanly warm and humanly beautiful?
--Zachris Topelius
Training a telescope on one’s own belly button will only reveal lint. You like that? You go right on staring at it. I prefer looking at galaxies.
-- Sarah Hoyt
|
|
|
|
|
I prefer Ratliff style, but can see why you would like Allman if your eyesight was failing.
|
|
|
|
|
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.
|
|
|
|