- 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
It's serious business.
Admin
Hungarian Notation (as used outside Systems Programming, and I'm not remotely convinced of its worth even there) is somewhere between Cargo Cult and CYA.
Yup.
It is, truly, useless.
Dangerous, also.
Admin
I use a similar naming scheme myself and I think it works very well. To be a bit pedantic, however, I prefer the following:
mFoo = Member variable aFoo = Argument variable gFoo = Global variable
foo = Local variable
A class variable is a type of member variable. You use the term class variable to distinguish from instance variables.
Secondly, a parameter is what you define when you declare a function, and an argument is the value that is passed in to that function when it is called. Since the variable inside the function represents whatever is passed in, I prefer the "a" prefix.
Admin
My answer to the question is in two parts. Stack allocated variables - use a notation to indicate general type (integer, float, string, datetime) not specific type (int32, int64, etc). Object types - the whole point of polymorphism is that object type is not important (as long as inheritance chains match) so using a type identifier in the name is not required and might be counterproductive.
THe comments about renaming in the programming tool doens't work if the item you are renaming is an external property and is referenced in other code that calls yours.
B
Admin
I also missed a few speeling mistaks... oh well, I'll try harrder next tyme.
B
Admin
Admin
In the mean time, check out Terrence Parr on the basics of doing MVC right.
It's just fucking organisation, for God's sake.
Oh, and for the total lunatic who suggested that it leads to "overhead" because of "too many files" and "wasting memory by passing messages between those files," well ...
... Try parsing Sanskrit. You can't possibly be more useless in the real world, and, you never know, it could be fun.
Admin
The RWTF is that you are such a vain person
Admin
Jesus Christ in a can, if "organisation" was all that it took to program properly, Martha Steward would own your ass.
Admin
140 tries? Geeze, what a lamer.
A multiple choice quiz with maximum (for example) five options per question, minimal feedback on the results (e.g. you got it right/wrong vs. telling you what the right answer is and why), and the same questions every time can be aced in at most five tries, even if you have zero knowledge of the subject matter...
I'm reminded of War Games where WOPR is trying to guess the launch code. It could guess the characters of the code individually (vs. having to guess the whole code at once, no doubt as a poorly-thought-out dramatic tension enhancement ploy) - which means the launch code would have taken at most 36 tries to guess.
"WOPR's trying to guess the... oh. Crap."
Admin
TRWTF in the second story is that the applicant didn't log the answers that got him the high score and submit them from a different IP address.
TSRWTF is that the test was designed to report the score directly to the user -- and then let the user take the test again.
TTRWTF is that the person who designed the test didn't at least have the kid in to interview for some low-level testing position, since he's obviously pretty good at breaking your code.
Admin
What is it with Windows developers that feel the need for this? What if you change the code and your variable needs to change type? Do you find and replace every file to make sure you change the variable (annoying, tedious and error prone) or do you change the type and don't bother to go change the variable name? (making the practice useless).
What do you do if the program itself needs to change the variable's type?
I won't go so far as to call it a WTF but it just seems it creates more problems that it solves; especially with modern IDEs that can easily show you the variable's definition.
Of course I develop on Linux so what do I know? :)
Admin
Yes, like using any Microsoft product - definitely not: a) smart or b) the best way to increase productivity - but a definite win for marketing...
Admin
Don't slam Americans! Asshats exist in all countries - just look in the mirror...
Admin
Where are the grammar nazis: nThat vIs adjAwesome
Admin
Damn. M$FT can't catch a break. People dump on them for using HN, and when they finally own up to their mistake, someone comes along and dumps on for that.
Admin
Both contributors are douchebags.
I cower in the awesome intellect of Mr Prime. His knowledge that 1 is not a prime (anymore) is dizzying nee sublime. All hail Ultimate Prime, you sir are my hero. Next time you have our permission to dispatch such heretics that stick to the old ways of one-as-prime.
Or maybe the CEO douchebag just wanted you to prove you knew C# and write a simple 5 line program, and instead you stalled, got in a huff, and left.
Next time, it's going to be the awesome tale of how Sir Prime was forced to write a string reversal algorithm. I crap my pants in suspense.
Admin
Admin
Admin
"That", in the given context, is not a noun but a pronoun. If you're going to "fix" something, why not actually fix it?
Also, to all the biters of TopCod3r (especially Sam B): please stop ruining this site with your pathetic attempts to argue with satire/trolling -- whichever it is, it's way more advanced than anything you've posted. Go back to slashdot, where you stand a chance of appearing (relatively) intelligent. You're strictly 1st percentile here, you miserable oxygen thieves.
Admin
In some cases -- BTDT -- it produces code that's harder to maintain, understand and extend than non-MVC design.
For example, I've had one project where I, quite artificially, decoupled the forms from the "controller" which populated them, switched them, validated inputs, extracted data, etc. This was using the Qt famework. So, instead of using all that Qt provides and having a nice, self-contained and understandable form that could handle its own problems (such as wrong data, parsing/formatting from/to model, etc), the form was dumb, and the code to handle it (the controller) was elsewhere.
While MVC-kosher, in retrospect it was a small-scale snafu. MVC led the form to be stripped of any encapsulation that OOP would normally provide, in fact there were multiple levels of encapsulation: some things, which didn't break MVC separation, were abstracted out in the form, while others couldn't due to controller's involvement. During maintenance it wasn't exactly trivial to determine which way it would be without looking at the code. I wrote it and I had to constantly look things up, which meant someone else would just call it a clusterfuck and refuse to touch it.
I have later rewritten it to bundle the view and the controller, and the code shrank by 50% and became a breeze to work with. It was, just by the feel of it, the simplest, least astonishing way of doing it, and pretty natural when dealing with code targeting Qt.
Qt provides reasonably good M-VC separation in its model-oriented controls, but they too don't force you to separate the controller out; in fact they make the controller functionality subclasseable/extendable on as-needed basis. It just feels "sane" when using, and seems natural - at least to me.
Of course there are situations, like in web programming, where not only the model and view are physically separated, but the controller can have multiple personalities too, and be spliced between the ajax client and the application server. But there it actually makes sense, and still it doesn't come with its own pains (thus emergence of all those nifty web application frameworks).
Cheers, Kuba
Admin
It started in QuickBasic. I remember finding it quite handy, but since learning more elegant ways to handle errors, I haven't used it since about 1997. QB also used the old BASIC type suffix: like S$ for a string or N! for float or I% for integer. Does VB still support those? I have never used VB so I wouldn't know. :)
Admin
Actually, it is all the idiots who can't recognize a troll when they see one (i.e. people like you) who we laugh at.
Topcod3r aka 'Brian' is a clever troll and chooses sides of contraversial topics to claim as fact.
You were the bait. Fact.
Admin
Gotta say, it was 100% obvious to me he was a troll as soon as I read the post. I just couldn't believe that so many people took the bait. And I've never seen him post before.
But I suppose I am a former VB/C++/C#/QuickBASIC/Forth/Pascal/Transact-SQL/6502 Assembler programmer so that probably helps. Seriously, if ANYONE starts extolling the virtues of Hungarian notation (shudder) and ON ERROR RESUME NEXT, your troll ears have got to start twitching ! Not that ON ERROR RESUME NEXT isn't very useful in the right hands, but it's a real favourite twig to bash VB coders with !
Admin
It was plainly obvious that he was joking to us true top coders :) It was a materful troll and I'm glad it made people like you so grumpy.
Admin
It was a necessity when years ago, some of us were writing some VBScript, IIS4 or 5 running Classic ASP calling COM objects. The reason to do On Error Resume Next was because an error HResult from a COM object would kill the Classic ASP script dead in its tracks. Not exactly desired behavior for your website. So if you set errors off, you can then query the Err object and handle the situation properly.
It's not exactly rocket science, and it's nowhere as clean as try/catch/finally, but it has it's place.
Admin
I think it is a good beginner question. Wondering what the nth prime is shows a lack of understanding the question. You only want to know what the n'th prime is after you already know the (n-1)th prime, recursively until the first prime. Knowing not to bother testing division by non-prime numbers is also something else they would have been looking for. You don't have to have a mathematical PHD to realise that there is no point testing for division by 6 if you have already tested for division by 2. Finally, there would probably be bonus 'marks' for people who put in optimisations such as only testing odd numbers higher than 2. In short, it is a simple problem which an intelligent applicant should be able to solve in short time regardless of their mathematical knowledge - provided they know what a prime is.
I didn't test or double check this code, but it should be pretty clear how it is working.
Admin
QB was a bit of a hybrid. It also supported dim s as string, IIRC.
Admin
Not grumpy :) I don't particularly care; after all, this is the internets, right? I enjoy debate, or putting an idiot in his place. If it turns out the idiot was a troll and I fell for it... shrug I'm over it.
The only reason it seemed plausible to me is because I've actually heard from serious people the same crap that "Top Cod3r" was spewing. And they were being serious. And it happened many times throughout my tenure as a programmer. So, Top Cod3r's stance wasn't beyond-a-shadow-of-a-doubt illegit.
Oh well. It's all fun and games, etc.
Admin
Admin
ever heard of typedef's ?
Admin
[quote user="John] ... For those that think their knowledge of maths is excellent (myself included), have a look at this: http://xkcd.com/179/ My reaction was the exact same, and had to go to quickmath.com the verify it. [/quote]
That's actually an inferior rewrite of what some consider to be the most beautiful equation in mathematics, involving only the constants pi, e, 0, i and 1.
Admin
"I like to start off with simple questions like the proper use of On Error Resume Next," - Answer: Don't use it, or a language which contains it. (I assume it died with classic VB[script], right?)
"and the importance of naming your variables with a prefix that tells you what type it is." - No value. Silly. Your IDE will tell you. Looks mad. Even Microsoft no longer seems to bother.
So, do I get the job? :)
Admin
This sounds to me like a pretty ambitious goal. Can you provide some realistic example questions?
Admin
No it bloody isn't. Stop justifying absurd design decisions on their path. It's just bad and silly and wrong.
(I once did maintenance on some ASP classic code for a while. It wasn't very nice.)
Admin
Admin
'vs
On Error Resume Next SomeFileFiddlingFunction Select Case Err.Number Case 53 'File Not Found DoProperThingsForFileNotFound Case INVALID_DATA DoProperThingsForInvalidData End Select On Error GoTo 0 [/code]
Obviously the above one looks nicer, but consider it isn't an option.
Admin
Admin
Well it does depend...on whether you're a pre-C19th mathematician or not.
Admin
Admin
I agree as well. Today's comments aren't that great.
Admin
lets see-
we had: table wood printed on a sheet of paper
...Almost!!
Admin
Lots of people don't know that 1 is prime. That's not a wtf at all, really. Prime numbers are just some definition. Most people can live just great without knowing it. Even programers.
The later wtf is really sad. For a good part of the text I thought the wtf would be that the test was quite lame. As it turns out someone showed how flawed it is for using a test to qualify someone and instead of thanking him, he only got ignored.
Admin
Ahhh... The clearest possible sign that someone has no programming skills and no intelligence: the need to mindlessly and needlessly engage in Microsoft bashing.
Congratulations.
Admin
However, if the CEO thought that the ability to calculate prime was important enough to use that as an interview question, you'd think he'd trouble himself to know the right answer, wouldn't you?
Admin
How I aced a online consultant test a couple years ago? Fired up ollydbg and paused the thread the app was running inn... Gave me more than the 2-5 mins per question. Hey if I can freeze a thread and use google to find it I sure as hell can find it via google at a job :P
Admin
Seriously, you have an idiot who doesn't realize that cheating your way through a test doesn't make you an "out of the box thinker"; it makes you a liar and cheater.
I'd pass you up. You think that lying and cheating makes you a "hacker". You're a moron. (And on top of that, you can't spell, either - real intellect knows that there are no numbers in idiot, no matter how kewl you think it makes you look. We all still know you're a loser script kiddie.)
Admin
isn't that how the attorney general's office works?
Admin
Isn't that how the attorney general's office hires people.
-sorry about the duplicate.
Admin
You might be doing better with it now if you hadn't cheated your way through it then. ;-)