Page 1 of 2

1421: "Future self"

Posted: Mon Sep 15, 2014 7:52 am UTC
by Neil_Boekend
Image
"Maybe I haven't been to Iceland because I'm busy dealing with YOUR crummy code."

Dear past self: Why did you write it in a way that you KNEW was going to break?

Edit: fixed the image.

Re: 1421: "Future self"

Posted: Mon Sep 15, 2014 8:05 am UTC
by mokmok
My code still breaks after a sufficient amount of random data have been poured through it, but at least i've been to Iceland :P :D

Re: 1421: "Future self"

Posted: Mon Sep 15, 2014 8:31 am UTC
by orthogon
mokmok wrote:My code still breaks after a sufficient amount of random data have been poured through it, but at least i've been to Iceland :P :D

That's not bad design, it's just wear and tear. "for" loops don't last forever, you know. (On the other hand, you can make your code last longer if you give stdin a good clean from time to time.)

Re: 1421: "Future self"

Posted: Mon Sep 15, 2014 8:48 am UTC
by Garnasha
Neil_Boekend wrote:Dear past self: Why did you write it in a way that you KNEW was going to break?
I was wondering about that as well, but there's eminently sensible reasons for doing this. I can't tell from this comment if you're a programmer or not, so let's say the variable can_program is True if you can program, False if you can't. Now the answer to your question is

Code: Select all

if (can_program):
    return "Give him a break, we all have that bit of dirty unfixable code which we don't want to fix until it breaks. Well done him for recognizing he might want to come back and fix it sometime and leaving himself a note with what he knew about the code."
else:
    return "Well, it happens, not always intentionally. Code is complex, good code even more so to write, less so to read. If you made a mistake earlier in the structure of your program, you can later be confronted with the choice 'leave this (possibly minor) bug in until it becomes a problem, or completely rewrite it'. Unless you're very conscientious and/or your code has practical reasons to need to have no known bugs (e.g. strangers will use it), the former is rather appealing, and sometimes just the smart choice. Alternatively, if you're writing something for your own use quickly and know you'll always be the one using it and will able to look at the source to fix any bugs, spending 8 hours to get something working 100% of the time is a lot less pragmatic than hacking something together which works 99% of the time in about an hour."

*edit* ok, long strings are not comfortably readable in code blocks. Here's a copy of the two answers:
1: Give him a break, we all have that bit of dirty unfixable code which we don't want to fix until it breaks. Well done him for recognizing he might want to come back and fix it sometime and leaving himself a note with what he knew about the code.
2: Well, it happens, not always intentionally. Code is complex, good code even more so to write, less so to read. If you made a mistake earlier in the structure of your program, you can later be confronted with the choice 'leave this (possibly minor) bug in until it becomes a problem, or completely rewrite it'. Unless you're very conscientious and/or your code has practical reasons to need to have no known bugs (e.g. strangers will use it), the former is rather appealing, and sometimes just the smart choice. Alternatively, if you're writing something for your own use quickly and know you'll always be the one using it and will able to look at the source to fix any bugs, spending 8 hours to get something working 100% of the time is a lot less pragmatic than hacking something together which works 99% of the time in about an hour.

Re: 1421: "Future self"

Posted: Mon Sep 15, 2014 8:58 am UTC
by Neil_Boekend
Ah I see.

Re: 1421: "Future self"

Posted: Mon Sep 15, 2014 9:11 am UTC
by bachaddict
Neil_Boekend wrote:[ïmg]http://xkcd.com/[/ïmg]
"Maybe I haven't been to Iceland because I'm busy dealing with YOUR crummy code."

Dear past self: Why did you write it in a way that you KNEW was going to break?


Nice work, putting broken BBCode in a post about broken code!

On topic: if it never breaks, the message is never read and has no effect.

Re: 1421: "Future self"

Posted: Mon Sep 15, 2014 9:14 am UTC
by Garnasha
That's also an option, yes. Although the fact that he knew quite exactly what was going to break and how badly, I expect it broke on a bug that he already knew about and deemed unfixable.

