|
Or, "How not to do your release notes.":
str3 = str3 + "<tr><td align='center'><b> Version 2.1.101 • 15 Sep 2007 </b></td></tr>" +
"<tr><td> </td></tr>" +
"<tr><td> </td>• Resolved script error on Reports Viewed List Report</tr>" +
"<tr><td> </td>• Resolved error when adding level using MSSQL</tr>" +
... [snip]
"<tr><td> Corrected Directory Listing query to display Extension Number of Parent Extension </td></tr>" +
"<tr><td> </td></tr>"; 730 lines have been removed from the string literal to protect everyone, not just the innocent.
You really gotta try harder to keep up with everyone that's not on the short bus with you.
- John Simmons / outlaw programmer.
|
|
|
|
|
Wow... just wow.
As me and my brother debate about regularly, at what point would a 'normal' person stop, take a step back, and say "really... wtf am i doing?". And what should we do with the non-normal people that either keep going for a REEEEEAAAALLLLYY long time, or worse yet, never hit that mark?
From both our experience, it would appear to be - make them CTO.
-------------------------------
Carrier Bags - 21st Century Tumbleweed.
|
|
|
|
|
So not only did he use over 700 unnecessary string concatenations, but he couldn't even put the text INSIDE the table cells?
I must say I'm impressed... It takes real talent to make a coding horror that spans two languages! (Three, if you count English -- Extension Number of Parent Extension? Is that from the Department of Redundancy Department?)
|
|
|
|
|
That's highly inefficient too. This is much more efficient:
str3 = "<tr><td align='center'><b> Version 2.1.101 • 15 Sep 2007 </b></td></tr>"
"<tr><td> </td></tr>"
...
"<tr><td> </td></tr>";
That way, the compiler will be able to do the string joins at compile time, rather than at runtime using the overloaded + operator. I'm assuming this is C++ and not C#. The initial str + would not have been needed in C#...
--
Kein Mitleid Für Die Mehrheit
|
|
|
|
|
It's decompiled C#.
You really gotta try harder to keep up with everyone that's not on the short bus with you.
- John Simmons / outlaw programmer.
|
|
|
|
|
Whoa.. It didn't even optimize the literals when it was compiled? Did someone forget to turn on the optimizer?
--
Kein Mitleid Für Die Mehrheit
|
|
|
|
|
I found this function in the service I'm having to debug. I've omitted a few hundred lines of the code so that you may more clearly see the control flow.
void ProcessMessage()
{
if ( )
{
}
if ( )
{
}
if ( )
{
}
if ( )
{
}
while ( )
{
if ( )
{
continue;
}
if ( )
{
continue;
}
if ( )
{
continue;
}
if ( && )
{
if ( || )
{
if ( )
{
}
else
{
}
continue;
}
}
if ( )
{
continue;
}
for ( ; ; )
{
if ( )
{
}
if ( )
{
if ( )
{
}
continue;
}
if ( )
{
if ( )
{
}
continue;
}
if ( )
{
if ( )
{
}
else
{
}
if ( || || ( && ))
{
if ( )
{
}
}
else
{
if ( )
{
}
}
continue;
}
if ( )
{
for ( ; ; )
{
if ( )
{
continue;
}
if ( )
{
if ( )
{
}
else
{
}
if ( )
{
}
break;
}
else if ( )
{
if ( || )
{
if ( )
{
if ( )
{
}
}
}
if ( )
{
}
else
{
}
continue;
}
else
{
if ( )
{
}
break;
}
}
}
else
{
if ( )
{
}
}
if ( )
{
if ( )
{
}
}
else
{
for ( ; ; )
{
}
}
if ( || || )
{
if ( )
{
}
else if ( )
{
}
else
{
}
if ( )
{
}
else
{
if ( )
{
}
else
{
}
if ( || ( && ))
{
if ( )
{
if ( )
{
}
else
{
}
}
}
else
{
if ( )
{
if ( )
{
}
else
{
}
}
}
}
}
}
for ( ; ; )
{
if ( )
{
}
}
if ( )
{
if ( )
{
}
if ( )
{
if ( )
{
}
}
else
{
if ( )
{
}
}
}
else
{
}
}
}
|
|
|
|
|
add a couple of gotos and it'll be perfect
|
|
|
|
|
(In Homers voice)[sobber][drool]Mmmm! Modular![/drool][/slobber]
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
Holy Cow Im suprised the debugger didnt have a stack overflow when it saw this!
|
|
|
|
|
I'm more surprised that the debugger didn't miraculously become intelligent and decided to commit sumicide
GSoC 2009 student for SMW!
---
My little forums: http://code.bn2vs.com
---
70 72 6F 67 72 61 6D 6D 69 6E 67 20 34 20 6C 69 66 65!
|
|
|
|
|
That looks strangely familiar, did you delete 4 long case statements and about 10 foreach enumerator loops?
-------------------------------
Carrier Bags - 21st Century Tumbleweed.
|
|
|
|
|
OK, what did you replace it with?
|
|
|
|
|
CTRL+A, DELETE. Then start it afresh. That would be a safer start than a buggy restart into the crazy maze.
Vasudevan Deepak Kumar
Personal Homepage Tech Gossips
The woods are lovely, dark and deep,
But I have promises to keep,
And miles to go before I sleep,
And miles to go before I sleep!
|
|
|
|
|
Right, so what does it look like now?
|
|
|
|
|
Probably nothing. I'm assuming he's doing maintenance code of something he didn't write (he wouldn't be posting here if he had!). Since it's maintenance, most people are reluctant to rewrite code. Especially if the code looks like this. God knows how the rest of the code looks like...
--
Kein Mitleid Für Die Mehrheit
|
|
|
|
|
I did eventually decide to move the body of each loop into its own function. Still uglier than I'd like it to be, but yes, I was reluctant to rewrite it, especially when the problem I was trying to fix turned out to be somewhere else.
|
|
|
|
|
One quick guess. Was the project manager had a condition of payment on number of lines code?
Vasudevan Deepak Kumar
Personal Homepage Tech Gossips
The woods are lovely, dark and deep,
But I have promises to keep,
And miles to go before I sleep,
And miles to go before I sleep!
|
|
|
|
|
If you scroll that up and down real fast it looks kind of trippy.
|
|
|
|
|
That's called VP (Vertical Programming).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Wow! That literally hurt my eyes.
Unfortunately I have seen similar code for text processing. You have to keep scrolling back up a hundred lines or so to find out where the value stored in that variable came from and just what the heck it is supposed to be; of course it was probably modified on the way down – loads of fun.
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|
|
Well...I wont share you the source code because its an enormous snippet. But i will narrate you the concept like a bedtime story. The technical director of our company - who is in parallel our head programmer (somebody save us)- decided to add a new feature to our super-dooper, high-end, wannabe-ERP product (riiiiiiiiiight!!!!). That was ... the very "advanced" requirement : "Our application will have only one instance.Listen how is going to be implemented..." .And then the problems just begun. "In order to implement it we'll take the ProcessId of our .exe and a timestamp of DateTime. Now to ensure its a today's instance of a process and save it to the database. So every new instance of the program will check the database to ensure if it will execute or not". I asked him very politely "What about using a mutex ?" . I almost got fired because : "You don't pay attention to the requirements and your only concern is to show off to me and to the rest of the development team with theoretical buzz-words. This is real-life programming buddy. Can you do this or not ?".
No comments from me. I leave them to you. I'll keep the dissappointment.
P.S. (1) The same day he forbid me to use again datasets, or LinQ to SQL because they are too complicated, too time consuming to construct, they don't ensure data integrity (???), and they oblige us to stick with a certain schema and "... I don't understand the reason for a disconnected architecture". So from now and on he commanded me to use only text queries through custom dbcommands and keep a database connection alive in a static object. (Hell yeah!!!)
P.S. (2) All the above are real.
modified on Wednesday, May 27, 2009 3:54 AM
|
|
|
|
|
Wow, just wow...
And I thought that I had a bad nightmare tonight... (-
Trust is a weakness.
|
|
|
|
|
God, that must hurt.
On the other hand, why not write a small sample application, demonstrate to your "head programmer" how it can be a single-instance application with the help of a named kernel object!
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Do you think he's a guy that can take from words ? or examples ? He is the most dogmatic and half-educated (i dont know if this term exists in english.In my country exists and its worse than uneducated) piece of crap i've ever met.
For example , once i told him that i prefer to use enterprise library from microsoft than to write my own libs because its rather profound that i trust more microsoft's code than mine. The answer was : "I don't find the reason not to write our libs. Even microsoft's code is written by people...so why to trust it more than ours ?"
Incredible ???
Do you get it now ?
|
|
|
|