Comment On Feng Shui

When Mike's manager asked if he'd like to take a stab at doing some maintenance on the Freight Calculator, naturally, he agreed. [expand full text]
« PrevPage 1 | Page 2 | Page 3Next »

Re: Feng Shui

2011-01-18 09:34 • by trwtf (unregistered)
Awww... it's purty!

Re: Feng Shui

2011-01-18 09:41 • by SCSimmons
It's sort of like a modern art sculpture carved out of dried cow manure. It looks kind of pretty there in the museum, but at the end of the day, it's really just a big pile of sh*t.

Re: Feng Shui

2011-01-18 09:47 • by Bill's Kid (unregistered)
If I'm not mistaken, this is the "Statue" programming pattern often taught at Easter Island Institute of Technology.

Re: Feng Shui

2011-01-18 09:49 • by baka0815 (unregistered)
Am I the only one seeing a beautiful lady leaning on a wall?

Re: Feng Shui

2011-01-18 09:50 • by George (unregistered)
Under the spreading B11CFee,
I soldU and you soldB.
There we lie and there EscB,
under the spreading R5Fee.

Re: Feng Shui

2011-01-18 09:51 • by Gary (unregistered)
It was an entry in the Obfuscated VBA contest. Which is why it is a slumping, flaccid mess.

Re: Feng Shui

2011-01-18 09:54 • by pinkduck
I like how only the last variable on each line is given an actual type, the rest just empty/uninitialised variants.

Re: Feng Shui

2011-01-18 09:57 • by szeryf (unregistered)
...and the algorithm for arranging the variable declarations in this way is NP-complete, mind you.

Re: Feng Shui

2011-01-18 10:01 • by Jason (unregistered)
334779 in reply to 334774
Isn't it supposed to be a vase?

Re: Feng Shui

2011-01-18 10:03 • by shotcircut (unregistered)
334780 in reply to 334776
Isn't all VBA?

Re: Feng Shui

2011-01-18 10:04 • by Another Anonymous (unregistered)
So this is what they mean when they say programming is an art?

(Also, this guy was obviously not paid per line.)

Re: As implied by the article

2011-01-18 10:08 • by frits
Poor Trent, may he rest in peace...

Re: Feng Shui

2011-01-18 10:08 • by Migala (unregistered)
ProsDirty1 StripTot
FER FedFee
EnID soldU StringID
GRat1

Re: Feng Shui

2011-01-18 10:09 • by Drum D.
Against the long spreading rumour that the universe is constantly expanding I have to tell you it is not.

What we see here - wonderfully carved in VBA - is the plotted extension data starting from the Big Bang up until the present day.

Time increasing top to bottom, size increasing left to right.

Re: Feng Shui

2011-01-18 10:09 • by trwtf (unregistered)
334785 in reply to 334780
Isn't it supposed to be a vase?

shotcircut:
Isn't all VBA?


No, some VBA is supposed to be two faces. And some is supposed to be a duck, and some is supposed to be a rabbit.

Re: Feng Shui

2011-01-18 10:16 • by Steve The Cynic
334786 in reply to 334785
trwtf:
Isn't it supposed to be a vase?

shotcircut:
Isn't all VBA?


No, some VBA is supposed to be two faces. And some is supposed to be a duck, and some is supposed to be a rabbit.

No quack.

Re: Feng Shui

2011-01-18 10:16 • by Iron fisted bit flipper (unregistered)
This technique takes software craftsmanship to a whole new level.

Re: Feng Shui

2011-01-18 10:17 • by Doozerboy (unregistered)
My first programming gig was much the same.

All the code in one module, took 15 minutes to open, all controls on the forms called checkbox12, checkbox15 etc etc. The front end alone was a mammoth 1/2 GB as the developer hadn't bothered to split his UI from his data.

Fortunately i had a sympathetic boss who let me bin it and start again from scratch.

Re: Feng Shui

2011-01-18 10:19 • by Doozerboy (unregistered)
334789 in reply to 334774
baka0815:
Am I the only one seeing a beautiful lady leaning on a wall?


If it is, she's only thinking about the money.

Re: Feng Shui

2011-01-18 10:19 • by Trent (unregistered)
God dang it...you are displaying my art sideways again!