Neil: out of curiosity, can I conclude from your reaction that you aren't a programmer?

Re: 1421: "Future self"

Posted: Mon Sep 15, 2014 9:23 am UTC
by KarenRei
I'm not sure I'd recommend just right now to take that trip to Iceland ;) That is, unless you're fond of high levels of sulfur dioxide and don't mind the not-discountable possibility getting caught in a VEI-6 Plinian eruption that could unleash a biblical-scale jökulhlaup flood.

(okay, realistically, if you stay in the capital area you should be fine ;) But I'd avoid the eastfjords unless you're either very pollution-hardy or come bearing a gas mask)

Re: 1421: "Future self"

Posted: Mon Sep 15, 2014 9:32 am UTC
by karhell
KarenRei wrote:I'm not sure I'd recommend [url="http://www.dailykos.com/blog/Rei/"]just right now[/url] to take that trip to Iceland ;) <snip>
ED: Why is my url tag not parsing? :Þ

probably because of the quotes

Re: 1421: "Future self"

Posted: Mon Sep 15, 2014 9:36 am UTC
by Neil_Boekend
Garnasha wrote:That's also an option, yes. Although the fact that he knew quite exactly what was going to break and how badly, I expect it broke on a bug that he already knew about and deemed unfixable.

Neil: out of curiosity, can I conclude from your reaction that you aren't a programmer?

