Bruce Garrett Cartoon
The Cartoon Gallery

A Coming Out Story
A Coming Out Story

My Photo Galleries
New and Improved!

Past Web Logs
The Story So Far archives

My Amazon.Com Wish List

My Myspace Profile

Bruce Garrett's Profile
Bruce Garrett's Facebook profile


Blogs I Read!
Alicublog

Wayne Besen

Beyond Ex-Gay
(A Survivor's Community)

Box Turtle Bulletin

Chrome Tuna

Daily Kos

Mike Daisy's Blog

The Disney Blog

Envisioning The American Dream

Eschaton

Ex-Gay Watch

Hullabaloo

Joe. My. God

Peterson Toscano

Progress City USA

Slacktivist

SLOG

Fear the wrath of Sparky!

Wil Wheaton



Gone But Not Forgotten

The Rittenhouse Review

Steve Gilliard's News Blog

Steve Gilliard's Blogspot Site



Great Cartoon Sites!

Howard Cruse Central

Tripping Over You
Tripping Over You

XKCD

Commando Cody Monthly

Scandinavia And The World

Dope Rider

The World Of Kirk Anderson

Ann Telnaes' Cartoon Site

Bors Blog

John K

Penny Arcade




Other News & Commentary

Lead Stories

Amtrak In The Heartland

Corridor Capital

Railway Age

Maryland Weather Blog

Foot's Forecast

All Facts & Opinions

Baltimore Crime

Cursor

HinesSight

Page One Q
(GLBT News)


Michelangelo Signorile

The Smirking Chimp

Talking Points Memo

Truth Wins Out

The Raw Story

Slashdot




International News & Views

BBC

NIS News Bulletin (Dutch)

Mexico Daily

The Local (Sweden)




News & Views from Germany

Spiegel Online

The Local

Deutsche Welle

Young Germany




Fun Stuff

It's not news. It's FARK

Plan 59

Pleasant Family Shopping

Discount Stores of the 60s

Retrospace

Photos of the Forgotten

Boom-Pop!

Comics With Problems

HMK Mystery Streams




Mercedes Love!

Mercedes-Benz USA

Mercedes-Benz TV

Mercedes-Benz Owners Club of America

MBCA - Greater Washington Section

BenzInsider

Mercedes-Benz Blog

BenzWorld Forum

November 24th, 2022

And Here I Thought You Were Just An Idiot. . .

A wee mystery solved recently, that had puzzled me off and on ever since I saw that bit of code back in my contractor days.

I was working the absolute worst contract job I ever had, at a local insurance company that had a reputation among contractors for being a brutally hostile workplace. I did not know about this until shortly before I left but it only took two days of working there before I was screaming at my handlers to get me the hell out of there.

I was there to track down and fix a bug in the report application they sent out to all their branch offices, that would randomly cause a blue screen of death. That happens in Windows when the operating system itself crashes and it takes a really serious problem for that to happen, because the operating system will catch most of the errors an application does not and close that misbehaving application down. The problem has to be really severe for it to percolate up the calling stack and take down the operating system.

So of course I needed access to their source code. But in the two week timespan I was there they never managed to get my network account set up or get me a workstation that I could log into in order to do my work. The manager there, when she wasn’t having shouting matches on the floor with the other managers about WE JUST HAD ALL THESE LAYOFFS AND YET NOW THEY’RE BRINGING IN ALL THESE EXPENSIVE CONTRACTORS!!!!!!!, would tell me scornfully I would just have to do my best. So I brought in my own laptop computer. But that didn’t give me access to the code I was supposed to be fixing. Somehow I managed to get one of the other developers to look kindly on me and make a print out of the code I was supposed to be fixing. 

I saw a potential source of the problem almost right away, and I’m proud now to be able to say I tracked down at least one of the blue screen causes (I’m pretty sure it wasn’t the only one). But that’s not what I want to talk about here.

The guy who wrote the code had taken a job elsewhere (couldn’t blame him). Supposedly he was a top level developer complete with a BS in computer science. Fine. Okay. Whatever. That only made the code I saw even more dumbfounding.

Never mind GlobalDummyInteger1, GlobalDummyInteger2, GlobalDummyInteger3, GlobalDummyInteger4, GlobalDummyString1, and so on and so forth. This made my jaw drop:

StringArrayForSomethingElse(1) = StringArrayForSomething(1)
StringArrayForSomethingElse(2) = StringArrayForSomething(2)
StringArrayForSomethingElse(3) = StringArrayForSomething(3)
StringArrayForSomethingElse(4) = StringArrayForSomething(4)
StringArrayForSomethingElse(5) = StringArrayForSomething(5)
StringArrayForSomethingElse(6) = StringArrayForSomething(6)

…and so on for 50 array elements. I must have stared at it for minutes. Then I thought…okay…some of the elements need to be treated differently for…some reason. So I walked down the entire fifty lines of code and they were all doing the same thing, copying the strings in one array to a different array one line of code, one array element at a time.

Understand…the above only takes a few lines of code if you use a For-Next loop…

For count = LBound(StringArrayForSomethingElse) To UBound(StringArrayForSomethingElse)

StringArrayForSomethingElse(count) = StringArrayForSomething(count)

Next count

It’s a loop. The first line initializes a counter and a maximum count based on the lower and upper bounds of the array. Let’s say it’s 1 to 50. It says basically do what follows, starting at the lower bound, and keep doing it for as long as the counter is less than or equal to the upper bound. The second line does the actual work of copying the array elements based on the value of the counter during that pass through the loop. 1…2…3…4…and so on. That last line increments the counter and throws it back to the first line. Every time the loop goes back to that first line the counter is evaluated again for is it less than or equal to the upper bound. At some point the third line is going to increment the counter (per my example) to 51, which is more than the upper bound and when the first line sees that’s its value the loop stops.

Simple. But even simpler if if they’re both dynamic (can have their length changed) arrays because then you can just copy one array to another with a single statement.

StringArrayForSomethingElse = StringArrayForSomething

The point being was pretty dumb to do it the way he did it, and if anything about the arrays changes then you have to go back through all fifty lines of code to fix it. I just could not believe a senior software developer with his bachelor’s degree wrote that code.

As the years passed I would occasionally think back to this and wonder about it. Then Elon Musk bought Twitter and went on a self absorbed rampage through it’s software engineers. And for the past week or so I’ve witnessed a lot of chatter about code reviews and performance metrics and suddenly it hit me: Management at this insurance company was measuring software developer productivity by how many lines of code their developers write per day

Or per pay period or whatever. So of course instead of using only a few lines of code to do a task, you use as many lines as possible. That is how you keep your job if that is how your job performance is being measured. And oh golly there are So Many Ways to take a simple line of code and break it out into dozens. If not hundreds. But then you’re just showing off.

It’s a really stupid metric, it almost makes software development look like piece work, but it seems many businesses use it, because management does not understand software development and maybe they need to focus on results and not micromanage the software maturity cycle. And yes, it results in bloated, buggy and hard to maintain code. At Space Telescope I had a project manager who would say negative productivity was a good thing. It was tongue in cheek but it had a serious meaning. Efficiently written code is easier to maintain and less prone to mistakes (bugs). Being able to take many lines of code and reduce them down to only as many lines as necessary is a good thing. Negative productivity.

I’ve no idea what sorts of metrics Musk is using to slash and burn Twitter, but I suspect it’s more of a knee jerk personal reaction to the developer and not their work. What we’re seeing in that foobar is something you often see throughout human history, that the legend is bigger than the man.

Leave a Reply

Visit The Woodward Class of '72 Reunion Website For Fun And Memories, WoodwardClassOf72.com


What I'm Currently Reading...




What I'm Currently Watching...




What I'm Currently Listening To...




Comic Book I've Read Recently...



web
stats

This page and all original content copyright © 2022 by Bruce Garrett. All rights reserved. Send questions, comments and hysterical outbursts to: bruce@brucegarrett.com

This blog is powered by WordPress and is hosted at Winters Web Works, who also did some custom design work (Thanks!). Some embedded content was created with the help of The Gimp. I proof with Google Chrome on either Windows, Linux or MacOS depending on which machine I happen to be running at the time.