Comment On Enterprise Incrementation

“For the past six months,” Jose C writes, “I’ve been struggling with our vendor – let’s call them ‘Enterprise Associates’ – to get the source code for the Enterprise module of their ‘Enterprise ERP for Enterprises’ software. Now we normally don’t expect source code from vendor software, but this was specifically in our contract. Partially because they wrote it on our dime, but mostly because we needed to do some serious customization to make it work.” [expand full text]
« PrevPage 1 | Page 2 | Page 3Next »

Re: Enterprise Incrementation

2011-01-24 09:03 • by Non-consultant (unregistered)
This kind of thing is all too common from consultants... :S

Re: Enterprise Incrementation

2011-01-24 09:04 • by buji (unregistered)
That always happens with code written by $200/hr consultants..

Captcha - populus

http://en.wikipedia.org/wiki/Populus

Re: Enterprise Incrementation

2011-01-24 09:04 • by Enterprise Guy (unregistered)
And I can bet they call these function via SOAP to make it more enterprisey

Re: Enterprise Incrementation

2011-01-24 09:17 • by frits
I wonder if Jose C's middle intial is B.

Re: Enterprise Incrementation

2011-01-24 09:18 • by Someone You Know
Say what you want about the first one, but at least it does something.

The use of the var keyword in the second one makes it a no-op.

Re: Enterprise Incrementation

2011-01-24 09:20 • by frits
335331 in reply to 335330
Someone You Know:
Say what you want about the first one, but at least it does something.

The use of the var keyword in the second one makes it a no-op.


Returning the parameter untouched makes it worse than a noop due to function call overhead.

Re: Enterprise Incrementation

2011-01-24 09:20 • by toth
The increment one isn't (necessarily) a WTF. As far as I can recall, in Javascript, a string plus a number concatenates the number to the string. Since the function calls parseInt(), it's fair to assume that input is a string. Sure, you could say parseInt() + 1 every time, but isn't that function much simpler?


[/troll]

Re: Enterprise Incrementation

2011-01-24 09:24 • by George Fitch (unregistered)

function AssignCommentInToOut(input) {
var output = "Frist";
return input;
}

Re: Enterprise Incrementation

2011-01-24 09:28 • by Two (unregistered)
So, if its "Enterprise Incrementation", can we shorten that to "excrementation"?

Re: Enterprise Incrementation

2011-01-24 09:33 • by boog (unregistered)
I'm pretty sure I would have put whatever consultant wrote this through a "JavaScript compiler" and converted him into "byte-code."

Re: Enterprise Incrementation

2011-01-24 09:33 • by Marcio (unregistered)
335337 in reply to 335333
George Fitch:

function AssignCommentInToOut(input) {
var output = "Frist";
return input;
}


AssignCommentInToOut('Fail')

Re: Enterprise Incrementation

2011-01-24 09:39 • by Arvind (unregistered)

function AssignStringInToOutThenReturnIn(input) {
var output = input;
return input;
}


That's more like it. Choosing proper function names is an essential part of writing well documented code.

Re: Enterprise Incrementation

2011-01-24 09:45 • by 4Reel (unregistered)
335339 in reply to 335332
toth:
The increment one isn't (necessarily) a WTF. As far as I can recall, in Javascript, a string plus a number concatenates the number to the string. Since the function calls parseInt(), it's fair to assume that input is a string. Sure, you could say parseInt() + 1 every time, but isn't that function much simpler?


[/troll]


This explains very succinctly why dynamic typing bothers me. I'm sure there's a more graceful way to deal with it, and it's not like THIS is required, but still - having to fight with the interpreter so that it treats a value as the data-type I want defeats the point of an ultra-high level language.

Re: Enterprise Incrementation

2011-01-24 09:45 • by encre (unregistered)
Could we fall back on Newspeak and describe this as double-plus-ungood?

Re: Enterprise Incrementation

2011-01-24 09:46 • by Perl Guru (unregistered)
335341 in reply to 335338
Arvind:

function AssignStringInToOutThenReturnIn(input) {
var output = input;
return input;
}


That's more like it. Choosing proper function names is an essential part of writing well documented code.

I'm sorry. No. Uh uh. The words "documented" and "code" are incompatable. You dum programmers write something called "code" and expect it to be understandable? There is not now, or will there ever be such a thing as "documented code."

Re: Enterprise Incrementation

