Comment On Globally Fiscal Year

It's easier to teach a non-programmer to program in an object oriented language than it is to teach a Cobol programmer to do the same. That's my experience, and I think Clint would agree. He sent in this VB6 block that he inherited, developed by a self-proclaimed Cobol fanatic. There's not a lot code here, but nearly every line has something… special. [expand full text]
« PrevPage 1 | Page 2 | Page 3Next »

Re: Globally Fiscal Year

2012-08-20 08:05 • by Pacifisto (unregistered)
"For loops? Of course I know what loops are for!"

Re: Globally Fiscal Year

2012-08-20 08:08 • by Dennis (unregistered)
The WTF of the coder seems to be hiding inside the WTF of the language for me.

Re: Globally Fiscal Year

2012-08-20 08:08 • by Some Jerk
Cobal programmers give me gas... or... well... this one just did.

Re: Globally Fiscal Year

2012-08-20 08:15 • by Warren (unregistered)
But what happens if there's a June 31 one of those years? Huh?

Re: Globally Fiscal Year

2012-08-20 08:16 • by Accalia.de.Elementia (unregistered)
You know there is something special in your code when it includes a global variable named "stirfry"

Re: Globally Fiscal Year

2012-08-20 08:32 • by PedanticCurmudgeon
COBOL: 5 decades of giving dimwit programmers the illusion of competence.

Re: Globally Fiscal Year

2012-08-20 08:34 • by Ron (unregistered)
387597 in reply to 387594
I don't think that will be a problem very often. However, if the test date is either 6/30 or 7/1, then the answer will be wrong by as much as 20 years.

Re: Globally Fiscal Year

2012-08-20 08:35 • by Rodnas (unregistered)
TRWTF is global variables </facepalm>

Re: Globally Fiscal Year

2012-08-20 08:38 • by Ron (unregistered)
387599 in reply to 387597
Never mind. That boundary actually works okay.

Re: Globally Fiscal Year

2012-08-20 08:40 • by cobalistic (unregistered)
Even without object oriented programming, this programmer doesn't even understand the concept of data types. Also, he couldn't even give the function a clear name like strGetCurrentFiscalYear.

CAPTCHA: incassum

switch(myval)
{
incassum 1:
// do something here
break;
incassum 2:
// do something here
break;


}

Re: Globally Fiscal Year

2012-08-20 08:40 • by Ana (unregistered)
Dim nnnnoooo As Comment

Re: Globally Fiscal Year

2012-08-20 08:45 • by Smug Unix User (unregistered)
I call shenanigans. Real COBOL programmers only type in all caps.

Re: Globally Fiscal Year

2012-08-20 08:51 • by taixzo
This makes two Remy Porter articles in a row with no HTML comments. And that, my friends, is the real WTF.

Re: Globally Fiscal Year

2012-08-20 08:51 • by Bob (unregistered)
I don't get the COBOL reference. COBOL tends toward verbosity. Unless you're using the indicators...

I would have thought that regular WTF readers would have grown out of the "language x is bad" mentality. There are few bad languages but many bad programmers. There's little correlation between the two. Apart from PHP.

Re: Globally Fiscal Year

2012-08-20 08:52 • by Diego (unregistered)
387607 in reply to 387595
Accalia.de.Elementia:
You know there is something special in your code when it includes a global variable named "stirfry"


It's actually strFY, which I guess means str(ing)F(iscal)Y(ear). The thing I wonders is what value does date3 have, I can't see an assignment anywhere.

Re: Globally Fiscal Year

2012-08-20 08:54 • by Diego (unregistered)
387608 in reply to 387607
Diego:
Accalia.de.Elementia:
You know there is something special in your code when it includes a global variable named "stirfry"


It's actually strFY, which I guess means str(ing)F(iscal)Y(ear). The thing I wonders is what value does date3 have, I can't see an assignment anywhere.


I correct myself, I found the assignment for date3. I'm getting old, I get easily confused betwen date1, date2, date3 or n-nn-nnnn-nnnnnnnnnnnnnnnnn. At least he didn't name variables _, __ or ____...

Re: Globally Fiscal Year

2012-08-20 09:02 • by Some Jerk
Actually... it simply looks like novice code to me. It takes practice for a mind to refactor code so that it makes sense while creating it, and then experience to produce it with meaningfully named variables and such. This is the kind of thing that I would expect from a noob. I have trouble believing that his/her COBAL code was much better. This may be an example of someone who goes through the motions but clearly does not understand what they are doing.

Re: Globally Fiscal Year

2012-08-20 09:12 • by John Hensley (unregistered)
Dim ffffuuuu

Re: Globally Fiscal Year