Re: Feng Shui

2011-01-18 10:19 • by Cad Delworth
It sort of resembles a 90-degree rotated graph of something. Perhaps of the developer's likelihood of leaving that company to work elsewhere?

Also, good point Feng made about no Type on most variables! Obviously I've been writing far too much Delphi/Javascript lately! Maybe the guy only wrote Windows Script rather than VBA, and assumed 'they'll be the same...'?

Re: Feng Shui

2011-01-18 10:20 • by Bobbo (unregistered)
334792 in reply to 334786
Steve The Cynic:

No quack.


I think somebody has already had plenty of quack.

Re: Feng Shui

2011-01-18 10:22 • by da Doctah
The variables were often given incoherent and inconsistent names, and in many cases, vowels were dropped from names where they should have belonged. Maybe he felt that by not using vowels it would be a cost savings for the company Mike chuckled to himself


Didn't anyone ever tell Mike? If you don't move your vowels, you get consonated.

Re: Feng Shui

2011-01-18 10:25 • by My name (unregistered)
Sort the lines by length, damnit!

Public AT1 As Long

Public GetB As Long
Public PradPs As Long
Public Geta1ID As Long
Public StringID As Long
Public ProformID As Long
Public CreatedID1 As Long
Public TickerTal1s As Long
Public InvalidCount As Long
Public PrmID, ImptID As Long
Public EnID, InvaldID As Long
Public RdID, RefundedID As Long
Public OffWeightedSum As Currency
Public B11CFee, PortFee As Currency
Public RSDPctAr, FoldPct As Currency
Public DS1, DS2, DS3, AS4 As Currency
Public InvldMet, FER, AS1 As Currency
Public RevUpPct, RvUpPost As Currency
Public RV1, RV2, RV3, BSS4 As Currency
Public FFF, NCF1, BB1, B1A As Currency
Public EscA, EscB, InvaldT As Currency
Public RSDFee, FedFee, R5Fee As Currency
Public StripTot, StripTotalPct As Currency
Public ValPrt, PretextVar, G1, R1 As Currency
Public PartAff12, affixedMost, GRat1 As Currency
Public ProsDirty1, ProcSpl, CartSplit1 As Currency
Public PC5A, PC3A, PC4A, P3B1, PCU, PCR As Currency
Public DC5, DC3, DgCA, DcM, DCB, DCU, DCR As Currency
Public RftUpPct1, RftUpPosted1, RftUpPat2 As Currency
Public rptAffordeD, raptCapped, rptPostand As Currency
Public B5DP, B3DP, BMAP, BARP, BUPP, BREP1 As Currency
Public GtQ5, GtQ3, GTQA, GTQM1, GTQB1, GQU As Currency
Public Var1, Var2, Var3A, VarM1, VarU4, VAR As Currency
Public Save2S, Save3A, Save4A, Save5A, Save12 As Currency
Public Gubr2, GUBR1, GubrA, GubrB, GubrC, GubrU As Currency
Public PercentB, Percent35U, PercentU, PercentR As Currency
Public PercentF, PercentD, PercentRSD, PcentD1H As Currency
Public Prod7Sum, ProdBBSum, ProdAM1Sum, ProdBSum As Currency
Public PercentJS, PercentJ7, PercentJ5, PercentJ1 As Currency
Public Disr1A, DISR3A, Disr5, DisrB, DiscrA, Disr6 As Currency
Public ProdRLSum, ProdRSum, ProdRSDSum, ProdR06Sum As Currency
Public ProdR, ProdM, ProdN, ProdFD, ProdRSD, ProdD1H As Currency
Public ProdP, ProdPSum, ProdRSum, ProdTSum, ProdFSum As Currency
Public Port1, Port3, PostA, PostB, Post2, Post3, PostD As Currency
Public Prod2, Prod1, Prod3, ProdH, ProdE, ProdB, ProdQ As Currency
Public PosandAllowd, PosandStopd, PortandDue, Serv1scart As Currency
Public Port6Sum, Port9Sum, PortB4Sum, PortHSum, PortHSum As Currency
Public soldG, Sold12, soldB, SoldX, SoldY, soldZ, sold44 As Currency
Public Disc7Sum, Disc8Sum, DiscB4Sum, DiscUJSum, SaveWSum As Currency
Public rptPrt4, rptPrt6, rptPrtJ1, rptPrtI, rptPortB, rptP As Currency
Public soldU, soldPU, SoldH, SoldI, SoldJ, SoldN, SoldF, soldUP As Currency
Public SoldRAS, SoldR11, SoldR12, SoldR13, SoldD1, SoldD2, SoldSP, SoldPC As Currency