2011-01-24 09:47 • by Scott (unregistered)
If that code is what I think it is, and I think it is JavaScript, then they whould have had the source anyway.

Re: Enterprise Incrementation

2011-01-24 09:51 • by anon (unregistered)
I might have been spending too long in C++land, but that second one is hilarious. Doesn't that just leak memory? At least temporarily, until the garbage collector gets around to picking it up?

Re: Enterprise Incrementation

2011-01-24 09:54 • by octal (unregistered)
335345 in reply to 335344
What happens if the string begins with "0" - don't you need parseInt(input, 10) ???

And doesn't "increment" mean "add one" anyway. IncrementByOne is tautological...

Re: Enterprise Incrementation

2011-01-24 09:55 • by Pyroka (unregistered)
335346 in reply to 335341
Perl Guru:
Arvind:

function AssignStringInToOutThenReturnIn(input) {
var output = input;
return input;
}


That's more like it. Choosing proper function names is an essential part of writing well documented code.

I'm sorry. No. Uh uh. The words "documented" and "code" are incompatable. You dum programmers write something called "code" and expect it to be understandable? There is not now, or will there ever be such a thing as "documented code."


Note that when we say documented code, we mean documented so other programmers can understand it, I don't really care if someone who can't spell 'dumb' can't understand my code.

Go back to spending your life writing pointless word documents and leave the people with brain cells to do the coding.

*sigh* feeding troll I know

Re: Enterprise Incrementation

2011-01-24 09:58 • by rfoxmich (unregistered)
Those functions were clearly intended to be embedded in the database as stored procedures. After all, you would want to insulate your application code from the fact that the business logic might want to morph 1 -> 2 and assignment to +=

Re: Enterprise Incrementation

2011-01-24 09:58 • by JamesQMurphy
335348 in reply to 335340
encre:
Could we fall back on Newspeak and describe this as double-plus-ungood?



function MakeDoublePlusUn(input)
{
var output = input.ToString();
return "doubleplusun" + output;
}

Re: Enterprise Incrementation

2011-01-24 10:00 • by pfoof (unregistered)
335349 in reply to 335345
octal:
What happens if the string begins with "0" - don't you need parseInt(input, 10) ???

And doesn't "increment" mean "add one" anyway. IncrementByOne is tautological...

Can you not increment by two?

Re: Enterprise Incrementation

2011-01-24 10:03 • by bjolling
335350 in reply to 335327
Non-consultant:
This kind of thing is all too common from consultants... :S
buji:
That always happens with code written by $200/hr consultants..

Captcha - populus

http://en.wikipedia.org/wiki/Populus
I'm €125/hr consultant and the only comments I receive from a client's code review is that my code is perfect. Of course, they also have to review what their offshore teams are checking in :-)

Re: Enterprise Incrementation

2011-01-24 10:05 • by Chris (unregistered)
I always hate WTF's based on "omg that's a simple function". without context I have no idea if these were meant to be the equivalent of function-pointers/functors. In such a case, you might have a "foreach x in y: if is_predicate() then a() else b();" template set up somewhere, where "is_predicate(), a(), b()" are arguments. perhaps is_predicate(), a(), or b() will end up being a simple "do nothing", increment, or comparison. In that case, "DoNothing" makes a lot of sense. The code has to call a function, nothing needs to be done, so the "DoNothing" function is used.

Re: Enterprise Incrementation

2011-01-24 10:09 • by George Fitch (unregistered)
335352 in reply to 335337
No, it isn't. Read method #2 closer.

Re: Enterprise Incrementation

2011-01-24 10:11 • by George Fitch (unregistered)
335353 in reply to 335337
Let me try this again...

Marcio:
George Fitch:

function AssignCommentInToOut(input) {
var output = "Frist";
return input;
}


AssignCommentInToOut('Fail')



No, it isn't. Read method #2 closer.

Re: Enterprise Incrementation

2011-01-24 10:17 • by frits (unregistered)
Who hasn't written something like this?

I are a consultant and should be banned from my mommy and daddy's modem.

- frits

Re: Enterprise Incrementation

2011-01-24 10:21 • by lolwtf
335355 in reply to 335340
encre:
Could we fall back on Newspeak and describe this as double-plus-ungood?
return IncrementByOne(IncrementByOne('ungood'));

Re: Enterprise Incrementation

2011-01-24 10:21 • by Sudo (unregistered)
335356 in reply to 335350
bjolling:
Non-consultant:
This kind of thing is all too common from consultants... :S
buji:
That always happens with code written by $200/hr consultants..

