- Feature Articles
-
CodeSOD
- Most Recent Articles
- Crossly Joined
- My Identification
- Mr Number
- intint
- Empty Reasoning
- Zero Competence
- One Month
- A Little Extra Padding
-
Error'd
- Most Recent Articles
- Not Impossible
- Monkeys
- Killing Time
- Hypersensitive
- Infallabella
- Doubled Daniel
- It Figures
- Three Little Nyms
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
Why does this only happen in software? Why, for example, is the auto industry not plagued with self-taught inventors who can't be bothered to understand the combustion cycle, so they produce car designs with coal-fired engines?
Admin
it isn't the industry that fails to comply with the standard... it is your imagination that fails to comply with the concept. Think about it... how many recalls happen each decade by some auto manufacturer that made a defective seatbealt... or the power stearing pump was not rated for specific weather conditions? it is the same thing in every industry. 95% of people are there for the paycheck. 4% are there because they love their jobs... and want to be the best at it... and what is between... well... who knows?
Admin
Sarcasm aside - Oh I wish ! I wish to let it out, to burst into a rant over the code that's being written at my company - but there's one thing holding me. That's the Non Disclosure Agreement. And a few of the clauses in my contract, which explicitly prohibit me from bad mouthing the company or discrediting it.
One day - I'll do it.
The code is just so bad, it has to be exposed. It's a classic. Has everything - string arithmetic; procedural design in an OOP language; God class; lots of static classes with static methods and (lo and behold) public static fields; error handling by hiding - yes, it's the most blatant feature - exceptions are just swallowed (granted - not everyone); unchecked, unaccounted for global variables (you may think, hey - it's C#; don't matter, make singleton variables and mark them static); event handlers driven design, as substitute for polymorphism (of course, if you only have one class, you need handlers); dead code; commented blocks of junk which lay there for no reason; SQL database "layer" where you have to plug in parameters by index, longest sequence attaining 33 params (how the HELL could possibly a human keep track of that ?!)
-- A freaking jungle layed out with mines. God, I love to hate it...
Admin
I sort of agree with you on this point. Having worked with a wide variety of people I've grown to be more understanding, but there is a limit.
The most important thing to consider with a programmer is that they'll be solving logic and math every time they go to work on a piece of code. Anyone that's put in the effort to learn the language well enough to write clumsy code is likely willing to learn more advanced concepts that'll turn them from a poor coder to a good coder.
The one point in your post that's most important is the why. All too often we see things posted on code websites with little or no explanation on why it works or how it works. That's the most important thing to know, otherwise we just breed more copy-paste coders.
However if someone is truly not intelligent enough to write decent code after a being given a fair chance to do so. Then their in the wrong field and will only endanger other people if their allowed to continue on as programmers. We have no way of knowing just how important our programs will be, for all we know the stuff could wind up being a core tool in a financial empire. We're in a position to do so much damage if our work screws up, that makes it our number one priority to ensure we remove as many fail clauses as possible.
Admin
Maybe because in all other industries they go through some formal qualification with a recognised professional body, in your case engineering.
With software there is no real formal qualification and people are usually hired because they have the right buzzwords on their CV/resume, where longevity in a firm is seen as a plus (albeit they may have got set in their incorrect ways seeing only one way of doing something) often stuck in a system that has moved on. So even if this wasn't written a long time ago here, the person may have brought this in from the way they did this in their previous company.
Admin
Having to put it into a class is a WTF'ery of the language because classes are not extendable. In C++ you would make these free functions and probably put them in a namespace. You can then write more functions as you need them and put them into the same namespace but in a different file. True that if they all build into one common shared object library you need to rebuild that library for those who want to use the new functions but it is still adding rather than editing. (If your build makefile uses a wildcard you don't need to modify that either). Whatever, having them in one file is a WTF of the language.
This is because they insisted that it had to be "pure OO" and thus everything attached to an object. Purism over practicality.
Probably far too late to change the names now, my guess is that they are already all over the code.
Admin
I object to being called a Code Monke..... oooh, a digital banana, yum.
Admin
So in such a true OO-language a namespace is an object, too, and there is no difference between putting the function in a namespace vs. adding a method to a class.
The rule that a class must be defined completely in one file is specific to Java, other OO-languages are more permissive and a real Smalltalk is image-based, not file-based. If your "they" means the inventors of the Java language then i won't object, but this claim of impracticality is not true for all OO-languages. There's nothing wrong if it is a composition of two other functions, one for stripping whitespace and one for converting null to empty string.This allows for all of these features to be used separately when needed. And this is exactly what's wrong with this code: Too much features lumped together in a single method, and when some of the features are needed again, they are "re-used" by Copy-and-Paste-programming.
That's exactly what's refactoring is for, and refactoring works like a charm in Java and C# (it's much harder but still more-or-less works in dynamically-typed languages).But even when refactoring is not available: rename the function, and add a function with the old name to call your new function and mark the function with the old name as deprecated.
If something is ill-named and you have to keep it for compatibility-reasons at least show a warning (e.g. by marking it as deprecated).
Admin
Getting to the obvious point here... c++ is c++ and .NET is .NET. If every language conducted things the same way, then there would be only 1 development environment.
Yes... template functions are definately handy... but for those of us who don't use c++ every day, generic classes and methods are more consistent with our own daily workflow.
Regex DOES belong in business code... for validation purposes most especially. I disagree with using it for data type conversions, but that is possibly more preference than anything.
Admin
Admin
Sir, me wrote Parse, then come along Nagash's friend changed it to TryParse. Nagash's friend was proud of himself saving an exception on error resume next. Tmr it ain't laughing matter when you look at it from VS2020 the whole thing WTF!?! Me happy to receive support call my customer always happy
Admin
Admin
public static bool isNumeric(string value) { bool isNum = true; for (int i = 0; i < value.Length; i++) { if (!"1234567890".Contains(value.Substring(i, 1))) { isNum = false; } } return isNum; }
Somebody might have already picked this up, but this method will only return false if the LAST char in value is not a digit. I can understand doing it this way instead of, say, trying to parse it and handling the exception, because throwing and catching an exception is relative expensive.
2c
Admin
I might excuse your post if you lack complete knowledge of C# in specific...and 'good programming patterns' in general.
This post was one of the best WTFs recently.
Anyone that doesn't think so should think long and hard as to why they don't get it.
Admin
Above post was in regards to:
Reply didn't inject any quote.
Admin
This sounds so similar to a couple of the places I've worked. I've seen my share of God classes of tens of thousands of lines and megabytes in size which wouldn't be so bad if they at least weren't so messy with inconsistency as far as the eye can see. One was even called "Functions". Commented out code everywhere and renamed files that are no longer used. Worst still, swaths of obsolete code that is still executed but to no effect other than generating heat. Layers of indirection so deep that a call trace has more steps than the Great Pyramid of Giza would if it were made of Lego bricks. Function names and inline langdoc that has nothing to do with what the function does. So much copy and pasted repeat code that someone coding it by scratch could make something with way less than half as many lines. Somehow managing to write something in 500 lines with no redundant code that could be rewritten in 50 lines while being more secure, featured, accurate, stable and efficient. Rosetta comments everywhere such as (bookshelf->addBook(book);//add book to bookshelf). It goes on and on.
What I find amazing is how pervasive these problems are. Whenever I think I have seen the worst of it, something else comes along. For a while I always wanted to expose it, but I've come to see so much of it that I just don't see the point of it.
Admin
BTW I don't like java, I prefer much more c#.