2012-08-20 09:12 • by Zapp Brannigan (unregistered)
I've seen COBOL coders code in VB and this doesn't look very COBOL-like. The easiest way to tell is that some COBOLers have trouble with event oriented GUI. This programmer could just be a generic idiot.

Re: Globally Fiscal Year

2012-08-20 09:22 • by Steve The Cynic
387613 in reply to 387608
Diego:
Diego:
Accalia.de.Elementia:
You know there is something special in your code when it includes a global variable named "stirfry"


It's actually strFY, which I guess means str(ing)F(iscal)Y(ear). The thing I wonders is what value does date3 have, I can't see an assignment anywhere.


I correct myself, I found the assignment for date3. I'm getting old, I get easily confused betwen date1, date2, date3 or n-nn-nnnn-nnnnnnnnnnnnnnnnn. At least he didn't name variables _, __ or ____...

The confusion arises from the fact that date2 should be endOfPreviousFY and date3 should be startOfNextFY, which is what makes the < and > correct.

Well, perhaps that should be "less brutally incorrect"...

The worst, I think, is that the function returns an empty string or a NULL or something equally unsuitable if the year in PRF_strFY is before the year in strTest_Date.

Re: Globally Fiscal Year

2012-08-20 09:25 • by some dude in Europa (unregistered)
Once again it shows the stupidity of the American date format.

Re: Globally Fiscal Year

2012-08-20 09:27 • by the beholder (unregistered)
387615 in reply to 387609
Some Jerk:
Actually... it simply looks like novice code to me. It takes practice for a mind to refactor code so that it makes sense while creating it, and then experience to produce it with meaningfully named variables and such. This is the kind of thing that I would expect from a noob. I have trouble believing that his/her COBAL code was much better. This may be an example of someone who goes through the motions but clearly does not understand what they are doing.
Maybe, but isn't he supposed to have that practice and mainly experience? He's a freaking COBOL coder, FFS! Anybody who works on it is near or past his sixties and have been using it since his early or mid-twenties.

Re: Globally Fiscal Year

2012-08-20 09:37 • by radarbob (unregistered)
Its not COBOL the language, its the mind set. Once upon a time.... Coming into a shop that had moved the code base from UNISYS mainframe to PCs, I discovered our compiler supported COBOL 85 so I used the newer COBOL standard for a significant project. You should have seen the shock, yes, shock I say, on a couple of co-workers when they saw the code. No, it was not the "impressive, cool" kind, rather the "what the hell is this!" kind.

The mainframe is a very isolating environment, if you know what I mean. That and a managerial in-breeding program makes for a very deeply rutted coding shop. And there are very common, classic "forms" in COBOL due the the nature (and limitations) of the language and the task at hand - generally sequential processing of very large record sets.

Re: Globally Fiscal Year

2012-08-20 09:43 • by Mainframe Web Dev (unregistered)

This doesn't look like COBOL / CICS in any fashion.

I would expect a function to create a data structure and a separate function for moving data into that structure.

Or possibly, some bizare attempt of avoiding conditional statements since Cobol guys tend to write a log of JCL.

Or maybe an implementation of the PICTURE command to format a string.

Sorry, not seeing the COBOL influence here.

Re: Globally Fiscal Year

2012-08-20 09:44 • by PiisAWheeL
Dim n As Integer
Dim nn As Integer
Dim nnn As Integer
Dim nnnn As Integer

C'mon... Everyone knows you use x, y, z, and sometimes a as generic counters.

Re: Globally Fiscal Year

2012-08-20 09:49 • by Some Jerk
387620 in reply to 387615
the beholder:
Some Jerk:
Actually... it simply looks like novice code to me. It takes practice for a mind to refactor code so that it makes sense while creating it, and then experience to produce it with meaningfully named variables and such. This is the kind of thing that I would expect from a noob. I have trouble believing that his/her COBAL code was much better. This may be an example of someone who goes through the motions but clearly does not understand what they are doing.
Maybe, but isn't he supposed to have that practice and mainly experience? He's a freaking COBOL coder, FFS! Anybody who works on it is near or past his sixties and have been using it since his early or mid-twenties.


Not really. There were plenty of psuedo-geeks in the 80s using cobal for BBS systems and dial-in RPGs and such. You will find that there are plenty of COBAL hacks in their 30s and 40s, who likely bought all of them source code magazines and books so they could make their own game of snake and whatever else.

I guess the other explaination is that (s)he never actually understood coding to begin with... but instead learned specific patterns to use in specific situations, and his/her mind is too limited to produce something more elegant.

Re: Globally Fiscal Year

