The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.
for (int x = 0; x < 5; x++)
if (x == 0)
; // do something
else if (x == 1)
; // do something
else if (x == 2)
; // do something
else if (x == 3)
; // do something
else if (x == 4)
; // do something
I went home early because it scared me.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
Who says this guy (or girl) doesn't have a Bachelor's (or Master's) degree in programming?
It wouldn't be the first time I see a "licensed" programmer producing code like that
I once worked with someone who was certified and expensive and wrote a separate service that was so bad it negated future development.
Like literally, we added some fields to the database, filled them with data, and half an hour later that service would set the fields to NULL again.
Took me a while to find that one
You can imagine that wasn't the only WTF in that code base...
Then there's this guy who was equally certified, full of himself, called me "a little man", and then made an unsolicited code change that broke production
The reason he made the change is because I had wrote a function containing something like 30 lines of code (including white lines and curly braces), which he thought was bad practice.
After he "refactored" it he took out the "usings" because ".NET handles that for you".
He also somehow added an additional database call and discarded the results, which actually broke it.
And then we had the fourth year application developer intern who literally couldn't declare a variable because "he forgot the syntax".
Needless to say we failed him, but somehow he passed his next internship and a year after he couldn't declare a variable he was applying for a job at some big company
Don't speak to me about "professional licensing", people are bunglers and no amount of licensing can fix that
You speak the truth. University degrees, licensing and certifications don't guarantee competence. I think that any of us including all of the people in this post would be surprised at what another programmer would find to criticize and complain about in his or her code.
Also, anyone that would get in a self-driving vehicle deserves to run into a tree, in my opinion.
Hard work and common sense will overcome in every situation, every time.
My code is C# style, the other isn't. It's some sort of Java(Script)ish with some extra space.
But it's still (more or less) the same code.
I'd probably tell this person something about C# coding styles and I'd enforce some default coding style (at least to normalize the casing).
When a team uses different coding styles it tends to mess up your source control (because of automatic styling, which makes it look like everyone is changing complete files even when just a single line was fixed), so it's still important, but not necessarily wrong.
Then there's this:
// My codetry
using (var connection = new SqlConnection(connString))
using (var command = connection.CreateCommand())
command.CommandText = "...WHERE Id = @Id";
catch (Exception ex)
// Someone else's codetry
var connection = new SqlConnection(connString);
var command = connection.CreateCommand();
command.CommandText = "...WHERE Id = " + id;
catch (Exception ex)
Now we're talking about different code, good code and BAD code!
Some people would say usage of var is bad practice, but that's what I consider style (after all, compiled it's still the same).
However, every skilled programmer would notice the lack of using (or alternatively Dispose in a finally block), the swallowing of the Exception and the potential SQL injection.
This isn't a matter of style, it's a matter of factually good and bad code.
So when we're talking about people here I expect to find lots of different preferences which may not be mine (and which I might even find horrible to read), but I expect to find little actual errors.
For some reason I tend to think that people who are on CodeProject know the difference between good code and bad code, whatever their style may be
I don't usually join in these discussions, nor am I claiming that this is the best way to accomplish the task.
However, I see more of a problem with the compiler -- these are not really nested blocks. They are "else if" statements and not really different from a case statement in a switch except that you are using an expression instead of a constant. When I write them, the formatting shows that. Every "else if" is at the same level and there is no nesting.
In C (and C++) you have "#elif", but for some godforsaken reason, you don't have "elif" in the language. This is a missing control structure and why the hell is there any kind of a fixed limit on parsing the language? I seriously doubt that, once parsed, that the control flow graph has any sort of limit, but limits like these are from 30 or 40 years ago. Inexcusable in today's world.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpful answers is nice, but saying thanks can be even nicer.
I've found in my experience, which admittedly is mostly Big Aerospace, that there is a huge bias among management towards reuse rather than refactoring. They get all wet over the concept of earned value and avoid thinking about the real costs down the road. It comes out of a different funding bucket, after all.
I've also seen it in smaller ventures. It's way too enticing to reuse because there is the comforting, often misguided notion that what was used elsewhere will fit like a glove in the new application. Maybe it will, maybe it won't but "all you have to do is ...", therefore saving you all of those development costs.
And let's face it, if we're honest, we have all done something similar because of some perfect storm of converging priorities, events and time. Because we're going to circle back around and fix it; yeah, right after the whatever.
I once worked for a guy who was hired as CEO of a smallish (600 employees) company. He advertised that he had PHD's in Computer Science and Economics from Brown University.
In almost every meeting where he wanted something developed, he would say: "Well, isn't it just a simple sort?" After about three weeks of hearing his blather, I called Brown University to verify his credentials--turned out he had a bachelor's degree in Liberal Arts.
He lasted a year, of which the last six months, he was out on personal time. I suspect the owner of the company also suspected this guy had over-stated his credentials.
I think part of the problem is the perception that a college degree is often taken as a de-facto "license to practice" software. Also, from your experience this person was able to get that job because we tend to operate on the honor system with regard to one another's credentials. Now if this person did a passable job as a software manager no one would have questioned or ever been the wiser regarding his exaggeration (alright, outright lie), though I would like to think that kind of ethic would show itself in other ways.
I am not putting down higher education. On the contrary, I think it must be considered in all of its forms, university being only one. After all, much of what we have encountered after school has little to do with our respective majors and more to do with our own personal habits, ethics, and especially other experiences.
What if the aforementioned "manager" had not ever graduated college, never claimed such, and nonetheless would have made a fine manager? I think that's worth considering but I'm not sure our industry is completely on-board with that yet.
If a professional licensing program for software could determine a person's competence much the way (I believe) professional engineer licensing does, I'm all for it. However, I may be assuming too much about the PE credential.
From my experience, people tend to weight experience indifferently. 40 years of experience is 40 years of experience, period. Whether someone learned anything new during those 40 years doesn't matter in the slightest.
To type a euro sign, €, you need to press ctrl + alt + 5 (at least on US-international keyboards).
The physical 5 key even has a € on it (next to the 5, with the % above it, like this[^]).
This works pretty much everywhere, except in Outlook and other Office products where I need it the most.
I usually open a browser, notepad(++), or even Visual Studio (if it's already open) and copy/paste the € from there.
There was a time where I memorized the alt + 0128 to type a € because it wasn't otherwise available (and that always worked).
Today I learned that to type a € in Office you need to use ctrl + alt + e.
In here that gives me an é.
I also learned quantum physics, but that pales in comparison to the knowledge in the forbidden scrolls of the €
that pales in comparison to the knowledge in the forbidden scrolls of the €
You are almost ready my young apprentice! In time You shall be the Master!
Anything that is unrelated to elephants is irrelephant Anonymous - The problem with quotes on the internet is that you can never tell if they're genuine Winston Churchill, 1944 - Never argue with a fool. Onlookers may not be able to tell the difference. Mark Twain