|
Of course you two don't work together anymore.
This guy's a visionaire! You simply cannot understand the superior maths under this construction.
Kazz
"Users are there to click on things, not think. Let the archs do the damn thinking."
|
|
|
|
|
yvind Bratland wrote: We don't work together anymore
I bet that's a good thing
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
I just found this board, and just had to share...
A programmer had the job of writing a routine to perform calculations based upon fees over time (the detail's not important - essentially she needed to know the number of days between two dates, and apply an algorithm something like 'for the first 30 days, a fee of 10c per day, up to 45 days, 25c per day, from 46 through to 100 45c per day)
Now, there's 1001 ways to do it - but I couldn't believe that she produced a huge Cobol program to do it.
It contained a huge array of constants, called January1984, February1984 etc. etc. etc. wach one being the number of days in that month.
Then she had an
If FromDateMonth = "January" and FromDateYear = 1984
Subtract DateDay from January1984 Giving calcDays.
Else If FromDateMonth = "February" and FromDateYear = 1984
Subtract DateDay from February1984 Giving calcDays
etc.
etc.
for every month of every year for about ten years.
THEN she repeated the same set of If's for the end date.
THEN she repeated the same set of If's, in a loop, for each month in between!
I couldn't believe that any programmer could be quite so dumb! When asked, she just said she couldn't think of a better way of doing it! (Oh, it had taken her nearly two weeks to do - I had estimated a day, and allowed her a week, as she was new to the company, though not to Cobol)
And sure, I should have looked at the code before she got so far - but she wasn't a junior (and she never became a senior)
(Oh and excuse my code - it's been a long time since I did Cobol and can't really remmeber the syntax)
Take a chill pill, Daddy-o
.\\axxx
(That's an 'M')
|
|
|
|
|
maxxx# wrote: but she wasn't a junior (and she never became a senior)
I bet after that she was not even employed anymore, was she? :P
Regards.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
Rating helpfull answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
Nelek wrote: I bet after that she was not even employed anymore, was she?
Now she is the boss lover, I suppose.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I bet you she is not taking leap years into account.
|
|
|
|
|
Strangely enough she was!
Take a chill pill, Daddy-o
.\\axxx
(That's an 'M')
|
|
|
|
|
It is a good thing she did not try to take into account that years ending in hundreds area not, but thousands are. The control code would have been smaller, but the array would have had 12000 entries.
Silver member by constant and unflinching longevity.
|
|
|
|
|
I'm pretty sure that, given thetime, she would have!
And the actual calc is that 'century years' are leap years when divisble by 400 - so 2000 was, but 3000 isn't
Take a chill pill, Daddy-o
.\\axxx
(That's an 'M')
|
|
|
|
|
It does look like she was trying to be very through, so I am not suprised that she accounted for leap years. What this really points out is that it is not enough for a programmer to be able to write code that works; we also have to be able to come up with fast and efficient ways to solve problems.
Bill
|
|
|
|
|
maxxx# wrote: Oh and excuse my code - it's been a long time since I did Cobol and can't really remmeber the syntax
maxxx# wrote: It contained a huge array of constants, called January1984, February1984 etc. etc. etc.
Dont you mean: JAN84, FEB84 ?
|
|
|
|
|
Probably - though I seem to rememebr a 32 character limit on field names in Cobol - so could have been the full month name and year
Take a chill pill, Daddy-o
.\\axxx
(That's an 'M')
|
|
|
|
|
maxxx# wrote: Probably - though I seem to rememebr a 32 character limit on field names in Cobol - so could have been the full month name and year
I was just making a Y2K joke
|
|
|
|
|
Sorry - me being dense (or you just being too bloody clever!)
Take a chill pill, Daddy-o
.\\axxx
(That's an 'M')
|
|
|
|
|
|
Cobol is horrific anyways
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Here's a gem I found in some C++ legacy Windows code I am starting to have to maintain:
if (hWnd ? hWnd == pWndAppts->m_hWnd : pWndAppts)
pWndAppts->DeleteSelected();
else if(hWnd ? hWnd == pWndNotes->m_hWnd : pWndNotes)
pWndNotes->DeleteSelected();
pWndNotes and pWndAppts are class pointers (the exact specifics are unimportant). hWnd is, well, an HWND.
Note how nothing checks to be sure pWndNotes or pWndAppts are not NULL (until it is too late).
Someone obviously thought they were very clever.
|
|
|
|
|
Yuck.
Tom Delany wrote: Someone obviously thought they were very clever.
Maybe they were some intern trying to be a show off?
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Tom Delany wrote: Note how nothing checks to be sure pWndNotes or pWndAppts are not NULL (until it is too late)
Without knowing the code, their could be the situation that pWndNotes or pWndAppts cannot be NULL if hWnd is not NULL. The converse is not true, hence the extra check.
|
|
|
|
|
That might be possible. I still have not gotten familiar enough with the code myself to say for sure, yet. I still think it would not have killed them to use a few more lines of code and written it a bit less obtusely.
WE ARE DYSLEXIC OF BORG. Refutance is systile. Your a$$ will be laminated.
There are 10 kinds of people in the world: People who know binary and people who don't.
|
|
|
|
|
Tom Delany wrote: I still think it would not have killed them to use a few more lines of code and written it a bit less obtusely.
Probably.
|
|
|
|
|
Ok...well I can't post the screenshot...or tell why, but here it is...
While learning an inherited database schema for a suite of apps that we are taking over, I found a database diagram called Unrelated Tables containing sure enough, 22 unrelated tables.
I had to stop there.
|
|
|
|
|
while not the best practice I have several sets of unreleated tables, simply because there is no real way to relate them to anything, and they have over 400 million rows of data between them, and some other groups that are transactional and only related to each other for application performance reasons. I can search the 400 million+ rows in less than a second(on a 10 character compare no less, no or very few int compares), the old db server could do it in under a second and it was 4 or 5 years old.
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
I should have been more specific...in all the tables, there are a few records to a few thousand. They do relate to each other, but have no relationships setup.
|
|
|
|
|
thats better than a product we found...dozens if not hundreds of FK's many circuliar, and several per table(read 2 or 3 FK's to table b, which has several back to table a, along with various others..some are circular and involve 3 to 4 tables in a big loop), all on character keys. doing anything in that DB takes forever. importing 20k rows took 24 or so hours(run time), because of all the extra data that had to be created and integrity checks the server had to make.
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|