2012-08-20 09:57 • by Remy Porter
I used to do a lot of training. A big part of my job was teaching state employees, who had done COBOL for longer than I had been alive, to do Java, C++ and .NET (not all at the same time). It's not COBOL that's a problem, but COBOL programmers are built into their habits. The idea of modeling an application as a collection of things and not a collection of steps is a really hard thing to grasp if you have 30 years of practice working the other way.

Re: Globally Fiscal Year

2012-08-20 10:08 • by Accalia.de.Elementia (unregistered)
387622 in reply to 387608
Diego:
Diego:
Accalia.de.Elementia:
You know there is something special in your code when it includes a global variable named "stirfry"


It's actually strFY, which I guess means str(ing)F(iscal)Y(ear). The thing I wonders is what value does date3 have, I can't see an assignment anywhere.


I correct myself, I found the assignment for date3. I'm getting old, I get easily confused betwen date1, date2, date3 or n-nn-nnnn-nnnnnnnnnnnnnnnnn. At least he didn't name variables _, __ or ____...


strFY is the correct name, however i think stirfry nicely encapsulates the effect of code that relies on global variables like this on a developer's brain.

Re: Globally Fiscal Year

2012-08-20 10:53 • by Some Jerk (unregistered)
Why the OO red herring? It's not like there's an object oriented language in this story.

Re: Globally Fiscal Year

2012-08-20 10:58 • by ubersoldat
387626 in reply to 387606
Bob:
I would have thought that regular WTF readers would have grown out of the "language x is bad" mentality. There are few bad languages but many bad programmers. There's little correlation between the two. Apart from PHP.


+1!

Re: Globally Fiscal Year

2012-08-20 10:59 • by C-Octothorpe
387627 in reply to 387619
That's far too clear. For nested loops, you need to first start with i, then l, then j (for added job security).

Re: Globally Fiscal Year

2012-08-20 11:05 • by foxyshadis (unregistered)
387628 in reply to 387609
Some Jerk:
Actually... it simply looks like novice code to me. It takes practice for a mind to refactor code so that it makes sense while creating it, and then experience to produce it with meaningfully named variables and such. This is the kind of thing that I would expect from a noob. I have trouble believing that his/her COBAL code was much better. This may be an example of someone who goes through the motions but clearly does not understand what they are doing.

The Cabal is going to revoke your Code Card if you don't stop calling COBOL that.

Re: Globally Fiscal Year

2012-08-20 11:09 • by Clayton (unregistered)
387629 in reply to 387619
PiisAWheeL:
Dim n As Integer
Dim nn As Integer
Dim nnn As Integer
Dim nnnn As Integer

C'mon... Everyone knows you use x, y, z, and sometimes a as generic counters.


As a one-time COBOL programmer, my immediate fear upon seeing these was that they were carry-overs from part of the ENVIRONMENT DIVISION's WORKING-STORAGE SECTION. I'm a little sad (but mostly happy), to not see them shoehorned into a huge formatting mess.

if( year < 10 ) { n = year } else if( year < 100 ) { nn = year } ...


What a nightmare that would've been.

Re: Globally Fiscal Year

2012-08-20 11:10 • by Some Jerk
387630 in reply to 387628
foxyshadis:

The Cabal is going to revoke your Code Card if you don't stop calling COBOL that.


HE HE HE. Maybe if they give it a new name... people will start using it again :p

Spelling wasn't always listed among my strengths... but I am good enough with respect to consistency that it more or less offsets the problem.

Re: Globally Fiscal Year

2012-08-20 11:42 • by Zylon
387635 in reply to 387619
PiisAWheeL:
C'mon... Everyone knows you use x, y, z, and sometimes a as generic counters.

You are TRWTF.

Re: Globally Fiscal Year

2012-08-20 11:43 • by fa2k (unregistered)
It guarantees the ex-Cobol programmer some work in year PRF_strFY+21, when it starts returning NULL (or whatever the default return value in VB is)

Re: Globally Fiscal Year

2012-08-20 11:47 • by ByNagesh (unregistered)
I saw this code before at a presentation given by Nagesh in HyperaBad ... All US companies with outsourced IT now have code like this.

Soon, congress will change Fiscal year definitions (at the last moment, offcourse) because of problems with leap years

Re: Globally Fiscal Year

2012-08-20 11:52 • by sagaciter (unregistered)
387638 in reply to 387619
PiisAWheeL:
Dim n As Integer
Dim nn As Integer
Dim nnn As Integer
Dim nnnn As Integer

C'mon... Everyone knows you use x, y, z, and sometimes a as generic counters.

For counting loops I use the prefix LI (loop iterator) for clarity, i.e. lI1, lI2, ...

Re: Globally Fiscal Year

