|
|
|
| Non-WTF Job: Software Developer at Rustici Software (Franklin, Tennessee) |
| « Prev | Page 1 | Page 2 | Page 3 | Page 4 | Next » |
|
That's weird - it's all I could say too: "Wow..."
|
|
Wow.
Who typed it all in the first time? The next patient over in the Carpal Tunnel Ward? |
|
Easy, just rewrite it in VB with optional parameters. Then start the long hard road to building it right. Jonathan |
|
Or I guess you could just use param arrays.
|
|
FIST!
Ooooh my good, that's just so exceptionally horrendous I can't feel the need to run manically around on the street screaming! Didn't they hear of the "params" keyword? And what even made them *think* of such a function in the first place?!? |
* 20060718 - Mike - v3.0 - Added support for adding columns aaa to zzz. */ |
How about a Perl script to generate all 600+ variants? Think of the productivity! ("I wrote over 15000 lines of code in one day!") |
|
I can only see one possible solution:
Step one: rm -fr / Step two: "Hey, boss... I quit" |
Re: A Function to Quit For
2006-07-17 13:39
•
by
yet another Alex
|
|
Fortunately there are no triple-letter columns in Excel (at least for now). This puts a natural limit of sorts on this.
|
This sort of says "intern" to me. (And yes, there are good ones too.) |
|
This is completely insane! I would say that I would have to take over design, or quit. |
|
The "right" way to do it (in C, C++, or Objective C) would be make it variadic. For ten lines you could fix everything.
|
|
A classic. Wow. speechless. A WTF on so many levels.
What is really funny is that in order to call this function, someone must have learned how to use the Excel object model to get the values from the worksheet .... but aparently they learned only the absolute minimum to get the job done (probably the Worksheet.Cells(x,y) method which can return a single-cell Range from a row/column). |
|
Aaaaaaiiiiiiiiiiiiiiiiiiiiiiiieeeeeeeeeeeeeeeeeeeeeeeeegggggggggggggggghhhhhhhhhhhhhhhhh ! Wait for it - add additional overloads to add all permutations of cells for all permutations of multiple rows |
I sure hope that's a joke ... the "right" way to do it (in *any* language that supports COM) is to pass in a single Range object and to enumerate the Cells and add them up ... or a worksheet object and a row # ... Or, just use a simple Excel function to do the math !! I hear that the latest versions of Excel support formulas! |
|
seems like it'd be a trivial matter to write a perl script to generate all the functions you need.
i'd do that, and *then* quit. |
|
So, what's everybody's favorite part of this? Mine is,
No. No it does not. It adds up 600+ integers typed in by another hamsterwheel employee. It does nothing with any Excel file. |
|
They appear to just be storing column values as ints. Why not just chop this bad boy down and use a hashtable? Iterate it in the method and handle things accordingly. It's still one ugly mofo, but that would be a step in the right direction.
|
Or, just use the Excel object model ???? Or would that be too easy? |
|
I personally love the reserved word escaping:
_as _do _is Thankfully pi isn't one--it's System.Math.PI And params arrays are probably the best bet for fixing the original problem, but that's just a stopgap. I can't really think of a better way because I haven't done Excel Interop (and now I just jinxed myself, sigh) |
|
3"Hm, I wonder what is that 'array' thing I keep hearing about..."
By the way, I think this is the first time when the cries about something (this thing doesn't even deserve to be called 'code') being generated might be true 3 |
create overloads for the following function so that developers don'tI can see intellisense just crapping itself over this one. |
|
When I saw this, my response was, literally,
D:hint: (tilt your head 90 degrees clockwise) |
I totally agree with this. You can't trust Excel to calculate the numbers of a single row... What does Excel even know about math! Better to do it yourself... |
I'd say from my experience that in C# you can get a DataTable from excel file in umm 3 lines and then add it up in 2 more lines :) Thus cutting over 100 lines of this craptastic solution to mere 5 lines :) |
And thus, you have created your own WTF. Congratulations! |
|
Oh my... GOD... it's BURNING... ...my... my EYES... *STUMBLE* ... it's SO... oh MY... AAAAHHHGGGHHH... i can't... no... this is... this is not... real... no... NO... NOOO..*VOMIT*ON*FLOOR* ... *heavy*breathing* *CRY*
|
Um. Wow. Dear gods, why would anyone write a function to do this that requires each value to be a parameter? Can't they just pass the row they want and iterate through, accumulating the total, and substituting a zero when there's a null/empty-string value? Whoever thought this was the right approach should be drawn and quartered. |
|
int _as
int _do At least he has avoided keyword ambiguity! |
|
I've been reading this site for over a year now and that might be the most appalling wtf I have seen.
|
I thought Excel was restricted to 256 columns (IV, or 2^8) and 65536 rows (or 2^16) per workbook. I'm not sure what the workbook limitation is. At least that's the way it is in Excel 2002, from what I can tell. Would that be the real WTF, perchance? doug. CAPTCHA == 'hacker' # Sweet! |
* 20060710 - BSR - v*.0 - So tierd of copy-paste-edit for the parameters that I'm not going to update the comment any more. |
I've wondered: The real WTF is: Why they have _as. ? Now I'm wondering: Why they don't used variable name @as. ? |
|
Unless I'm very much mistaken, Excel has a SUM(...) function - surely anyone who could write this would know that...
|
|
The substitue nulls thing would work, assuming there were no non-null cells they wanted to exclude.
|
|
Honestly, this is the first WTF that I believe to be fake.
|
Re: A Function to Quit For
2006-07-17 14:15
•
by
Phil the ruler of heck
|
Maybe they were clever enough to make a copy of the "int aa" through "int az" block, then instructing their text editor to replace "int a" with "int b"? All that computing power sitting on your desk must be good for something, after all... |
|
WorksheetFunction.Sum(Range("A1:Z99"))
|
Okay, I'm not a 100% sure about this (only 99), but isn't there a second WTF here? The method takes around seven hundred 32-bit integers and is supposed to return their sum as 64-bit long, but it actually does 32-bit integer addition all the way, thereby potentially discarding the most significant bits?!? |
|
why not use excel.worksheetfunction.sum() |
Re: A Function to Quit For
2006-07-17 14:25
•
by
Phil the ruler of heck
|
So how many lines of code did you write today? Minus 95? So is this "a function to quit for," or "a function to get yourself fired for" on account of extremely unsactisfactory output (in terms of lines of code)? |
|
Amazing people have not discovered the simplicity of arrays as parameters... public long addUpAllExcelColumns(int[] Columns) -jeff |
|
Writing a small program to generate the functions won't be hard ... and in 10 min you're ready with so much source code... it's a whole other thema that the design seems to be f***ed up from the beginning... why should one have a function to sum up integers (really, why only integers?) when it's easier to type "+" instead of calling a function?
|
Um, yes. That gain in efficiency would be well-suited to the original "programmer." |
Better to advertise the increase in performance in such a case. |
|
c# actually has something called a "params" array.. using it for this would be an abuse of its design (as if the current design isn't already), but it might make maintenance easier
public long addUpAllExcelColumns(params int[] columnVals) |
| « Prev | Page 1 | Page 2 | Page 3 | Page 4 | Next » |