- 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
I haven't programmed for .NET in some time. I thought this was C# but there are, apparently, some new things in the language with which I'm not familiar: e.g. return ((Stop ?? _now) - Start).Seconds;. Of great frustration when I began programming in C# is that the APIs were so vast, it was quite difficult to know (and more difficult to locate) what was actually out there for one to use. Granted, for time related stuff, some Googling would probably have cleared it up, but getting what you need from the API or MSDN: I haven't always found it simple to extract. It's like when I started down the UNIX path. I was frequently told, "All you need to do is 'man <command>'." Well, I didn't know that "man" was a command.
Admin
I really hope this was just copy and pasted from a class the actually used a stop date. If he came up with this first... well I hope he isn't there any more.
Admin
That "null" thing, btw -- it wouldn't be a problem at all if the guy had used the Null Object Pattern. Well, actually, it would, because in this case null doesn't just not mean null, it also doesn't mean "default behaviour." But a Null Object implementation might have been a good start. Of course, for everything else ... as so often in these cases, one has to ask: where and by whom was this code-reviewed?
Admin
why put all the logic in viewmodel?
Admin
You know the answer to that question, don't you?
Admin
man man
...Admin
this is only half of the code, the other half would be the non-open-ended events, where Stop would presumably not be null. The 'WTF's in this code are minor criticism. Bad article!
Admin
I am just wondering why the heck it needs the granularity of calculating down to the second. Minutes I can see - half hour seminar, or a quick break in a day-long schedule - but unless someone is up there with a stopwatch, seconds are a bit much. Doing it to the hour (and percentages therof) should be fine