Re: Feng Shui

2011-01-18 10:25 • by Iie (unregistered)
334795 in reply to 334773
Bill's Kid:
If I'm not mistaken, this is the "Statue" programming pattern often taught at Easter Island Institute of Technology.


Hit CTRL+A and it will shoot lasers out its eyes.

Re: Feng Shui

2011-01-18 10:26 • by TheSHEEEP (unregistered)
"Gubr2, GUBR1, GubrA, GubrB, GubrC, GubrU"

Hey, that's Obelix!
Gubr Gubr Gubr Gubr!

Re: Feng Shui

2011-01-18 10:27 • by boog
Actually, this is beautiful from a maintenance perspective. Now Mike has a list of all of the global variables to use in his find-and-replace.

Re: Feng Shui

2011-01-18 10:29 • by TheSHEEEP (unregistered)
"Gubr2, GUBR1, GubrA, GubrB, GubrC, GubrU"

Hey, that's Obelix!

Re: Feng Shui

2011-01-18 10:32 • by Vilx- (unregistered)
It's like a christmas tree!

Re: Feng Shui

2011-01-18 10:32 • by blah (unregistered)
334800 in reply to 334777
pinkduck:
I like how only the last variable on each line is given an actual type, the rest just empty/uninitialised variants.


Really? Yuck. So glad I've had so little exposure to VB/VBA.

Re: Feng Shui

2011-01-18 10:35 • by TheCPUWizard
334801 in reply to 334774
Does anyone remember a poster from a computer software company in the mid-1980's where the backdrop looked like a "misty mountain range", but upon closer examination was a reclining naked woman????

If anyone knows of a reproduction (or even better has an original!!!) please contact me directly.

Re: Feng Shui

2011-01-18 10:43 • by boog
334802 in reply to 334791
Cad Delworth:
It sort of resembles a 90-degree rotated graph of something. Perhaps of the developer's likelihood of leaving that company to work elsewhere?

I was going to suggest the same thing; it's the developer's intent to resign as a function of time. That makes me wonder what the valleys (around InvldMet, RftUpPct1, and PercentB) must mean. Maybe they represent weekends?

Re: Feng Shui

2011-01-18 10:54 • by SCSimmons
334803 in reply to 334800
blah:
pinkduck:
I like how only the last variable on each line is given an actual type, the rest just empty/uninitialised variants.

Really? Yuck. So glad I've had so little exposure to VB/VBA.

Wow. I've had way too much exposure to VBA, and I was not aware of that. (Although I'm pretty sure that I've always declared one variable per line, so it wouldn't have come up in my code.) But I checked the documentation, and blah is absolutely right--the VBA compiler really does interpret those declarations that way. You need to put an 'As Long' or whatever after each variable name--as this code is written, most of the variables are untyped variants.

But I suppose explicitly writing all of the declarations would have interrupted the aesthetic flow of the code.

Re: Feng Shui

2011-01-18 11:00 • by dpm
334804 in reply to 334803
Someone help me out here, I can't find Waldo.

Re: Feng Shui

2011-01-18 11:01 • by Grumpy (unregistered)
334805 in reply to 334774
baka0815:
Am I the only one seeing a beautiful lady leaning on a wall?

Yes. Yes, you are. Please get adult supervision.

Re: Feng Shui

2011-01-18 11:01 • by frits
334806 in reply to 334774
baka0815:
Am I the only one seeing a beautiful lady leaning on a wall?


All I see is a haggard old lady.

Re: Feng Shui

2011-01-18 11:10 • by trwtf (unregistered)
334807 in reply to 334806
frits:
baka0815:
Am I the only one seeing a beautiful lady leaning on a wall?


All I see is a haggard old lady.


