- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
His boss will be regretting that reply when inflation jumps so high that gass is 85 trillion dollars a gallon!
Admin
Cardinal rule II: Don't CC the bosses on this type of dialogue.
Admin
Doesn't "State" refer to status? I.E. Act = Active vice one of the United States. And doesn't this indicate the bosses boss doesn't have a clue?
Admin
He shoud send that mail to lead developer or someone higher who woud be smart enough.
Admin
Ahh...to once again have a boss who knows when to call bullsh*t. Those were good days.
Admin
Admin
The three letter codes are Australian states (Australian Capital Territory, New South Wales, QueensLanD.
Admin
Admin
Buzzer
Sorry, you lose... to get an order of octillion dollars down to 922 trillion dollars, you need to discount it by (almost) an octillion dollars, not merely by a sextillion dollars.
Admin
I've seen stuff like this before - people realising that the world doesn't rotate around the USA - where the 'state' column in addresses are relaxed to include provinces of Canada and abbreviated regions and counties of other countries.
Maybe the junior developer might have been correct in this - the tax calculation might have been flexible to be used for countries other than the US?
I'm sure the senior developer is correct in that the US isn't planning to annex another state quite this minute :-)
Admin
They are both wrong. All money calculations in SQL Server should be done using the money datatypes. These are specifically designed for guess what? Money! They are special fixed precision (4 decimal) place variables that do not loose precision as the number becomes larger. By using the money dataypes, you eliminate many of rounding and precision problems.
Admin
I like the boss - I want to work for him!
Admin
I can't believe nobody has mentioned it yet: The problem here seems to be that Chareth is one of those primadonna developers who think they know better than everybody else in the company, including (especially) those who have been there for many years. Now, I've worked for my fair share of morons who couldn't code their way out of a wet paper bag despite being "VP of Software Development" or some such grandiose title, but in this story the WTF is clearly with a junior programmer who thinks that he's hot stuff, even when he's not.
Admin
Bryan that might be fine except not everyone in the world uses Microshaft abominations.
Admin
Wait...what's Canada, then? A foreign country?!
Admin
Those are Australian states.
Admin
Depending on the DBMS, defining such enormous datatypes can take up significant space (at least on numerics). Based on his comments of insane scale, it might be worth it.
And, to Chareth's point, how does he know the corp won't expand into Australia or Mexico (do they have abbreviations for their states?)????
Admin
Admin
Canadian Provinces use two letter abbreviations too (AlBerta, British Columbia, QuebeC...). They and the US also share the North American (telephone)Numbering Plan. I guess Mexico diverged from NANP as they don't have the same system but it appears they did at one point (hence the name and similarity).
BTW, Japan has the most wordy addresses (when spelled with Roman letters, of course).
Admin
What about IQ and IN?
Admin
The 51st state.
Admin
Then they would have to deal with other countries' state/provincial tax laws, along with their (if any) federal tax laws. 50 state & federal tax laws is enough to deal with! Damnit Jim he's just a junior developer!
Admin
Exception is Quebec, from within which Canada is an oppressive federation that has wrongfully annexed the proud and sovereign state of Quebec.
Oh, and for the record, Canada has perfectly good two-letter abbreviations for all of its 13 provinces and territories.
Admin
Actually, I think the Jr. Programmer may have had a point in his arguments. He didn't come up with these precisions out-of-the-blue, he was comparing this to existing objects in the database. I believe he was pointing out inconsistencies. Why would you make a State field 10 characters in one place and 2 in another? That is asking for trouble in my book!
Admin
What they didn't tell me about was the range of allowable characters that the auto-state-name-generation function was designed to use... all printable ASCII characters!
It sounded reasonable until the auto-state-name-generation function eventually created new state codes like backslash-dot and dot-star, and then the value from the state column got parsed with a regex - it made for some interesting debugging sessions.
Admin
as far as I understand he tried to have the same precision in the application as in the database. whats so wrong about that??
Admin
The US does have 3-letter states. If you're in the military, you use a special 3-letter state code in place of your actual location. The post office is equipped to handle this, and so should every website.
Admin
Possible new states:
IQ - Iraq IR - Iran
Admin
Admin
Admin
The first critique sounds actually valid: some parts of the world use three-letter abbreviations for states, like Australia (Australian capital territory=ACT, New South Wales=NSW, Queensland = QLD). If the company has a record of dealings with clients in Australia, then it's reasonable to want a three-letter state.
But yeah, the rest of it is stupid.
Admin
Btw, three-letter states? I have heard of four-letter states like Ohio and Iowa. Not heard of any three-letter states...
Admin
I'd probably stand by him on the state portion, but I can see that the likelihood of any dollar amount larger than what would fit in a "money" datatype is very small. Still, his point on matching datatypes is semi-valid and could at least have been discussed prior to getting to this stage.
Admin
Admin
I have to agree with you on this. Seems like one of those losers that when he doesn't get his way he CC's somebody. I hate those fuckers. As if CCing my boss is gonna make things change in your favor. I hate the CC game.
Things aren't always perfect, sometimes there will be some "waste" in the corporate world, you don't always get your way so get used to it, stop being a whiny bitch and deal. This guy acts as if the company is going to crumble because it uses a little extra space on the DB.
Admin
No, the state code for military addresses is still two letters. For example, an address at Kunsan Air Base in Korea would have a "state" of AP and zip code of 96264.
What you're thinking of is the "city", which in my example would be APO.
But you are correct that websites need to accomodate for this. I had to contact customer support a few time while I was there because a company's website only listed the 50 states that they know of, plus DC in the drop down.
Admin
See comment from "snoofle" above. When you start going International, you have changes to make that get really hairy to map into a char(2) column. If you'll always be a US-only company, that's not a big deal, but once you step outside of the US, you're going to have some changes to make or deal with some really odd mappings.
Admin
IN is INdiana... IA is IowA. That leaves IR. (AF and NK are also available.)
Admin
The database already had 3-character values in it. Trying to squeeze input into 2 characters sounds like a guaranteed break. TRWTF is using different data types/lengths for the same values in different places.
Admin
So was Yuriy's implementation actually simpler?
I'm a bit rusty in SQL procs but was far as I can remember all of the issues Chareth pointed out would not increase the code complexity at all?
Admin
I'm with Chareth on point (1). He says there are 3-letter states in the existing data, i.e. there are customers already in the database who live in the 3-letter Australian states he gives as examples. Yuriy's char[2] solution won't work for them.
Admin
It just sounds like they don't sell outside of the US, which is pretty common among smaller retail companies.
Admin
Indiana is already a state.
Admin
Why are they using datatypes in the stored procedure that differ from the columns in the database? Best practices dictate that you use the same datatype using the following construct:
.<column>%TYPEThat way, if something weird happens and the column type changes in the table, it won't hose all your stored procedures.
Admin
Sounds like the existing data has customers from Australia in it. QLD-Queensland, NSW-New South Wales, etc.
As for the money fields, common sense is never quite common, is it?
Admin
HONK Wrong!
US does have 3-letter places. The different armies.
The address for one of my friend is (replacing identifying info with clearly invalid values)
ABC (DE) Homer J Simpson ABC-123 Unit 45678 FPO AP 96601-1234
In our case, the code is FPO instead of CA for California...
So I guess that boss doesn't want to handle marines. Such a jerk.
Admin
If Chareth wants to stop getting stabbed in the heart with an exploding salty lemon dagger, he's going to have to quickly learn to stop "getting people in trouble" via CC, especially his boss.
Admin
Admin
Admin
Hang on everyone
I think I'm pretty much with Chareth here
The database already has data with the 'big' fields. The database stores states in a 10 character field (and already has data > 2 characters in it), and it stores 'subtotal' as NUMERIC (28,12)
So, since the database ALREADY stores the data in the 'big' form, the complaint that it would use too much space for the stored procedure to use that form is pretty specious. It isn't Chareth who has designed the database to store fields that are unnecessarily big, those were there before!
When writing a stored procedure to use data from the database and process it, surely you MUST be able to handle any data which could be in the database.
The boss has obviously ignored the point that there are already 3 character entries in the database. Reading them into a 2 character variable will break things because it'll be truncated and then misinterpreted. This is definitely a big flaw in Yuriy's version of the SP.
The boss (and Alex) have also ignored the fact that you can't store numbers up to an octillion in a NUMERIC(28,12) field. That is 16 digits before the decimal and 12 after. So, you can 'only' store up to 10 quadrillion. Quite probably it would be OK to use 64 bit fixed point maths on this, as they were going to throw away 8 decimal digits, and ignore the very high numbers at the top which would fit in the NUMERIC field but not the 64 bit number, but in that case, why store data which will be ignored. Surely NUMERIC(15,4) would be the correct data type to use in the database, if that's the only data you're going to use).
(At the very least, the SP should read the NUMERIC(28,12) and raise an exception if it would overflow the 64 bit variable).
(BTW, maybe Chareth's extra complexity was that Yuriy was using 64 bit integers to do the maths, whereas Chareth needed a 'big number' library to do it properly. I'm not sure how using a 2 character state abbreviation instead of doing that properly would help).
To me it sounds like the boss doesn't really know what he's doing, but is putting down the 'newbie' despite him having some good points.