I wouldn't call myself a programmer. I try to make my life easier with some Excel macro's, but I know my (and Excel's) limits. I have advised my manager to change a horrible Excel based kludge to a database.
Luckily I am so forgetful I have to comment on everything I write, else I'd have to figure it out next day.

I do plan to learn Python because Lego Mindstorms can run that.

Re: 1421: "Future self"

Posted: Mon Sep 15, 2014 9:36 am UTC
by sotanaht
bachaddict wrote:
Neil_Boekend wrote:[ïmg]http://xkcd.com/[/ïmg]
"Maybe I haven't been to Iceland because I'm busy dealing with YOUR crummy code."

Dear past self: Why did you write it in a way that you KNEW was going to break?


Nice work, putting broken BBCode in a post about broken code!

On topic: if it never breaks, the message is never read and has no effect.


In that case you could just spam your comments with that or similar lines. Shotgun approach to prophecy.

Re: 1421: "Future self"

Posted: Mon Sep 15, 2014 9:57 am UTC
by Xenomortis
Neil_Boekend wrote:but I know my (and Excel's) limits

There are no limits to the pain and suffering that will be wrought by the Monster Excel Spreadsheet of Doom.

Re: 1421: "Future self"

Posted: Mon Sep 15, 2014 10:07 am UTC
by Neil_Boekend
Xenomortis wrote:
Neil_Boekend wrote:but I know my (and Excel's) limits

There are no limits to the pain and suffering that will be wrought by the Monster Excel Spreadsheet of Doom.

Hmm, that just might be the name of my next kludge :twisted:

Re: 1421: "Future self"

Posted: Mon Sep 15, 2014 10:22 am UTC
by Xenomortis
Other good (and descriptive) names for common things include:
"The Perl script of Woe"
"Ye Olde FORTRAN program"
And the generic "Here Be Dragons".

Re: 1421: "Future self"

Posted: Mon Sep 15, 2014 10:33 am UTC
by Eternal Density
GOOMHGLR!
It's like he knew that over the last week I developed the following:

Code: Select all

split_re = re.compile(r"&[lg]t;|_|9/11|\[+|]+|{[0-9]+}|{me}|:[0-9a-zA-ZåÅ'\-*]+:|[.,_/ -]{6,}|-[a-zA-ZåÅ'*]+ |[0-9a-zA-ZåÅ'*]+|[^\s0-9a-zA-ZåÅ]| +")
And maybe i need a few more comments in this:

Code: Select all

                smiley_hit=smiley_re.match(word.lower())
                if smiley_hit:
                    hit=smiley_hit.groups()[0]
                    word = '[[[smiley {}]] ]]]'.format(hit)
                    ottishwords.append(word)
                elif ":" in word:
                    ottishwords.append(self.molpy_around(word,":"))
                elif hyphen_re.match(word):
                    word = self.molpy_correct(word[1:-1])
                    word = ' {}-'.format(word)
                    ottishwords.append(word)
                else:
                    #punctuation
                    word=re.sub('\[+',r'[\\',word)
                    word=re.sub(']+',r'\\]',word)
                    ottishwords.append(self.encode(word))

Or moving over to javascript, this:

Code: Select all

    add_smiley: function ()
    {
        var smiley_class =this.className;
        var smiley = smiley_class.replace('smiley ','');
        $(this).append('<div onclick="cuemegall.insert_text(\':'+smiley+':\');" class="'+ smiley_class +'" title="'+ smiley +'"></div>');
    },
    re_me:new RegExp('{me}','ig'),
    re_them:new RegExp('{([0-9]+)}','ig'),
    re_three_open:new RegExp('\\[\\[\\[','ig'),
    re_three_close:new RegExp(']]]','ig'),
    re_two_close:new RegExp(']]','ig'),
    get_one_close:new RegExp('\\]','ig'),
    get_one_open:new RegExp('\\[\\\\','ig'),
    process: function(contents,aid)
    {
        contents = contents.replace(cuemegall.re_me,'<span class="cma-author '+ aid + '" onclick="cuemegall.insert_text(\'{'+aid+'}\');"></span>');
        contents = contents.replace(cuemegall.re_them,'<span class="cma-author cma-author-$1" onclick="cuemegall.insert_text(\'{$1}\');"></span>');
        return contents.replace(cuemegall.re_three_open,'<span class="').replace(cuemegall.re_three_close,'</span>')
          .replace(cuemegall.re_two_close,'">').replace(cuemegall.get_one_close,']').replace(cuemegall.get_one_open,'[');
    },
    insert_text: function(text)
    {
        text = text.replace('cma-author-','');
        text=text.replace(new RegExp('[{]'+ cuemegall.my_aid + '[}]','ig'),'{me}');
        $('#cuemegall_userentry').val($('#cuemegall_userentry').val()+text);
    },

@Neil_Boekend
You mean macros, not macro's.

Re: 1421: "Future self"

Posted: Mon Sep 15, 2014 10:54 am UTC
by Locoluis
I rarely have any trouble understanding my past or even ancient code. However, now and then, I always tended to leave that seemingly very small overlooked detail that eventually will break the whole thing.

Finding and repairing that bug is often trivial, as most of those mistakes are infantile. However, dealing with the subsequent headaches and wondering why I committed such infantile mistakes in the first place is never trivial.

Also, unfortunately, that's not limited to programming. I'm such an absent-minded loony.

Re: 1421: "Future self"

Posted: Mon Sep 15, 2014 11:05 am UTC
by Neil_Boekend
Eternal Density wrote:@Neil_Boekend
You mean macros, not macro's.

You mean to 'say that the apo'strophe i'sn't a "warning there i's an s coming"?
Edit - mi's'sed an 's.

Re: 1421: "Future self"

Posted: Mon Sep 15, 2014 11:13 am UTC
by orthogon
Neil_Boekend wrote:
Eternal Density wrote:@Neil_Boekend
You mean macros, not macro's.

You mean to 'say that the apo'strophe i'sn't a "warning there is an s coming"?

You're both wrong. It should be "macroes". ;)

Re: 1421: "Future self"

Posted: Mon Sep 15, 2014 11:22 am UTC
by cellocgw
Neil_Boekend wrote:
Xenomortis wrote:
Neil_Boekend wrote:but I know my (and Excel's) limits

There are no limits to the pain and suffering that will be wrought by the Monster Excel Spreadsheet of Doom.

Hmm, that just might be the name of my next kludge Rock Band :twisted:


FTFY

"Friends Don't Let Friends Use Excel." -- cellocgw

To me, the scary part about this comic is the thought that Future Self forgot he wrote those messages when he was Past Self. Then again, has anyone written some code with an Easter Egg that occasionally, for no particular reason, spews the following message to the console: "Bus Error: Core Dumped" ? :twisted:

Re: 1421: "Future self"

Posted: Mon Sep 15, 2014 11:41 am UTC
by Eternal Density
orthogon wrote:
Neil_Boekend wrote:
Eternal Density wrote:@Neil_Boekend
You mean macros, not macro's.

You mean to 'say that the apo'strophe i'sn't a "warning there is an s coming"?

You're both wrong. It should be "macroes". ;)
No, it should be Macross.

Re: 1421: "Future self"

Posted: Mon Sep 15, 2014 12:08 pm UTC
by Garnasha
Actually, I've had some spreadsheets (not excel though, I think it was just google spreadsheet) that were really really useful. Then again, I've played EVE for a short while and had to distribute profit from a mining operation.

There's more in that list though... actually, I think you can make a list of every single computer-readable language (programming, mark-up or other) with reasons to avoid it.

And cellocgw, as for neil, I don't know if you're a programmer, but I know there's comments in my old code that I might recognize as having been written by myself sometime in distant memory, but that I've forgotten about and won't remember until seeing them jogs my memory. And I'm not even that prolific a programmer; by now, most code I've written will probably have been for courses.
A likely factor in the forgetting of comments is that, once they're written, you don't need to know your own comments to write further code (or comments). Code is constantly held in memory until it forms strong after-images in long-term memory, unless you've written enough code that there's so many similar memories those new memories get lost in the noise.

Re: 1421: "Future self"

Posted: Mon Sep 15, 2014 12:16 pm UTC
by BentFranklin
Dear Past Self,

WHY ARE YOU YELLING AT ME?

Sincerely,
Future Self

Re: 1421: "Future self"

Posted: Mon Sep 15, 2014 1:06 pm UTC
by ayryq
This panel reminded me of the Calvin and Hobbes sequence when Calvin built a time machine to collect the evening's homework from himself, at bedtime. When bedtime-Calvin hadn't done it either, they decide to go visit mid-evening Calvin, since it was obviously his fault it wasn't done.

Edit: Can't post it, but I did find a link to the whole series I'm referring to. It's on MIT's server and has the title "MOOD - Calvin and Hobbes - Full Story"

Re: 1421: "Future self"

Posted: Mon Sep 15, 2014 1:08 pm UTC
by fibonacci
#If it ain't Bjork, don't fix it.

Re: 1421: "Future self"

Posted: Mon Sep 15, 2014 1:24 pm UTC
by jc
bachaddict wrote:
Neil_Boekend wrote:[ïmg]http://xkcd.com/[/ïmg]
"Maybe I haven't been to Iceland because I'm busy dealing with YOUR crummy code."
Dear past self: Why did you write it in a way that you KNEW was going to break?
...
On topic: if it never breaks, the message is never read and has no effect.

Oh, I dunno 'bout dat. I recall several decades ago writing a similar comment in a program before an insanely complex nested-4-levels-deep pile of conditionals, where my advice was along the lines of "If this ever breaks, don't bother trying to understand it; just rewrite it." Recently I ran into one of the fellows I'd worked with back then, who mentioned it to me, and said they're still using the program unchanged. I was amazed, along the lines of "You're not still using that computer, are you?" He said they weren't; they'd just copied the program to the various new machines, where it always compiled and ran without problems.

I was even more amazed by this. You'd think that the people who built the compilers would have managed to break it by now. I mean, recent systems now even have C compilers that give warning messages for things like for (i=0; p=argv[i]; i++) ... (though they have to still make it work right due to standards restrictions ;-). I get zillions of such silly warnings that completely break my ability to find the actual errors in the "make all" commands in some directories. Also, compiler writers are quite good at breaking even valid code, especially with some of their clever "optimizing" schemes.

Sometimes you have to just face the fact that even code that's proven correct (according to the published language standards) can do bizarre things that make no sense when you study the code. Code breaks for no valid reason, and all you can do is rewrite it "defensively" until you've gotten around all the attempts by the underlying system to break it. Complex code that works several computers later is an extreme statistical outlier.

(And nobody that I know of has ever fixed the well-known and documented bug in the famous "Hello, world.\n" program. Some bugs are actually best if you leave them there, so people with a sense of humor can appreciate them.)

Re: 1421: "Future self"

Posted: Mon Sep 15, 2014 1:29 pm UTC
by davidhbrown
I can't quite figure out if I'm laughing or crying.

Re: 1421: "Future self"

Posted: Mon Sep 15, 2014 1:48 pm UTC
by rmsgrey
So, past self wrote the Parse module, realised that there was a bug in it, realised that fixing the bug would require a complete rewrite, and also realised that the bug wasn't going to manifest itself for any plausible range of inputs in the current application, nor future applications that reuse the code for some time. Maybe it's a hard-coded limit on input size/complexity, or some clever algorithm involving a timestamp that is only valid for a particular range of dates.

Anyway, whatever the bug is, since it didn't require fixing for the immediate future, and would require a significant investment of time/effort to fix, past self has made the call to leave it in place and let his future self know to avoid trying to fix it...

Somewhere, I may still have the source code for my Tetris clone which uses bitmasks and bitwise operations for collision detection and has a comment at the top of that chunk of code that simply says "deep magic"

Re: 1421: "Future self"

Posted: Mon Sep 15, 2014 2:05 pm UTC
by wolfticket
fibonacci wrote:#If it ain't Bjork, don't fix it.

It's not pronounced like that you Björk :)

Re: 1421: "Future self"

Posted: Mon Sep 15, 2014 2:21 pm UTC
by cellocgw
wolfticket wrote:
fibonacci wrote:#If it ain't Bjork, don't fix it.

It's not pronounced like that you Björk :)


Oh yeah :mrgreen: how do you know he didn't reely truuly mean "All other music is fine, but please do something about that wacko from Iceland" ?

On a more serious note, (sorry warning: car analogy ahead!) there's "ain't broken," and then there's "still running but some bad sounds from under the hood." You can save a lot of sadness by observing minor deviations from expected performance and doing some preventative maintenance. ( end of car analogy) Memory leaks which show up only under certain configs, for example, might be a warning of trouble ahead.

Re: 1421: "Future self"

Posted: Mon Sep 15, 2014 3:00 pm UTC
by airdrik
davidhbrown wrote:I can't quite figure out if I'm laughing or crying.

It seems apparent that your past self is laughing at your future self who is facing the task of fixing a piece of [code] that your past self left you, knowing full well that there was no way that your future self could possibly understand, let alone fix said code.

Somehow the two revisions of self tend to come into conflict with each other quite frequently - especially on our team where we have come to curse past self for doing the quick-and-easy thing rather than the harder-but-better thing on many occasions; while at the same time doing the quick-and-easy thing now, and leaving the harder-but-better thing for future self to deal with if it ever becomes an issue (a month or two from now). The poor schmuck, I'd hate to be the future self who has to rework some of this stuff; but why wasn't past self more thoughtful when he put some of this crap together.

Re: 1421: "Future self"

Posted: Mon Sep 15, 2014 4:35 pm UTC
by rmsgrey
airdrik wrote:
davidhbrown wrote:I can't quite figure out if I'm laughing or crying.

It seems apparent that your past self is laughing at your future self who is facing the task of fixing a piece of [code] that your past self left you, knowing full well that there was no way that your future self could possibly understand, let alone fix said code.

Somehow the two revisions of self tend to come into conflict with each other quite frequently - especially on our team where we have come to curse past self for doing the quick-and-easy thing rather than the harder-but-better thing on many occasions; while at the same time doing the quick-and-easy thing now, and leaving the harder-but-better thing for future self to deal with if it ever becomes an issue (a month or two from now). The poor schmuck, I'd hate to be the future self who has to rework some of this stuff; but why wasn't past self more thoughtful when he put some of this crap together.


Hey, right now it would take days of hard work just to figure out how to frame the algorithm to work without that pesky built-in limitation, but by the time your future self is faced with needing to fix it, you'll have years of additional coding experience, so will be able to do it in an afternoon. And even if you haven't improved that much, Moore's Law means that the clunky, slow brute force algorithm that you can't get to run at an acceptable speed now will be too fast for user input to keep up with it by then...

Re: 1421: "Future self"

Posted: Mon Sep 15, 2014 8:00 pm UTC
by operagost
Past self is such a jerk. I hate that guy.

Re: 1421: "Future self"

Posted: Mon Sep 15, 2014 8:10 pm UTC
by da Doctah
Eternal Density wrote:
orthogon wrote:
Neil_Boekend wrote:
Eternal Density wrote:@Neil_Boekend
You mean macros, not macro's.

You mean to 'say that the apo'strophe i'sn't a "warning there is an s coming"?

You're both wrong. It should be "macroes". ;)
No, it should be Macross.

The plural of macro is macri. Just as the plural of Prius should be Priora.

As for apostrophe-misuse, there are bigger fish to fry:
Image

Re: 1421: "Future self"

Posted: Mon Sep 15, 2014 8:47 pm UTC
by kalira
But the plural of (Ford) Focus is Foci. Wouldn't that make the plural of Prius Prii?

Re: 1421: "Future self"

Posted: Mon Sep 15, 2014 8:56 pm UTC
by speising
the plural of Prius is, obviously, Priūs.

Re: 1421: "Future self"

Posted: Mon Sep 15, 2014 9:24 pm UTC
by JudeMorrigan
In short, the plural form of a word ending in -us depends on its declension and gender. da Doctah is assuming it's the actual Latin word prius, prioris, which is third declension neutral. Focus, foci is second declension masculine. speising is whimsically making it fourth declension masculine. Or possibly feminine.

Re: 1421: "Future self"

Posted: Mon Sep 15, 2014 10:46 pm UTC
by Djehutynakht
All I get from this is that I should go to Iceland.

That seems good.

Re: 1421: "Future self"

Posted: Tue Sep 16, 2014 7:22 am UTC
by mokmok
Djehutynakht wrote:All I get from this is that I should go to Iceland.

That seems good.


Glaciers, clear water (ever watched through 9ft of clear natural water?), dormant volanoes, active volcanoes, geysirs (an eponym, go figure), boiling beaches (seriously) and... it's a country that lives on two different tectonic plates.

Good is an understatement.

Re: 1421: "Future self"

Posted: Tue Sep 16, 2014 9:23 am UTC
by da Doctah
kalira wrote:But the plural of (Ford) Focus is Foci. Wouldn't that make the plural of Prius Prii?


Tough call. The car I drive has a model name that's already plural.

Re: 1421: "Future self"

Posted: Tue Sep 16, 2014 9:33 am UTC
by brandbarth
Opportunities to sleep in a brook with a warm well (Landmannalaugar) because the sleeping bag is wet, to drown yourself and your motor bike in a river (Eldgjá), changing all the oils (engine, gearbox and rear drive) except the fork oil, to vibrate everything to pieces on washboard roads or blinding everybody else with dust, getting hit by stones thrown by oncoming lorries. Throwing away your bike in deep sand, doing a somersault driving out of a river, getting blinded and sandblasted by dust storms.

Watching glaciers and volcanoes in >80 km visibility and lava pebbles rolling through your tent in a storm while the sun shines. Spending 450 kronur for a beer, for a pizza, or for a shower on the Kverkfjöll campsite. Playing rollercoaster through lava fields. Asking yourself why VISA cards are everywhere. Swimming in a pool in the middle of nowhere. Helping to get icelandic horses across a bridge and getting chased by dogs.

Avoiding to look at the heads of sheep at the local supermarket and to hit them on the road, standing in front of the marvel of seven different brands of soy sauce in an ever smaller store, eating fish for breakfast, ordering a new rear tyre via phone, because it lasted less than 2.500 km offroad, drinking beer on the ferry while others feed the fish. Staying awake all night after 36 hours without sleep, because the icelanders drink everything we drink in a week on friday evening in summer.

I skipped the coding part and have been to Iceland twice. :mrgreen:

Future self: third time pays for all.

PS: There are three kinds of icelandic whirlpools: hot, hotter, incredibly authentic icelandic hot.