I don't see what Merle Haggard's old lady has to do with any of this.

Re: Feng Shui

2011-01-18 11:12 • by Lewis (unregistered)
Twas brillig, and the soldZ TickerTal1s,
Did Geta1ID and GubrU in the wabe:
All Post3 were the PosandAllowd,
And the RftUpPat2 GubrA

Re: Feng Shui

2011-01-18 11:15 • by Anonymous (unregistered)
*now reformatting my current project source code*

Re: Feng Shui

2011-01-18 11:24 • by Anonymous (unregistered)
I always try to arrange variable declarations by line length. We're talking about a handful of function-level declarations rather than a stinking mess of globals, but I always find myself putting them into some kind of natural order and it's normally by length (sometimes alphabetical if that looks more asthetically pleasing). It's not a code thing since every book I own is arranged in height order as well. If I washed a bit more often I would highly suspect OCD but as it stands I'm probably just time-wasting.

Not a WTF.

2011-01-18 11:33 • by Mike (unregistered)
It's all about using the right tool for the job. In this case, they used a lathe.

Re: Feng Shui

2011-01-18 11:38 • by Patrick (unregistered)
It looks like Rageface side-on

Re: Feng Shui

2011-01-18 11:53 • by The Configurator (unregistered)
More like a fright calculator...

Re: Feng Shui

2011-01-18 12:01 • by Jaime
334816 in reply to 334803
SCSimmons:
blah:
pinkduck:
I like how only the last variable on each line is given an actual type, the rest just empty/uninitialised variants.

Really? Yuck. So glad I've had so little exposure to VB/VBA.

Wow. I've had way too much exposure to VBA, and I was not aware of that. (Although I'm pretty sure that I've always declared one variable per line, so it wouldn't have come up in my code.) But I checked the documentation, and blah is absolutely right--the VBA compiler really does interpret those declarations that way. You need to put an 'As Long' or whatever after each variable name--as this code is written, most of the variables are untyped variants.

But I suppose explicitly writing all of the declarations would have interrupted the aesthetic flow of the code.
Interestingly, the declarations would work properly in VB.Net. Usually people who make these atrocoties are way behind in technology, but this guy seems to be ahead of himself.

Re: Feng Shui

2011-01-18 12:19 • by Jay (unregistered)
334818 in reply to 334810
Anonymous:
I always try to arrange variable declarations by line length. ... I would highly suspect OCD but as it stands I'm probably just time-wasting.


You mean CDO. You should put the letters in alphabetical order like they belong.

Re: Feng Shui

2011-01-18 12:21 • by NutDriverLefty (unregistered)
334819 in reply to 334797
boog:
Now Mike has a list of all of the global variables to use in his find-and-replace.


I bet he doesn't!

Re: Feng Shui

2011-01-18 12:21 • by Jay (unregistered)
I can see how this program would be difficult to maintain. Every time you create a new variable, not only do you have to come up with a name that concisely expresses the semantic purpose of the variable within the program, but you also have to make sure that the length of the name will fit properly with the aesthetic layout of the declaration list.

Re:

2011-01-18 12:47 • by Dr.Evil (unregistered)
I see it, it's a sailboat!

Re: Feng Shui

2011-01-18 12:59 • by bikeoid
Now we know how the Easter Island statues came to be...an ancient alien civilization programming in VB noticed this beautiful pattern in their global variables and decided to memorialize them in stone.

Re: Feng Shui

2011-01-18 13:07 • by sprezzatura
Actually, this could be a fun project, especially if it looks like you will be stuck with maintaining the Freight Calculator for the rest of your time at this company.

The goal would be to gradually eliminate as many global variables as possible, by replacing them with parameters that are passed from one function to the next (assuming this system has more than one function).

Start by picking a variable, seeing where it is used, then declare it as a local at the highest level of the stack, and change the function call(s) to pass it as an argument to the functions.

Little by little, you will transform the globals into locals, creating order and beauty in this labyrinth. Imagine the satisfaction and sense of accomplishment. In the process you will develop an understanding of the app, and add documentation throughout the code. Discover the beauty in the humblest of things.
« PrevPage 1 | Page 2 | Page 3Next »

Add Comment