|
Reminds me of why i started using parameters for Dates and Decimal values in SQL.
LONG LIVE PARAMETERS
Paulo Gomes
Over and Out
|
|
|
|
|
|
Like a few others have stated.
I prefer yyyy-mm-dd.
Another advantage is that it sorts correctly as a string.
|
|
|
|
|
That sounds like exactly the sort of bug which would be preempted by a good set of unit tests.
Test Driven Development takes some time to get used to doing, but it definitely works.
Anna
Tech Blog | Visual Lint
"Why would anyone prefer to wield a weapon that takes both hands at once, when they could use a lighter (and obviously superior) weapon that allows you to wield multiple ones at a time, and thus supports multi-paradigm carnage?"
|
|
|
|
|
Shame on you, and your tester too.
We should follow the system when using date and time. The display format is only for presentation. If your code is going to send data all over the world, what is the right format?
|
|
|
|
|
Eugene Peng wrote: what is the right format? For an established receiver of data, the right format is the receiver's format.
Shame on the receiver if they didn't supply the format to begin with.
Testers exist because it is a known problem that coders write bugs. It is the tester's responsibility to assume the programmer screwed up and find out where (s)he did.
The fact the test period was only one day puts nearly all the fault at the tester's feet. (s)he didn't even have time to build a valid case model for testing.
You as a coder have a right to slap your own head, say "What an idiot", and fix the bug.
Reminds me of a bug I created. Wrote an app to clean up a table by truncating it when it is a week old. Supposed to run 5 minutes before midnight. So I scheduled it to do so. Forgot the date was UTC. Should have scheduled the job to run at 3:55 PM and coded the logic to sleep until the UTC time was reached. (UTC is 7 to 8 hours ahead of my local time.)
The tester caught it on my last day of work. Over a year later, I'm reading proposed changes another group was making. My former group. They were adjusting job schedules to be based on UTC time and offsetting the start time based the former time setting because the app was moving to a different time zone.
I had to explain to the head SQL person there is a bug written against the app, he needed to set the UTC time to run at 22:55 UTC instead of 07:55 UTC, it will run 5 minutes to 2 hours early depending on when the scheduling job code runs and the code needs to be modified to wait until 5 minutes before UTC Midnight to run.
Everyone makes mistakes. Checking for valid date information being passed is 101 testing. (It is the programmer's job to do 101 testing as well as the tester's job to not believe (s)he did anything right.)
|
|
|
|
|
First shame on you. When transfer any data over the wire, you should it do it in a system independent format. When for some reason it is impossible to do that, you should take system differences in account. That is: verify what differences there are and (unit)test you're code against the whole valid range and handle invalid data.
Shame on the tester to, he also should be aware of difficulties in the domain he is testing.
But most of all shame on you. A developer never can hide behind the the tester (or even the architect). He has it's own responsibility to make the software work, without errors.
modified 7-May-12 12:55pm.
|
|
|
|
|
My vote is for the tester. You're a programmer, you're expected to screw up.
The tester passed your code in one day. You might have 100 more bugs lurking in your code. (Which could still be true after 100 days of testing.)
Just think about sending yy-mm-dd, your code could still be humming along fine for 19 years. (I'm guessing someone might eventually notice the dates don't match/make sense.)
|
|
|
|
|
Function SetDate(ByVal nYear As Long, ByVal nMonth As Long, ByVal nDay As Long, ByVal nHour As Long, ByVal nMinute As Long, ByVal nSecond As Long) As Date
Dim dTemp2 As New Date(nYear, nMonth, nDay, nHour, nMinute, nSecond)
Return dTemp2
End Function
really?
This is probably one of the best things this guy has done so far. I was advised not to put his code on this forum though. This one I just couldn't help.
If it moves, compile it
|
|
|
|
|
Issues I found:
1. It doesn't even set anything
2. It uses Long (Int64) while the constructor takes Integer (Int32)
3. Declares a temporary variable to be returned the next line
4. Why is it dTemp2?
My way (I will keep the same name, mainly because I can't think of any other):
Function SetDate(ByVal nYear As Int32, ByVal nMonth As Int32, ByVal nDay As Int32, ByVal nHour As Int32, ByVal nMinute As Int32, ByVal nSecond As Int32) As Date
Return New Date(nYear, nMonth, nDay, nHour, nMinute, nSecond)
End Function
All of the books in the world contain no more information than is broadcast as video in a single large American city in a single year. Not all bits have equal value.
Carl Sagan
|
|
|
|
|
His calls to this function are to set a date variable = function call. He literally used this function for nothing. My solution was :
myVariableName = new Date(..yada..yada..yada...)
Zac Greve wrote: It uses Long
Every numeric variable he declaired in the entire project was a long.
If it moves, compile it
|
|
|
|
|
I'd rather that then the people who use strings for everything...*shudder*
|
|
|
|
|
GibbleCH wrote: *shudder*
Shiver, shake, and convulse!
All of the books in the world contain no more information than is broadcast as video in a single large American city in a single year. Not all bits have equal value.
Carl Sagan
|
|
|
|
|
Well, at least he wasn't stringing you along.
GROAN!
All of the books in the world contain no more information than is broadcast as video in a single large American city in a single year. Not all bits have equal value.
Carl Sagan
|
|
|
|
|
It seems to me that you are turning regular expressions into puns for amusement.
If it moves, compile it
|
|
|
|
|
I am just trying to move this thread along, but it seems that it is not synchronizing.
All of the books in the world contain no more information than is broadcast as video in a single large American city in a single year. Not all bits have equal value.
Carl Sagan
|
|
|
|
|
I'm starting to see a pattern emerge here.
If it moves, compile it
|
|
|
|
|
It's obvious this guy added the SetDate implementation to a class that implements the IDateRepository in order to facilitate dependency injection and the factory pattern! All the better I say. Should minimize the impact of the Y3K bug and enable unit testing of date functionality against realistic data.
|
|
|
|
|
Let me guess: that guy used to work with VB6, and now he ports many "useful" functions from his year-long experience to VB.NET.
|
|
|
|
|
Yes. He fought using .net in the first place, would not attempt to learn c#, and forces everything to work as if it were still vb6.
If it moves, compile it
|
|
|
|
|
Fire him! No Luddites allowed!!!
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair.
nils illegitimus carborundum
me, me, me
|
|
|
|
|
When i was beggining to make some programs i had to make a small ellectronic book in c++. It started ok, i managed to make a reader and an editor and then came the worst error a programmer can have. When I compiled the program it went smoothly but when i openned it from windows it showed and internal error message whit no message. I suspected it was an I/O error because when i copied the program to c: or d: didnt showed the error but when i placed in other folder that wasnt the root it showed the error message
|
|
|
|
|
the ide was c++ builder 6
|
|
|
|
|
Not really a C++ myself but I was under the impression Borland Builders were one the best.
I was under the impression that the Microsoft versions were created and then Microsoft created the standards to fit, my experience of VC++ is you type a quick test program spend an age trying to figure out why it wont compile, get fed up use Builder6 load the code press F9 away you go!
|
|
|
|
|
If it's Builder 6 turn on CodeGuard. Run the application and then look at the code guard log. There's a decent chance it will just tell you what's wrong. It could be as simple as an assumption about paths and/or permissions. It could even be an issue of finding DLL's
|
|
|
|