Captcha - populus

http://en.wikipedia.org/wiki/Populus
I'm €125/hr consultant and the only comments I receive from a client's code review is that my code is perfect. Of course, they also have to review what their offshore teams are checking in :-)

Perhaps that's where so many coders are going wrong... if they stopped using dollars and switched to euros, maybe their code quality would improve?...

I charge in GB pounds. The quality of my code is undefined.

Re: Enterprise Incrementation

2011-01-24 10:27 • by I-am-Stupid (unregistered)
335357 in reply to 335339
... but it's the operator overloading (of +) that causes this problem, not the dynamic typing.

Using + for string concatenation is the dumb.

Re: Enterprise Incrementation

2011-01-24 10:43 • by berglebuddy (unregistered)
335358 in reply to 335357
Using . string concatenation is the dumb.

Re: Enterprise Incrementation

2011-01-24 10:54 • by Zylon
335359 in reply to 335339
4Reel:
This explains very succinctly why dynamic typing bothers me. I'm sure there's a more graceful way to deal with it, and it's not like THIS is required, but still - having to fight with the interpreter so that it treats a value as the data-type I want defeats the point of an ultra-high level language.

Are you dumb, or trolling? The only time you should have to "fight" to maintain the correct data type is when accepting unsanitized input or doing type coercision... which is the exact same thing you have to do with strictly-typed languages.

Re: Enterprise Incrementation

2011-01-24 10:56 • by TheChewanater
These (or at least the first one) may be meant for callbacks. Whoever wrote this was probably using lambdas so often they decided to put it into its own function.

something.connectSignal ("click", incrementByOne, foo);


Of course, the fact that they return a value might make this example not work... It depends on how their callback are called.

Re: Enterprise Incrementation

2011-01-24 11:00 • by Chris (unregistered)
335361 in reply to 335339
4Reel:
toth:
The increment one isn't (necessarily) a WTF. As far as I can recall, in Javascript, a string plus a number concatenates the number to the string. Since the function calls parseInt(), it's fair to assume that input is a string. Sure, you could say parseInt() + 1 every time, but isn't that function much simpler?


[/troll]


This explains very succinctly why dynamic typing bothers me. I'm sure there's a more graceful way to deal with it, and it's not like THIS is required, but still - having to fight with the interpreter so that it treats a value as the data-type I want defeats the point of an ultra-high level language.

And (according to a quick Google) Javascript doesn't implicitly cast int to string, so calling parseInt(anInt) would cause an error.

Re: Enterprise Incrementation

2011-01-24 11:02 • by queso (unregistered)
335362 in reply to 335332
or you could just call ++ on it?

I know I shouldn't feed, but:

even if the number (for some reason) had a '0' at the beginning, it would push it to base 8

There's no reason to FIGHT the typing of the language, work with a language, not against it.