2012-08-20 11:53 • by RichP
387639 in reply to 387619
Um no, you use i, j, k and sometimes m as generic counters.

(cue religious war akin to camelCase versus name_with_underscore)

Re: Globally Fiscal Year

2012-08-20 12:03 • by dkallen (unregistered)
387640 in reply to 387619
PiisAWheeL:
Dim n As Integer
Dim nn As Integer
Dim nnn As Integer
Dim nnnn As Integer

C'mon... Everyone knows you use x, y, z, and sometimes a as generic counters.


I think you're confusing FORTRAN with COBOL. And doing it incorrectly.

Re: Globally Fiscal Year

2012-08-20 12:26 • by PiisAWheeL
387643 in reply to 387640
dkallen:
PiisAWheeL:
Dim n As Integer
Dim nn As Integer
Dim nnn As Integer
Dim nnnn As Integer

C'mon... Everyone knows you use x, y, z, and sometimes a as generic counters.


I think you're confusing FORTRAN with COBOL. And doing it incorrectly.
Fortran? Cobol? I make php alphabet soup with those variables.

Re: Globally Fiscal Year

2012-08-20 12:58 • by kbiel (unregistered)
Should have gotten the COBOL programmer a license for a .NET COBOL compiler, because VB.NET wasn't WTF enough for s/he/it.

Re: Globally Fiscal Year

2012-08-20 13:09 • by Some Jerk
387648 in reply to 387646
More EBiggotry ... eh?

'Get the current fiscal year ...

2012-08-20 13:35 • by Some Jerk (unregistered)
Double-click the pretty print code for lulz.

Re: Globally Fiscal Year

2012-08-20 13:59 • by Minos (unregistered)
n nnn, nnnn, hey hey hey, good bye!

Re: Globally Fiscal Year

2012-08-20 14:15 • by PedanticCurmudgeon
387657 in reply to 387638
sagaciter:
PiisAWheeL:
Dim n As Integer
Dim nn As Integer
Dim nnn As Integer
Dim nnnn As Integer

C'mon... Everyone knows you use x, y, z, and sometimes a as generic counters.

For counting loops I use the prefix LI (loop iterator) for clarity, i.e. lI1, lI2, ...
+1, very evil, but not very original.

Re: Globally Fiscal Year

2012-08-20 14:25 • by Nagesh
387658 in reply to 387596
PedanticCurmudgeon:
COBOL: 5 decades of giving dimwit programmers the illusion of competence.


Everyone know many big systems developed by big company like IBM still run on COBOL. COBOL: giving lot of business to developers in India.

Re: Globally Fiscal Year

2012-08-20 14:57 • by PedanticCurmudgeon (unregistered)
387660 in reply to 387658
Nagesh:
PedanticCurmudgeon:
COBOL: 5 decades of giving dimwit programmers the illusion of competence.


Everyone know many big systems developed by big company like IBM still run on COBOL. COBOL: giving lot of business to developers in India.


Your honor, I rest my case.

Re: Globally Fiscal Year

2012-08-20 15:06 • by Soviut
387661 in reply to 387606
Bob:
I would have thought that regular WTF readers would have grown out of the "language x is bad" mentality. There are few bad languages but many bad programmers. There's little correlation between the two. Apart from PHP.


It isn't a matter of one language being worse than another, it's a matter of a developer coming from one language and treating the new language like it's the old one. Coding python like it's C#, coding Ruby like it's Javascript, etc.

Re: Globally Fiscal Year

2012-08-20 15:09 • by Spewin Coffee (unregistered)
387662 in reply to 387606
TRWTF is your incredibly false assumption that PHP is a bad language and all programmers who write in PHP are writing bad code. I will agree with anyone that says that PHP makes it easy to write bad code because you can do the same thing about 25 different ways of which only two of those ways is correct. Although, the same can be said of C++ and other languages that hand you powerful tools to work with. In the hands of a novice, you get crap output for both of the languages I mentioned because it takes years to master which of the 25 different ways to accomplish a task is the correct approach.

There are many bad languages (APL, Prolog, LISP, COBOL, any assembly language, Ruby without Rails, etc.) and many bad programmers - the latter are what this site is dedicated to exposing to the world. Worse Than Fails happen any time you mix the two. If you think otherwise, you haven't been programming as long as I have. Interestingly, I can generally identify bad programmers a mile away by how poorly they use whitespace, where they place their comments, variable and function names, and the content of the comments. Basically, is the code elegant or not? That tells me more about their coding and personal habits (including hygiene) than anything else.

Your inane comment, Bob, indicates you might be a bad programmer. Or at least clueless.
« PrevPage 1 | Page 2 | Page 3Next »

Add Comment