June 19th, 2008
A software engineering diversion…
For my sins software engineering* is my day job. I make a rule no to talk about work here, but today a thread appeared on a cycling forum that about sums up Software Engineering in microcosm…
Names have been obscured to save the dignity of the guilty. And some of these people are smart cookies.
Client gives a spec…
Posted by: xxxx (IP Logged)
Date: June 19, 2008 11:32AMI have 400 lines of code with
picture1.jpg blah blah blah WRONG.jpg
picture2.jpg blah blah blah WRONG.jpg
picture3.jpg blah blah blah WRONG.jpg
picture4.jpg blah blah blah WRONG.jpgand I want to find the "pictureX.jpg" at the start of the
line and then stick it in place of "WRONG.jpg" at the end.
so unique find/replace for each line.
Giving me "picture1.jpg blah blah blah picture1.jpg"
geeks wade in with solutions, long, short and off the wall…
Posted by: xxxxxx (IP Logged)
Date: June 19, 2008 11:52AMI’d use a perl script to do that
Posted by: xxxxxxxxxxx (IP Logged)
Date: June 19, 2008 12:03PMcut -d" " -f1 foo > foopic
join -o 1.1 1.2 1.3 1.4 2.1 foo foopic > result
Posted by: xxxxxx (IP Logged)
Date: June 19, 2008 12:23PMopen(FILE,"< foo");
@lines=;
while ($line= pop @lines) {
@words=split(/ /,$line);
pop(@words);
push(@words,@words[0]);
$line=join(" ",@words);
print $line,"\n";
}
Posted by: xxx (IP Logged)
Date: June 19, 2008 12:05PMcopy and paste the whole dang thing into excel/word/similar
and do a find/replace there
All we’re short of is someone trying to justify porting perl from C to C++ first to take advantage of it’s object oriented capabilities.
Eventually a solution is offered…
Posted by: xxxx xxxxxxxxx (IP Logged)
Date: June 19, 2008 12:46PM$ pbpaste | perl -ple ’s/^(\S+\s*)(.*?)\S+\s*$/$1$2$1/’ | pbcopy
Only to find that original customer spec was wrong…
Posted by: xxxxxx (IP Logged)
Date: June 19, 2008 12:54PMaaah, looking at the file, it’s more complicated than that.
It’s not the first word and it’s not the last word.
Then, too late, a solution is offered with test evidence that meets the new spec…
Posted by: xxxx (IP Logged)
Date: June 19, 2008 02:28PM$ cat foo
picture1.jpg blah WRONG.jpg
picture2.jpg blah blah WRONG.jpg
picture3.jpg blah blah blah WRONG.jpg
blah picture4.jpg any text in the middle you like WRONG.jpg blah$ sed ’s/\(picture[0-9]*.jpg\)\(.*\)\(WRONG.jpg$\)/\2\1/g’ < foo
blah picture1.jpg
blah blah picture2.jpg
blah blah blah picture3.jpg
blah any text in the middle you like picture4.jpg blah
But by now there’s been requirements creep…
Posted by: xxxxxx (IP Logged)
Date: June 19, 2008 02:52PMAlso need an href changing to a src
So recriminations start…
Posted by: xxxxx (IP Logged)
Date: June 19, 2008 02:57PMFucking geeks.
And finally an IT consultant is brought in to sort out the unholy mess in a manner that management can understand. This solution would also have the advantage of cutting company costs by allowing them to lay off home-grown engineers and award themselves bonuses all round…
Posted by: xxxx (IP Logged)
Date: June 19, 2008 06:44PM
I wouldn’t have used any of the methods above.
I would have emailed it to India and left it up to one of my guys over there.
That’s my bloody life right there.
* Yes, engineering. Full lifecycle, waterfall models etc etc, not hacked together**, 100% tested and certified. It had better be, it might be all that’s keeping your aeroplane flying. Scary huh?***
** If only you knew.
*** But not as scary as when you think that all our customers are like the one above.






![Validate my RSS feed [Valid RSS]](http://32sixteen.com/wp-content/themes/three_column/images/valid-rss.png)











del.icio.us
