- Feature Articles
- CodeSOD
- Error'd
- 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
Admin
As professionals it is our job to keep vigilant, but at the rate of library/language/technology expansion I believe I'm voting on the side of keeping this post in the spirit of "ha, I've done that". Please, did we REALLY need to put ruby on rails, were the streets not fast enough?
Admin
Admin
I worked at a shop where the design was to use web services for the data access layer. They passed the web.config file as an input parameter to the web service. Then, the web service could retrieve such information as the database connection string to be used (different callers used different copies of databases with identical schemas). I don't believe that you can use ConfigurationManager to examine a web.config file outside of the current root.
Admin
Well at least he read a value from an XML file the "right" way: by using an XPath query to pull out the value. A true WTF would involve something like a "for(int i=0; i < file.Length; i++)" loop to read over each character one at a time and cobbling together some kludgy state machine depending on whether he had recently seen a left-angle-bracket.
Admin
Whenever a developer is about to write some code they should look at the non-business specific functionality and think "Somebody must have already solved this problem". Either in their company (if it's a large one) or somewhere on the web.
In fact I find the best programmers are good at finding solutions then tweaking them to the specific business needs. They are always reusing someone else's code.
Sadly interview processes don't consider that skill. In fact they promote the opposite. Interviews are about proving our domain knowledge. Essentially the knowledge you have in your head.
However, I'd take a developer with a short memory that can find and adapt other's solutions quickly over a 'think they know it all' type any day. The first won't reinvent the wheel or suffer from 'Not Invented Here Syndrome'.
By the way I'm a Senior Developer with 20+ years experience and I would never be arrogant enough to assume I know everything. Even if I knew 99% of all that is knowable on any technology a newbie might know the 1% I am missing. Therefore I can learn from anyone.
Admin
The problem is sometimes it's far more difficult (and takes far more time) to research an existing solution in the API than to roll your own.
In my college English classes, you would fail if the professor found evidence of plagiarism. I also remember two students who failed one of my CS classes because they shared code with eachother (prof treated it as 1 project grade split between the two students). That, combined with how easy it is to get sued in America for such things, makes me scared of always copying / reusing code from somewhere on the net.
Admin
This sort of thing is all to common. I've seen this time after time. Usually the person who wrote it just wasn't aware of the function existing and just went about it the hard way.
Admin
Which, in the end, isn't altogether THAT different from using a SAX parser.
Kludgy state machine, check.
DOM FTW.
Admin
Was wondering the same. Though, wouldn't the "correct" XPath be
?
(Ignoring the general WTF that are "key" and "value" elements in any XML scheme...)
Admin
In the IT business world, the goal is to finish a project on time and on budget, preferably under. Therefore there's no point in you doing what has already been done. And in my 12 years in the business, I have never had to steal someone else's proprietary code; but on an almost daily basis I google some issue and find a website where a solution is offered. This is most often on MSDN or related forums, since I'm a .Net developer.
There's no shame in using code you didn't write.
Admin
This is something that is germane to ASP.NET. If you create a project holding website development code, and it automatically creates a file named *.config with some prepopulated data in it, wouldn't you at least look to see if there is a facility that provides a convenient way to read data from that file? Go to any ASP.NET tutorial page, and one of the first things they hit you in the face with is how great the web.config file is.
Still a pretty weak WTF. Even though it's a pretty inefficient manner to retrieve data from the config, at least it's solid and it works.
Admin
Fredsaw is correct. We would never use someone's proprietary code. Learning from others who love to share via open source or sites like www.codeproject.com (or similiar) is a way to not only solve business problems quickly, it is a way to grow as a developer.
I have no interest in hiring developers that learn in a vacuum strictly from writing their own code.
Admin
Absolutely.
I wonder how many 'academic' types post here? In the real world, most every developer I know is simply pounding out code to get a project completed on time (it's nice to have a paycheck, ya know.) Anyway, it's not that good code isn't written, it is. It's just that there's so damn much to do that we count ourselves lucky when we find a quality gem that we can ninja ;-)
After graduating, I struggled with this issue - grab snippets of code where I could or write everything myself. A boss I had at the time told me (and I'm paraphrasing here) "Hey, we are all standing on the shoulders of giants anyway. So, don't waste your time solving problems that have already been solved. You've enough to do with what you can't find existing working code for."
Admin
Addendum: No, I don't mean "ninja" proprietary code. THAT is a no-no.
Admin
At least he did not write his own xml parser...
Admin
APPLAUSE
I'm so happy to see decent XPaths in the wild - the sheer amount of stunning WTF'ery I see every day regarding clueless XML/XPath/XSL I'm freakin' lonely here.
My contribution: the extra / at the start should be dropped - it could potentially be harmful (though unlikely).
Admin
Wow, that's great :) I didn't think that my submission will ever make it...
Oh, and the interesting thing is... this developer, an ex co-worker of mine, has won a couple of high-school/university .NET development contests!
"Go figure", indeed!
Admin
I don't know, but if that program is made before 2002 (i.e.: at the time only beta version of .NET is released) I can understand. (Granted seems even the last version of MSDN documentation for VS2003, at the web.config index section, the only place mention how to read this is example for VB only (topic named "exmaple [Visual Basic]), C# users might simply skipped that.)
Admin
Nah, it was written when 2.0 was already out there. The code is 1.1, though...
Admin
In all honesty. We're paid well to keep our skills up to date and not require google every time we get a problem.
In the olden days, the old gits didn't have google and usually the manuals hadn't been written yet (no 18 months of pre-releases to write a manual).
Then, it was acceptable to write rubbish like this, but not now. All it requires to be a programmer these days is how to use google to find where somebody else has done it.
Admin
I must admit to doing various equally crappy things in my early days as a programmer. Knowing where to put configuration parameters and knowing how to read them doesn't seem to be terribly well covered in the average CS degree and I've seen some horrible solutions from my colleagues as well. We're a Java house so I now know that the only right way is to put the stuff on the classpath and read it via a ClassLoader.
Admin
Admin
It is pitch black. You are likely to be eaten by a grue.
Admin
Firstly.. you need to know your tools before use can effectively use them... You neednot be able to quote on which page of the manuaal or doc a particular function is documented, but you should atleast have seen the manual and know to reference it. Also, it is better to waste some time RTFM than to spend on writing something that could be avoided by reading the manual.. and that way you will evenlearn something for the future.
Secondly... It isnt wrong to be capable of standing and talking about design patterns and nuances of a language isnt bad, as long as you can follow up with the implementation. Not know enough of either part may cause you to generate such WTF pieces...
Admin
Yes, i know i have a problem with run on sentences, and that i dont know how to reference a dictionary... incase anyone thought of mentioning
Admin
hey.. I just realised...
I have been googling every single day for daily WTF's.. And waddya know.. There's a site called TheDailywtf.com...
Well, if only I knew that
Admin
Our useless mentally handicapped "Manager of Architecture" does crap like this not because he doesn't know the function exists, but because he doesn't trust microsoft. He rewrote his own sucky data access layer because microsofts Data Application Blocks are "filled with bugs".
Admin
Oops....I've done exactly that! In my defence I was in a hurry and couldn't figure out xpath easily, but I realise that's not much of a defence...
I wonder how much of these WTFs arise from pressured coding vs lack of ability...
Admin
I agree. But what do you do when your manager put you under pressure to end your project? You just finish it... sometimes no matter if you end reinventing some wheels.
Admin
Redeemer,
Yes - your point is well taken. I don't disagree with you really, it's just that there's a whole whole WHOLE lot of information and documentation out there. It's hard to always know every little thing about every framework/API/library that we employ. It's especially difficult when you've got a deadline, new tools, and managers on your arse at every turn. You know this as well as I do... I think.
And on the second point, I would be far more impressed if the contractors could have actually implemented something usefull. But I see this a lot. Talking a good game and actually being able to play a good game are two quite different things. My point here should only really be offensive to those who feel more akin to the "talkers."
Admin
Do you want step by step instructions on how to program? Perhaps you want a large dictionary of which functions to use for a particular program, and perhaps the order of those functions?
Admin
The real WTF is that, in the ConfigurationManager documentation, the phrase
"You do not need to declare an instance of a static class in order to access its members."
is syntax highlighted
Admin
Theres nothing wrong with re-inventing the wheel. We are programmers are all, not just a bunch of keyboard monkeys that string together pre-written code.
Admin
Exactly *one day ago I got my first (and hopefully last) taste of Genuine C# Dot NET -- trying to work out the *same basic issue: getting a value out of System.Configuration.
If this was a pro C# she should know this cold. But those of you who think the correct syntax to access this can be found with a quick google are *sorely mistaken.
As I recall (unwillingly, as I'm trying to repress the memory) System.Configuration.Configuration.AppSettings was changed to System.ConfigurationManger.Configuration.AppSettings between .NET 1.1 and 2.0, then to something else for 3 and something else for 3.5
Admin
Ha!
Which brings up another point: who among us, after countless death marches, frustration with Dilbertian management, and many years of long hours, still eagerly digs into each and every new release of framework documentation?
Personally, I go in phases of excitement with my career and wondering when I'm going to hit the Powerball so I can wave goodbye to the headaches :-)
Admin
But this isn't quite as annoying as searching the API and finding out that a trivial and very useful function hasn't been implemented and you end up having to write it yourself anyway (Most of my classic ASP pages now start with a definition of IIf as it's not available in VBScript...) And before anyone else says it (I'm sure someone's thinking it): yes, the real WTF is coding classic ASP in VBScript
Admin
homebrew C style?
what's wrong with
It's not very different from C# or Java.
Admin
Ohh, no fun at all? inventing the wheel agin and again is - if I´m not misstaken - the programmers first responsability. Why are there than one programming language? Should we stick to assembler, cobol, ada, fortran, basic, hascel, c++, c#, Java, fjölnir, comal, fort, dcl...
Nope... lets have fun..
Admin
That's why I said "homebrew". A library call would be perfect. The example I had in mind, written in C#:
Really fundamental stuff that's provided by pretty much every language library worth having, and even most libraries that aren't.
Admin
I only wish I had the time to sit and read all the docs and library listings that come with every language and compiler I write with.
I can't think of how many times I have to switch from writing the same type of code, one in MS Visual Studio using STL, the other in Carbide C++ on a Symbian platform and trying to do the same thing without STL... If I can't search and find a quick way, Yes, you got it, I wind up just writing whatever I need from scratch to get the job out the door.
When time is of the essence then the hack comes in until I have to time to research it greater. As long as no memory leaks, I'm happy and my bank account is happy too.
Admin
Seems like our guy wasn't too familiar with XPath either or else he wouldn't have needed to have that awkward while loop there, which doesn't even break when the key is found:
string xpQuery = string.Format("//configuration/appSettings/add[@key='{0}']", key);
and then selectSingleNode
Admin
That is: ... string value = string.Empty; XmlNode appSetting = doc.SelectSingleNode(xpQuery); if (appSetting != null) value = appSetting.Attributes["value"].Value;
return value;
Admin
I'm really sick of seeing yet another try/catch used to interrupt exceptions that aren't caused by exceptional circumstances.
As a Java programmer, it's your responsibility to know and understand object resurrection on a level where you can use it effectively and as it was intended.
Admin
I know this web page presents quality depending articles oor reviews and othe material, is there any other web site whih offers such information in quality? https://ukrain-forum.biz.ua/