What would be the last words of particular kinds of programmers?
For example, a Perl programmer:
I don't have to write documentation. The source is formatted so well, I can read it later...
or
I'm just going to write a regular expression to find this, then I'm done...
Pre CSS:
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
Post CSS:
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
C/C++:
if (launchMissiles = true)
{
FireNukes();
}
if(launchMisiles) soundAlarm(alr_ICBM); fireNukes();
yeah, that's sa- - David X
Java/C/C#
- Shervin
Lisp:
)))))))))))))))))))))))))))))))))))))))))))))))))))
It worked on my machine...
I'm 90 percent done!
"It's a hardware problem"
Every programmer, everywhere:
What? That can't be happening, I didn't touch that part of the code.
(I've never found a statement that angered support staff more than that)
Java:
One more layer of abstraction and this problem should go away...
C:
"128 characters should be enough for this message, right?"
SQL n00b:
DELETE FROM big_important_table_with_no_backups WHERE CustomerID = 100 OR 101;
LIMIT 2
.. - bobobobo
Java people don't die, they wait for the garbage collector to get them :P
To be a little poetic:
/(bb|[^b]{2})/ that is the Question.
C++
delete this;
delete this
is indeed the right thing to do as the last action, when the refcount drops to zero. - Chris Jester-Young
//TODO: Fix this later.
- Johnsyweb
I don't need to rerun all of the tests after this minor changes.
Maybe already there but I think those comments are famous last words....
// this can't happen
Also found as: (thx to Pim Jager)
//This should never happen.
Perl & PHP:
die("So long, and thanks for all the fish");
Wait, WTF?
C#
Thread.Sleep(Timeout.Infinite)
try
{
LHC.Collide(Particle1, Particle2);
}
catch(Exception e)
{
if(e is BlackHole)
{
//LOL
}
}
Mars orbiter team circa 1999:
Yeah, so feet and inches who uses that any more...?
ASP.NET:
/* The commented code below was DELETED because, even though it was commented out,
it was being executed anyway. */
I've actually seen this...
A programmer who was happy with his life:
return 0;
A programmer who wasn't happy with his life:
return 0xDEADBEEF;
return (EXIT_SUCCESS);
in the first one.
You know, in case they change it later. - Jeff Kelley
It should work.
Assembly:
Huh, that code wasn't supposed to be self-modifying...
"It's ok, we trust our users"
"SELECT * FROM User WHERE User.Id = " + Request["id"]
PHP tutors:
It's only aimed at beginners, the security stuff can go in a later chapter...
PHP site developers:
It's only a prototype, we can worry about that escaping business later...
PHP site users:
I'll just browse this site using IE...
A C++ programmer on his deathbed is haunted by a memory leak.
With his last breath he wispers:
"Is that you 0xfaccface?"
// XXX: Fixme
I'll just copy these 50 lines, search and replace, and presto I'm done!
From an old cartoon: It's a grave-side scene immediately after a funeral. The sky is dark and threatening to rain. The young widow, dressed in black, is looking down at the grave. Her little boy stands beside her, holding her hand and crying.
A stranger approaches and asks, "I realize this is an awkward time but did you ever hear him mention the words 'SOURCE CODE'?
Windows Engineer
Ctrl+Alt+Del
mysql> UPDATE users SET password = '123456'; WHERE username='MyName';
Query OK, 4858210 rows affected (0.51 sec)
Rows matched: 4858210 Changed: 48958210 Warnings: 0
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE username='MyName' at line 1
PHP
php_flag register_globals on
There, that should make my life easier.
"Of course I have a backup!"
"I copied this from the internet."
Nearly there!
Just two more minutes and I'm done!
Web:
Let's use frames !!
Maintenance programmer new to C:
"Oh my god, it's full of stars!"
Language-independent: That's a feature, not a bug...
VBasic:
GoTo HEAVEN
MessageBox.Show("This should never happen. Tell a programmer.");
Who put triggers in the database!
I'm surprised no one has yet mentioned:
Quick! someone switch back to "More Magic"!
Death speaks: "... I was surprised to see him here at Mountain View, for I have an appointment with him tonight in Redmond."
"I have found an O(1) solution to the Travelling Salesman Problem, but the margin of my Moleskine is too small to contain it."
try
{
doStuff();
}
//catch(Exception e)
//{
////This can't happen
//}
Since life is a bug, it must be reproducible
//Do not touch!
// todo: implement this later.
Happy programmer:
ESC:wq
Unhappy programmer:
ESC:q!
Noooo, Dont cast me into a void....
</blink>
</font>
Python programmer:
You know, I bet we could use a list comprehension/map/filter/reduce for this.
This is usually followed by writing some incomprehensible Perl-like one liners.
Any object-oriented language (Delphi syntax below):
Self.Free;
perl
cat /dev/urandom > test.pl; perl test.pl; echo $?
result: 0
Windows:
Either this desktop wallpaper goes, or I do.
(with apologies to Oscar Wilde and Echostorm, who correctly pointed out that it was not George Bernard Shaw to whom I should be apologizing)
UNIX programmer:
die_you_gravy_sucking_pig_dog();
See Jeff Atwoods post: http://www.codinghorror.com/blog/archives/001211.html
Any (real) programmer:
"It works on my machine"
PHP:
if($me->getLifespan() - 30 <= time()) {
$dying_words = 'I have no regrets. Well, except for ';
$dying_words .= implode($regrets, ', ');
$dying_words .= ' and... nah, that\'s it. Bye.';
die($dying_words);
} else $me->rockOn();
The C programmer:
I hope this string is NULL terminated!Fz}${%UOE)Ad0DL@+:zs]-i34ow74Segmentation Fault
Just going to put skynet online.
I'm always testing these changes in production! How else would I know they are safe?
It'll be finished for the release, no problem
LW of a Java (JEE) programmer:
"This new framework will revolutionise the way we do things! We'll be able to do more with far less code..."
Bash programmer
sudo rm -rf /
Objective-C:
[soul release];
Microsoft:
Jon Skeet asked for a feature request, to import a little, trivial thing into the .NET framework...
Spot the bug:
switch(DefconStatus)
{
case One: ShowLight(Green);
case Two: ShowLight(Amber);
case Three: ShowLight(Red);
case Four: FireNukes();
break;
}
Valid for any language:
"This behavior is by design."
<?php
$john = '';
unset($john);
header("HTTP/1.0 404 Not Found");
?>
For fans of Terry Pratchett's Granny Weatherwax
while (!deadyet) {
print("I aten't dead");
}
"Dr. Falken, would you like to play a nice game of Global Thermonuclear War?" - WOPR
This code is never used..
For Jeff:
Stack Overflowed.
//todo
Delphi
finally
Free;
end;
"The problem isn't with the code, it's the data you're supplying"...
or
"It's only a quick change it shouldn't impact anyone else"
an actual comment found in code I inherited:
// Please, for the love of God, WORK!
Last words of a java programmer:
catch (Exception e) {
// this shouldn't happen
}
exit('stage left');
For the "Testing is for wimps" programmer:
"If it compiles, ship it!"
You did code a failsafe, didn't you?
Wait, you're not supposed to use gotos for loops?
python programmer using vim:
:%retab!
How about: "I quit."
PHP:
"?>"
C#:
base.Dispose();
Objective-C programmer
[self release];
It is out of the scope
// "That's All Folks!"
PHP:
if (! mysql_query($sql))
die(mysql_error());
DBA: i believe in reincarnation, so I'll just rollback and retry
try{
...
}catch(Exception ignore){
//This won't happen
}
main() {
printf("goodbye, world");
}
Coq [1]: Yep, Q.e.d., it's true. I mean, if you prove this simple, obvious lemma ...
[1] http://coq.inria.frVB
Set Me = Nothing
C# Coder:
try{
Console.Write("I promise to code better if you give me more days!");
numberOfDaysExtension=AskForExtension(numberOfDaysRequired);
}
catch(NumberOfDaysRequiredOutOfRangeException e){
e.ToString();
}
finally{
if(numberOfDaysExtension<=0) {
this.Dispose();
}
else{
GetACupOfCoffee();
GoBackToDesk();
}
}
PL/SQL
EXCEPTION
WHEN OTHERS THEN NULL;
An overflow is impossible.
sudo shutdown -h now
If it was a php day I probably just: die;
it was working on my machine ..
Reminds me, couple of comments that I saw in production few years ago
// 'programmer name' commented here because it was giving error
// incorrect code goes here
One more,
// Added by 'programmer name'
This comment is particularly annoying, because the programmer has cared enough to say who added the code, but not what the code does or it's purpose
try
{
DoStuff();
}
catch(Excpetion ex)
{
// This should never happen, but if it happens
// we need to use Exception logging mechanism
// As of now, we do nothing
}
and 3 years later, the catch block continues to live
using(Programmer p = new Programmer(Programmer.Flavours.CSharp))
{
while(!p.Fingers.Arthritic)
{
p.TryWriteCode();
}
p.Retire();
p.WriteWill(p.Descendents);
}
Yet another one in C:
life_id_t life;
life = fork();
if (life == 0) {
assert(reincarnation);
memset(brain, 0, sizeof(brain));
}
catch (exception) {
// No way code will ever get here }
Programmer that never has to support his code:
Documentation isn't necessary. Documentation is overrated. Documentation is foolish.
Programmer that has to support the above programmer's work:
Where the $%#! is the documentation?
ruby and perl, ruby and perl, and all I ever really wanted was a little calms
DROP TABLE mankind
Picture of a license plate
[1]
ruby programmers never die. They simply learn to metaprogram themselves into beings of pure logic.
Python:
import antigravity
# everything seems to be set in miles, blasted imperial measurements
# setflight(milestotravel, speed, epoch)
antigravity.setflight(929571303.6, 670616629, 1348401600)
Kudos to those who can work out the significance of those numbers.
//TODO: fix later
I don't know how many of these I've put in my code.
Eclipse:
// TODO Auto-generated catch block
It compiled. Let's ship it!
Indian Scheme programmer:
(reincarnate (karma (car lives)) (cdr lives)))))))))))))))))))))))))))))))))
Star Trek programmer:
Computer, end life
Star Trek programmer in troublesome times:
Computer, end life
>> unable to comply, codes have been encryped
Override
>> ending life
Python programmer:
export life
Haskell programmer:
To lazy to change my state to death
APL programmer
''
HQ9E+ programmer:
E
Microsoft programmer
//Fuck Bill
BASIC programmer
Goto hell
Prolog programmer:
!
Java
public class MayanCalendar extends Calendar {
// ...
}
Calendar calendar = new MayanCalendar(2012, 11, 21);
...actually any code that uses java.util.Calendar
or java.util.Date
.
new MayanCalendar(14, 1, 0, 0, 1)
(for compatibility with GregorianCalendar some of the fields are zero and some one-based) - hleinone
gets(large_enough_buffer);
C/C++ programmer : My program is still leaking memory, but I was almost about to fix it.
Cobol
STOP RUN.
Imagine someone yelling it.
But it works on my machine.
// this code somehow works
Thread programmer:
(130) EOWNERDEAD
Last words of a C++ programmer:
"Yeah! I finished it! I'll compile it..."
(2587 compiler errors)
"What can be wrong here? This can't be happening to my beautiful code!"
(forgot a semicolon in the middle of a template class)
**dies
Segmentation fault
COBOL programmer:
MM/DD/YY is a fine date format. It's how I write them in real life, isn't it?
Javascript:
window.stop();
Perl:
my $removeMe = "/useless/useless.527824";
$removeMe =~ s/useless.+//;
system("rm -rf $removeMe"); # gets rid of useless dir. right?
C#
protected void SortEternity(string Time, double Alive)
{
do
{
for (int a; a > 1; a++)
{
for (int b; b > 1; b++)
{
for (int c; c > 1; c++)
{
for (int d; d > 1; d++)
{
for (int e; e > 1; e++)
{
for (int f; f > 1; f++)
{
for (int g; g > 1; g++)
{
for (int h; h > 1; h++)
{
//I think it is time to get some coffee
}
}
}
}
}
}
}
}
}While(Alive==true);
}
Bill Gates :
Reboot
Old Scheme programmers never die; they just go out of scope.
I promise.
... To be continued...
//HACK: insert your, "i will fix this later" excuse
//FAKE: insert your, "he/she/it isn't completed yet, I'll just hard code this for now" excuse
System.exit();
java programmer:
this.finalize()
Vb programmer: all I wanted was to be loved!
OnErrorResumeNext
- scunliffe
Windows:
DEL /S /Q * .txt
Self.Dispose();
Any Coder: I REGRET NOTHING! (With his life flashing before eyes...which was just hours and hours of writing code and not much else...)
Response to "Why doesn't it do...?"
"Wasn't in the spec"
I just need one more day.
C#
using(LifeSupport ls = new LifeSupport())
{
Patient p = new Patient(me);
}
ls.Breathe(p);
Java:
System.exit(0);
C/C++:
exit(natural_causes() ? 0 : cause_of_death());
Pascal:
END.
Bill Gates1 last words: "Oh, fancy meeting you here Mr Beelzebub."
Skizz
Java Guy: System.exit(0)!
VB.net Programmer "But i was so close to getting rid of the Line Continuation Character!"
its not a bug.. its a feature !!!
Google Programmer talking to the Devil "Wait! But... I DID NO EVIL!!!"
Visual Basic:
Microsoft has decided that Visual Basic .NET will not be backward-compatible with Visual Basic 6.0
I trust the completely unknown users' input when they would enter and run their own sql on this public facing website.
Sorry, that's not in the contract!
C#:
GC.WaitForPendingFinalizers();
GC.Collect();
OK, that's the beta-test finished.
Memory Fault, core dump
PHP:
/*
I saw this comment in Axis code - "I'm not sure if we need this code any more, but I'm afraid to delete it."
For you Java sci-fi fans:
void destination() {
if (!hope) {
system.exit(0):
}
}
Windows:
This program has performed an illegal operation, the secret service has been notified, you have 30 seconds...
Two buttons - [Run now] [Disappear later]
of a wicket framework user:
}
});
}});
}
} based on a true story. cust copy/pasted from the file i was editing right now. the bizzarre mix of } }} ) ; and their different sematics drives me insane.
C:
return 0;
}
}
No... wait..
}}
}
"Whatever you do, don't press the red WinForms button."
public class ToBeDisposed:IDisposable {
override Dispose() { base.Dispose(true); } }
PowerBuilder programmer:
See you in heaven. I've done my time in hell programming in PB.
// TODO: This really shouldn't be done this way but I don't want to bother fixing it right now...
C#
Human Live()
//.......
Return this;
Catastrophic failure
Hmm, this is interesting ...
Must... click... commit...
x-|
Perl programmer:
__END__
Socket programmer:
(122) EHOSTDOWN or (110) ETIMEDOUT
shell:
sudo kill -9 -1
The take over bid of my company is worth $100 per share at a total of 100.000 shares.
"It's better to don't write comments to achieve faster compilations"
Ruby:
end
end
end
end
end
end
end
end
//This is a temporary solution
It's the user's fault. They don't know what they're doing. This runs Ok on my machine.
Console.WriteLine("ALL OF YOUR PRAYERS HAVE BEEN GRANTED!")
I don't do design
Lua:
(code version)
self = nil
(non-code version)
Aww shoot, i knew we should have sealed those metatables!
Any programmer:
"Bottom of the Heap, moving to the top of the Stack"
Database Developer:
Who needs foreign-key constraints? My app will ensure that only correct values are inserted!
This was his last code he wrote... you can be sure ;)
StringBuffer iCalendarRequest = new StringBuffer(
"BEGIN:VCALENDAR\n"
+ "PRODID:-//Microsoft Corporation//Outlook 9.0 MIMEDIR//EN\n"
+ "VERSION:2.0\n" + "METHOD:PUBLISH\n" + "BEGIN:VEVENT\n"
+ "ORGANIZER:MAILTO:test@test.de\n" + "DTSTART:"
+ dateFormatter.format(start)
+ "T"
+ timeFormatter.format(start)
+ "A\n"
+ "DTEND:"
+ dateFormatter.format(ende)
+ "T"
+ timeFormatter.format(ende)
+ "A\n"
+ "TRANSP:OPAQUE\n"
+ "SEQUENCE:0\n"
+ "UID:040000008200E00074C5B7101A82E0080000000000278000000000000000\n"
+ " 000004377FE5C37984842BF9440448399EB02\n"
+ "DTSTAMP:"
+ dateFormatter.format(now)
+ "T"
+ timeFormatter.format(now)
+ "Z\n"
+ "LOCATION:Conference room\n"
+ "PRIORITY:3\n"
+ "CLASS:PUBLIC\n" + "END:VEVENT\n" + "END:VCALENDAR").toString();
Surprise to his team - Crucial Module delivery at integration time after worked on it several weeks!!!
/* Module Name: abcd
Very Imp - I have written this module which is platform/language independent. This code SHOULD work on all platforms and languages even in dynamic/functional - tested using C#, Java and C/C++. BUT THIS COMMENT AND OTHER COMMENTS MIGHT GIVE COMPILATION ERRORS.
*/
[some code]
Basic:
GOTO HELL
Hmm He should run an SQL statement in a transaction that fails so that he can get back to the previous position after the rollback.
Today I've seen how our continuous build of some product on windows machine have failed. It seems funny to me:
cp -rf /home/hudson/.../etc/pymodules/Win32/* /home/hudson/cpptest.win32.x86/hypnos/product/Win32-4.0_i486/bin/lib/
chmod -R a+x /home/hudson/.../Win32-4.0_i486/bin/lib/lib-dynload/*.so # Makes no sense on windows but does not hurt
chmod: cannot access `/home/hudson/.../Win32-4.0_i486/bin/lib/lib-dynload/*.so': No such file or directory
make[3]: *** [pymodules] Error 1
make[3]: Leaving directory `/home/hudson/...'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/home/hudson/...'
make[1]: *** [cw] Error 2
make[1]: Leaving directory `/home/hudson/...'
make: *** [all] Error 2
Archiving artifacts
Finished: FAILURE
Last words of a programmer:
"I stay until the problem is solved."
BASIC programmers don't die. They Gosub without Return.
COM:
((IUnknown*)this)->Release();
if (!(--life)) return 0;