(ECMAScript developer here, and it's a pretty nice language if you know it)

Re: Enterprise Incrementation

2011-01-24 11:13 • by benh999 (unregistered)
IncrementByOne is probably not a WTF. It is probably a call back for some RPC/XHR request.

Re: Enterprise Incrementation

2011-01-24 11:17 • by Coyne
IncrementByOne. One function point, 1 hour: $200.

AssignStringInToOut. Zero function points: Priceless.

Re: Enterprise Incrementation

2011-01-24 11:44 • by Hans (unregistered)
function IncrementByOne(input) {
var output = parseInt(input);
return output + 1;
}

and then call

IncrementByOne('08')

and watch the sparks ...

Re: Enterprise Incrementation

2011-01-24 11:48 • by Mike (unregistered)
335367 in reply to 335357
I-am-Stupid:
... but it's the operator overloading (of +) that causes this problem, not the dynamic typing.

Using + for string concatenation is the dumb.


What does it matter if you are using the text "a.concat(b)" or "a + b"? The result is the same. The automatic cast is the problem.

Re: Enterprise Incrementation

2011-01-24 11:48 • by Anonymous (unregistered)
More shitty consultant code, what a big surprise. You know how we have that rule that no student code is allowed? It's a fair rule, students don't know a lot about the real world and we know their code is going to be rubbish so there's not much point in laughing at the useless little buggers.

Shouldn't we have the same rule for consultants?

Re: Enterprise Incrementation

2011-01-24 11:54 • by GWO (unregistered)
Everyone knows "IncrementByOne" is actually spelled std::bind2nd(std::plus<int>,1) which is much clearer.

Re: Enterprise Incrementation

2011-01-24 11:57 • by Ken B. (unregistered)
335370 in reply to 335329
frits:
I wonder if Jose C's middle intial is B.
Actually, his middle name is "Cañu".

Re: Enterprise Incrementation

2011-01-24 12:05 • by Mike (unregistered)
335371 in reply to 335359
Zylon:
4Reel:
This explains very succinctly why dynamic typing bothers me. I'm sure there's a more graceful way to deal with it, and it's not like THIS is required, but still - having to fight with the interpreter so that it treats a value as the data-type I want defeats the point of an ultra-high level language.

Are you dumb, or trolling? The only time you should have to "fight" to maintain the correct data type is when accepting unsanitized input or doing type coercision... which is the exact same thing you have to do with strictly-typed languages.


The real issue is auto-casting, not dynamic typing. Both Javascript, which is dynamically typed, and Java, which is strongly typed, will screw you here. Java at least tells you what kind of things you're passing around though. This mostly helps the guy who shows up after you to have half a chance of understanding what you were trying to do.

Javascript:
document.write( '1' + 1 );
Output is "11"

Java:
System.out.println( "1" + 1 ):
Output is "11"

Re: Enterprise Incrementation

2011-01-24 12:06 • by XXXXX (unregistered)
Given any function for doing something, there must necessarily exist a less-efficient way of doing the same thing.

Thus I submit the following as a 1000 fold improvement to their design.

function AssignStringInToOut(input) {
for (var i = 0; i < 1000; i++) {
var output = input;
}
return input;
}


Re: Enterprise Incrementation

2011-01-24 12:09 • by Bryan the K (unregistered)
For $200 an hour I'd expect some WSDL files or at least some XML Serialization....you know, because that's how they do things.

CAPTCHA: consequat : The consequat of my actions were thus noted.

Re: Enterprise Incrementation

2011-01-24 12:13 • by iToad (unregistered)
I see the problem. Each of these functions is missing the standard comment that we have to place at the beginning of each and every function, regardless of length. This header includes:
- Repeat of function header.
- Description of all arguments, both type and purpose.
- Purpose of the function.
- List of other functions called by this function.
- Inputs.
- Outputs.
- Global variables modified.
- Interfaces and resources used (Files, GUIs, etc...)
- Limitations.
- Assumptions.
- Change history.
- Notes.

They removed the part where you were supposed to list all the other functions that called this function.

Re: Enterprise Incrementation

2011-01-24 12:16 • by vfdsabfvht (unregistered)
335375 in reply to 335351
What is the reason to name such void function? It can be perfectly anonymous, there is no advantage of "DoNothing" over "function(){}".

Re: Enterprise Incrementation

2011-01-24 12:16 • by anon (unregistered)
335376 in reply to 335361
Chris:
4Reel:
toth:
The increment one isn't (necessarily) a WTF. As far as I can recall, in Javascript, a string plus a number concatenates the number to the string. Since the function calls parseInt(), it's fair to assume that input is a string. Sure, you could say parseInt() + 1 every time, but isn't that function much simpler?


[/troll]


This explains very succinctly why dynamic typing bothers me. I'm sure there's a more graceful way to deal with it, and it's not like THIS is required, but still - having to fight with the interpreter so that it treats a value as the data-type I want defeats the point of an ultra-high level language.

And (according to a quick Google) Javascript doesn't implicitly cast int to string, so calling parseInt(anInt) would cause an error.


Good point. Here, let me fix it:

function IncrementByOne(input) {
var output = parseInt(input + '');
return output + 1;
}

Perfect!

Re: Enterprise Incrementation

2011-01-24 12:37 • by frits
335377 in reply to 335370
Ken B.:
frits:
I wonder if Jose C's middle intial is B.
Actually, his middle name is "Cañu".


Win!

Re: Enterprise Incrementation

2011-01-24 12:38 • by Lucas (unregistered)
About this $200/hr, do they actually charge $200/hr for everyone in the team who wrote funny lines of code, or you just see the invoice and assume that there aren't like 5 other $20/hr programmers from another continent behind this $200/hr consultant?

Please, my question is serious. I can kind of program and I would like to go up from $20 to $200.
« PrevPage 1 | Page 2 | Page 3Next »

Add Comment