- 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
It adds value, by definition.
Admin
First off, indenting code properly takes seconds, not months. You can even have it done for you automatically by your dev tools, if you like.
Secondly, "that kind of thing" is what keeps the code maintainable, and if you fail to do it, you'll eventually end up with a mess that you no longer understand, and your customers will "really appreciate waiting extra months" for new releases of your program, since you'll be spending weeks and weeks debugging obscure problems that would have been obvious if your codebase was readable.
Admin
No, you can code in a functional Style in Java. Just imagine
You are welcome to define more interfaces for more parameters. There might be a C#
equivalent in Java so use that.Keep imagining
You could even pass the functional function to another method that takes a parameter of type Lambda.
In reality this was necessary for AWTs events.
Admin
We take the graded approach to software quality assurance. This approach determines how critical the application is, based on the consequences of failure. Software is graded into one of four levels, and the quality gets a lot stricter as the grades go up. The levels are:
Level 1 - Not critical. Who cares if it fails?
Level 2 - Business critical. If the application fails, you're going to stop doing business.
Level 3 - Health/Safety critical. If the application fails, you're going to allow something genuinely dangerous to happen.
Level 4 - Life critical. If the application fails, one or more people die.
As others have stated, professionals should not develop Level 2 business-critical applications to Level 1 standards.
Admin
Admin
Too lazy to make sure 15 of you hven't said this yet....
The REAL WTF is that the "...CEO finally conceded..." (sic)
Admin
It was music software, and it's spelt 'minim'
(Actually, I have found more recently (for consistency) that it's better to start from Button000, Button001 - I've never exceeded a Thousand yet (Actually, I've never exceeded 100 yet - but it pays to be prepared). Numbering buttons in sequence like this helps when you need to be able to find the most recently added component)
Thanks Again, though, I wouldn't be where I am if it weren't for you.
Admin
Hahaha
Search and replace is great, until you realise that when you replaced s1 with FirstName, you created a FirstName0, FirstName1... (from s10, s11 etc). In itself, not so much a problem. Then you need to replace all the answers to expressions (which we cleverly labelled e0, e1, ....).
So we end up with FirstNamAns, FirstNameVal...etc....
Search and Replace is your friend, not always....
Admin
Ain't that the truth - most people who do have code worth stealing are arrogant enough to think that they'll be able to recognise their own ideas no matter how much you morph them. (Often they're right, actually)
Admin
I think you hit a very good point - people who know nothing technical should not make technical decisions without consulting their technical resources. Catch-Phrase Kings are great at picking the worst product or worst technology for a job.
Admin
And I didn't realise that it takes months of extra effort to indent code as you go (in fact, I've always found it more time consuming taking the indenting that my IDE puts in back out of the code).
Admin
I ran into the same thing in the project I'm working on. In code reviewing someone's code I noticed he left a member variable in a different state that it was in before the code change. The author was using the member variable as one of these "temp" variables, so he didn't understand why I was questioning it. After realizing he was using the member variable was a "temp" variable, I asked him why he didn't just use a local. "Oh I didn't want to create a local." Why? Performance wise it is the same thing, as both times he was creating a new list. I don't know exactly how C# works, but I imagine a local isn't much different in C# that in C++, just decrement the stack pointer a bit. The worst part about it is you won't throw away the temporary list. He said "sure the garbage collector will throw it away when you stop using it." Well actually no it won't because you don't really stop using it until the class is destroyed.
Admin
Not necessarily. But a good habit to get into is naming the index, so you know what it indexes. This is more useful with nested loops. Sure, it is obvious what i indexes when you say foobar[i], but is it as obvious when you say value = foobar[i] + foobar[j]/2.
Admin
True, but the "insane amount of hard work" is much easier if you start off with someone else's idea and codebase.
Admin
Admin
The problem goes away with the for foo in Collection<Foo> - you always have a handle to the current Foo you're messing with
Admin
If you sell people a toaster that sometimes burns the toast, sometimes barely even heats it, and every now and again is moderately acceptable, you'll be out of business in a week, if you're lucky. If you sell some half-baked crappy software that causes your users to feel too stupid to qualify for the special olympics, they'll happily blame themselves and keep throwing money at you.
These companies will keep limping along until users realise that they're actually not getting the best possible product they'ld get if they were buying from someone with standards.
Also, on occasion, they're limping along working the typical 16-20 hour days that you get when you start a business, and they never move the company income beyond "just enough to pay the founder's salary" and so they can't hire someone competent, and can't build up from "all the costs of a business and none of the perks of being an employee" up to "actually owning a genuine business." Forget telling them to get out of business - most of these small companies aren't a real businesses to start with.
How to tell if you own a business or are merely an employee with less job security than a janitor at Enron: go on holiday for six months. If the money keeps coming in, congratulations - you own a business. If you're broke 2 weeks later, you're an employee and your boss is an idiot.
Strangely, the average "consultant" has a similar scheme: even when they're good at their job, being in the service industry means you get all the costs of "being employed" and don't really have much opportunity to grow your business beyond "providing a service for no more than 168 hours a week", and you won't keep that up for long. If you develop into a company, that means hiring other people to do the employee stuff, so you're not stuck doing the employee stuff yourself and can go on holiday for 6 months.
Admin
Should not have written it in Java in the first place.
Admin
Admin
I am a total speed freak and love to speed up and optimize code any chance I get, but the idea that using shorter variables saves any appreciable amount of machine cycles in an interpreted script is ridiculous. I have severely chided other programmers on my team for using _c, _p, and _f as variable names in complex routines without comments.
Single-character variables names (and de-facto single character names) suck. :(
Admin
In school another student was supplied with an Excel spreadsheet demonstrating an computational geometry algorithm to be applied in Java, so he copied and pasted the Excel cell variable names (eg. K2 = (A4*B3)+U25) for an entire application) into his java code. Somewhere he made an error and couldn't figure out why no-one wanted to help him debug his code...
Admin
"after a few weeks happily coding away, the new forum up and running."
You accidentally a word.
Admin
I'd probably use b instead of x.
And I too put all my single-statement get/set methods on a single line each.
public void setSpeed(int iSpeed) { Speed = iSpeed; }
I'd probably also add this to it, if I needed to debug something:
if(debugmode) System.out.println("New speed set: "+iSpeed);
Admin
s/s1 /FistName / perhaps?? Of course, if there's a lot of "s1=" you also have to do s/s1=/FirstName=/
Planning a file-wide search-and-replace is half the job ^__^
captcha: inhibeo Hey!? Are you calling me a tool?!
Admin
i,j,k & l are perfect for local functionality, loop counters etc.its like when mathematicians always use p,q,r & s.
Admin
Admin
My company let some go for (among other things) using variable names like "local1", "local2", etc.
Admin
it took a few weeks to install and configure some open source forum software?
Admin
I'd say not. Meaningful variable names are A Good Thing, but if a developer can't work out what the variable 'i' does within a loop, he's not worth employing
Admin
Without looking, tell me what minim38 is/does
Admin
That was not a nice experience.
Admin
University project => no choice.
Admin
Admin
I bet these developers wrote all their Word documents in 3pt font because it took less space on the hard drive and therefore loaded faster.
Admin
Admin
Admin
Admin
usualy before i wear sunglasses i smoke a bowl pack
Admin
You forgot the letters M and N, which when included with the previous (I, J, K, L) are always integers!
Didn't you study that in your FORTRAN class?
Admin
I can't tell if you're serious or not. Your footnote seems to negate your main comment. Anyway, yeah, for interpreted code it makes a difference, but don't most interpreters do something akin to just-in-time compilation these days? I mean don't they at least compile to a byte code of sometime?
If speed is so important that you've gotta use single letter variables and eschew proper indentation, you'd probably be better off working with a compiled language, or possibly even an assembler.
But I think you knew that already because of the footnote thing. I just can't tell for sure.
-- Furry cows moo and decompress.
Admin
In java, I believe the penalty would be a new reference and the obvious gain in readability. Not to mention, the java compiler optimizations might even address the new reference.
Admin
or unknownunknowns
Admin
I guess that's actually a very good reason to use real names for variables. This swapping re-use of variables could make unforseen bugs.
Admin
Depending on the original forum software's license, the "optimizers" might have violated it either by selling it commercially or by removing the copyright notices or copy of the license from the code. I certainly wouldn't hesitate to let the original authors know so they could look into it further.
Admin
Anybody else remember coding on the Ti-83 where you were forced to use 1 letter variable names?
Admin
Mathematicians do, but then they are in their own world.
But assume you are in C++, and you iterate over a list of customers. What name should you use for the iterator? i? iter? That's thinking from the implementation up.
An iterator references one of the customers in the collection (or none). You dereference the iterator to access that customer, so why not use a name like aCustomer or thisCustomer? Much more expressive.
for (CustomerCollection::iterator thisCustomer...)
if (thisCustomer->hasNotPaid()) ...
Admin
DEFINT I-N
Admin
The question is, how many reasonable runtime interpreters exist? Or, in this particular context, what is the definition of 'reasonable'?
I've talked with interpreter purists, for example, who claim parsing the code to bytecode (like Commodore BASIC does, for an ancient example) moves the language engine from 'interpreter' part of the way to 'compiler'.
Admittedly, I'm of the opinion that it moves it from 'mindbogglingly useless' closer to 'potentially worthwhile'.
That being said, even some tokenizing interpreters don't convert the variables. For example, on the Commodore (VIC-20, 16, 64, Plus 4, 128, possibly the PET), variables were limited to two characters of significance. However, the whole variable name was stored, and it would read through the entire variable name every time it encountered it. (However, it did only compare the first two characters. Any characters beyond that were just scanned for end of identifier so it could find out what came after.)