Tuesday, February 27, 2007

Professional Software Developer

There are a lot of ways to improve yourself as a software developer. Things such as McConnell's Professional Software Development to reading code samples at CodeProject.com. Ultimately it probably boils down to what goal you have when you say that you want to improver yourself as a software developer.

More and more, I find that when I say that, I'm not talking about learning a new programming language or how to do something fancier in one of the languages I already know. When I say that, I mean: "How can I learn to better solve the problems I face."

To me, being a developer is less about cranking out code as it is creating a solution to a problem.

And I think this is a failure of the 'programming' degrees that colleges are producing. They stress programming mechanics of solving problems. The stress syntax over learning how to figure out just which problem needs to be solved.

Right now, other programming blogs are discussing asking programmers "fizzbuzz" or simple coding questions during interviews as a means to weed out those who cannot code. I'm of two minds about this. I can see where this would be a useful tool from the company's perspective but I have to wonder about the human element. A lot of programmers are geeks more comfortable with their computers than with meeting new people. For them, going on an interview is a stressful thing and they could have simply panicked when pressed to do something - much the same way that some children have a hard time taking tests.

Thursday, February 22, 2007

The Amazing Disappearing RecordSet

We have a client which uses a WBT Course Management System which they purchased. It is a classic ASP web application, whose standard database is Access and they have just recently introduced the ability to use SQL Server as a backend. Our task in this thing is hosting and fixing any issues which the company stumbles across while using it.

Not that big of a deal, one would think.

One would think.

Frankly, I'm not certain how this piece of software managed to make it out of Integration Testing. My guess, the developers don't know what integration testing is, let alone system or qualification testing.

Our client discovered an error, and asked us to find and fix it. So here we are, hunting through the code trying to figure out what is happening. Ultimately we discover that the problem is an array is not being populated from the database. No big deal. So we look closer, and notice that the array is being redim'd using the variable Num_of_Questions. Which makes sense. You want this array to be of a size of the number of questions you have. But during population, you have the index being referenced via the RecordSet field Perm_Question_Number.

Being a proponent of normalized databases, this through off warning bells in my head. For I assumed that it tied the question being asked to the answer.

Boy was I wrong.

I open up the database, and was greeted with a massive jumble of tables and fields. Consider the temporary table for holding user values:

Temp_User_Answers

  • User ID
  • Course_Number
  • Test_Number
  • Perm_Question_Number
  • Question
  • Answer A
  • Answer B
  • Answer C
  • Answer D
  • Answer E
  • Answer F
  • Answer G
  • Correct_Answer
  • Stud_Answer
Yeah. It tied to the Test_Content table via the Perm_Question_Number which was a one-based index for that Test's questions rather than the table's ID field (which was not set as a primary key, despite being the auto-incrementing, identity inserted field). And in case you're wondering, yes all of those answers and the question were repeated in that table as well.

Banging my head on my desk by this time, we get in contact with the developers of the software to ask them what they were smoking/drinking/etc while designing this software. Or if they even did design it. Or why they would do such a thing to a poor database.

Their response: "Ease of use."

If only, one could be throttled over the long-distance communication tools.

So, realizing that there was no help forthcoming from this crap-design as feature developers, we once more dug into the code trying to figure out why the values would disappear from the recordset.

Ultimately, we discovered that it has something to do with populating that array directly from the recordset. What was in the code was:
studAnswers(rRS("Perm_Question_Num")) = rRS("Stud_Answer")
correctAnswers(rRS("Perm_Question_Num")) = rRS("Correct_Answer")
And for whatever reason, this just refused to work. The system despised that line of code and refused to use the recordset after it (i.e. studAnswer was populated, but correctAnswers wasn't and any use of the recordset after it just acted like it didn't happen).

Well, having already discovered that I hate this code, and that it is riddled with flawed logic, shotty design, subpar commenting and no tabs, I figured why don't we just bandage it.

So we changed the code to look like this:
questionNumber = rRS("Perm_Question_Num")
studentAnswer = rRS("Stud_Answer")
rightAnswer = rRS("Correct_Answer")
studAnswer(questionNumber") = studentAnswer
correctAnswers("questionNumber") = rightAnswer
Lo, and behold, the page built successfully and properly.

Not the best solution, and I still don't know why the recordset would just stop working, but the application is running - and for our purposes that's what is important here. Anyone else that has the misfortune of buying this software can figure it out on their own (or hire us to do it).

So, with a bandage in place, I begin the process of removing the various Response.Write's which I had sprinkled throughout the page and add in a comment up at the top indicating that you know... a developer had done something here when I discovered the most perfect piece of code logic I have ever seen.

The one and only bit of error handling I found on the page.
If err.Number = 0 then
End If ' Check to see if there are no errors
Yes. You read that right. And yes, that was all there was to it. The developer, in his infinite coding goodness, took the time out to check the ADODB error object to see if it had no errors. He asked the code, if everything was right.

That echoing sound you hear, is probably me still smacking my head against the desk. The junior developer I was assisting in this maintenance issue is still chuckling over in his office. And we took the extra effort of going out and gathering the other developers and showing them this beautiful piece of logic.

Why he would check for success is beyond me. Frankly, in those scenarios I'm more worried about when err.Number is not equal to 0 as that means there is a problem which I need to deal with. If there's no problem, then I don't even need to spend time checking to see if there's no problem.

I'm flabbergasted at such coding. The entire thing gives all programmers a bad name.

Wednesday, February 21, 2007

SDP redux

And here I thought my Software Development Plan was well wrought.

Boy was I wrong. After the peer review there were 53 issues/defects to be addressed.

Monday, February 19, 2007

Big Numbers

I've struck up against a sort of wall in VB.Net. In one of my projects, I'm having to do math calculations on extremely large numbers (we're talking something like the result from the math operation: 5!/(26!-5!)*5! ).

As one might expect that gives overflow compiler errors for Integers, Long and Doubles. Reals just gives a decimal number.

So where does that leave me? Well it leaves me coming up with a class or method to perform math functions on large numbers when they're represented as strings.

This isn't as hard as it really sounds, for the basics of numbers is that 123 is actually 1*10^2+2*10+3*1 (for base 10 numbers, for other bases, change the 10 to whatever base you're trying to work in). Of course this is not nearly as simple as I'm probably making it sound. Regardless, I'll probably search for a working .NET implementation of this before I actually bother to build it, I just wished Microsoft had stuck it into VB.Net is all.

If anyone has any suggestions, I'd be more than willing to take them.

EDIT: After a bit of searching, I first found Lint: Large Integer Object Library. A C++ library which showed a decent amount of promise. Only problem is that it would not compile in .NET and I didn't feel up to spending the time figuring out why (though that may be a project for a later date). The other library of promise is the BigNumber library. It's a C# library for large numbers and worked quite well. There's a few things I would like to see added to this (such as inherent support for math operations between BigNumbers and other data types such as integers), and while there are some operations that could be improved a bit in terms of speed and efficenciency, overall I'm happy.

Friday, February 16, 2007

ooo....Readiness Review...

I get to now experience the joys of readiness reviews to see if our project is prepared for a CMMI SCAMPI.

Joy!

Thursday, February 15, 2007

I've done it.

I finally gave in and got a GMail account last night. After all, Google is meeting so many of my various needs already, I figured why not this last one?

Consider the tools I use on a daily basis which are produced by Google:

  • Google Reader
  • Google Groups
  • Blogger
  • Docs & Spreadsheets
  • Browser Sync

Frankly, I love these tools - having the ability to peruse my data from different computers. My only complain concerning any of these tools is that Docs is a bit light on outline formating , tracking changes, comments and other specialized tools such as word count which I tend to use a lot, and need in my word processor.

But, I'm a programmer, and this is a blog mainly about programming. So what does my little ecstatic escapade concerning online tools have to do with anything?

Gyre.

This is a very early (their website describes it as pre-pre-pre-alpha) web-based IDE for Rails.

I've yet to actually use Rails (though I use Ruby and WATIR for test driving websites) but this is a strong benefit to a web language such as Rails, especially for folks like me who more and more find that everything I'm doing ends up online.

Wednesday, February 14, 2007

.NET Framework Training Kit

MS has released a .NET Framework Training Kit for WF, WCF and CardSpaces.

I'm downloading it when I get home from work and hope to get the chance to play with it tonight.

Tuesday, February 13, 2007

Standards? What Standards?

One would think that after all the headaches that the IE team has gotten over the years about non-standard behavior in IE that they would catch on and realize that folks really do like having standards to code to.

Surprise!

Recently though, the IE Blog posted an article about a web developer who was having a problem with lists in RSS Feeds which were being stored in IE's built-in RSS aggregator.

IE Blog's solution? To use non-standard extensions, created by Microsoft, to RSS to support this functionality.

Of course the way it's built it shouldn't have a factor on other RSS Aggregators that don't support this extension, but that's not the point. If Microsoft thinks they have a relevant extension to a standard then submit it to the standards body don't just implement it, provide support in your browser and then release the new version that you like under the CC license and call it good.

Who knows, maybe I'm way off base and Microsoft submitted this extension to the standards board which deals with RSS. They have been putting things into standards more and more (Office 2007 Doc Format, C#).

Monday, February 12, 2007

Functional Requirements

I think I've found the second most exhausting thing in the world to do.

Which of course is to sit down and discuss functional requirements with a user. Users know what they want - they just have a hard time explaining it in a way that makes sense to programmers.

Oh well, the important thing is that the meeting was successful and the functional requirements for my current project at work are for the most part nailed down.



And for those of you who may be wondering, the most exhausting thing in the world is chasing a four year old through a park.

Friday, February 9, 2007

Interfaces

Just an interesting article I found concerning implicit/explicit usage of interfaces in C# classes.


http://devdeacon.blogspot.com/2007/02/yet-weirder-nuances-with-c-interfaces.html

Thursday, February 8, 2007

Safari Books Online

Oh man, what I have been missing.

I'm a reader. It's a huge part of who and what I am. I read for fun. I read for information. I read when I'm bored. I read when I'm not bored. As you may have guessed, a good portion of my free-time is spent with my nose in the proverbial book (I'm often reading things online so it's proverbial these days).

And since I'm a software engineer, I have programming books, database books, books on architecture, books on CMMI, books on databases - all sorts of books which relate either directly or indirectly to my chosen career field. Reasonable, a lot of IT folks are in the same boat as me.

Of course what is unreasonable is the fact that each of those books set me back at minimum $40 - and some of them (the ones that started their service to me as textbooks) were closer to $200. I understand this, writing technical books is an expensive undertaking - especially since they are huge tomes filled with arcane knowledge which is often out of date after the second publishing run.

Well, O'Reilly came up with a solution to that particular problem. They call it the Safari Books Online.

Basically, they provide online access to a huge library of books for a low monthly fee.

For $50 a month, one can gain unlimited access to the library while for $20 a month, one can gain access to a bookshelf deal - where you can 'check out' 10 books from the library for your use (the only thing is that you must keep those books checked out for a minimum of thirty days).

I think this is a wonderful idea, now I just need to figure out how to squeeze an extra $20 (or $50) a month from my budge to pay for this.

Wednesday, February 7, 2007

Software Design Description

I'm currently writing the Software Design Description (SDD) for the project I'm working on at work.

And it is something tedious.

Of course, that tediousness is offset by the knowledge that I will have almost everything laid out exactly as it is needed to be. What classes I need to create, the properties and methods each of those classes will need, and even the pseudocode for those classes. And let us not forget the section on the UI. Pages, upon pages of mockups, controls attributes, how controls map to data fields, and even the database tables that a particular screen would have access to.

It is 75 (currently) pages of programming goodness, in a nice, safe, Microsoft Word document.

But here's the template which I used for this document. It's based off of the usual DID and other standards.

  • Scope
    • Identification
    • System Overview
    • Document Overview
  • References
  • Design Decisions
    • General Constraints
    • Common User Access Conventions
    • Inputs
    • Outputs
    • Interfaces
    • Initialization
    • Memory & Processing Time Allocation
    • Security & Privacy Requirements
    • Safety Requirements
    • Validation
  • Architectural Design
    • Software Units
    • Interface Design
  • Detailed Design

  • User Interface Design
    • Common UI Elements

  • Requirements Traceability
  • Notes
    • Acronyms & Abbreviations
    • Glossary

Tuesday, February 6, 2007

ASP.NET Visio & Smart Card Frameworks.

I came across a nifty new custom control in my RSS feeds this morning . An ASP.NET 2.0 Visio Custom Control. I was expecting some low level programming, utilization of the .NET graphics capabilities, in general the generation of images, based on the data found within a Visio file.

After all, that's what I think when you say custom control - you're building this to display some information or perform some task.

What the article describes though, is the use of the Visio Viewer within IE. So rather than building a custom control which accepts a Visio file as a backend, this is a wrapper for a call to the Visio Viewer ActiveX.

I know, it sounds like I'm being anal. Well it's actually a very large semantical difference and has massive issues with usage, mainly that ActiveX controls are only supported on IE.

But I have found some very, very interesting articles on CodeProject. They are a series of articles describing classes and libraries that can be used to access SmartCards. I'm currently working on a project which deals with Smart Cards so I'm hoping that this can be useful in ensuring that I can use entirely Managed Code as opposed to a mixed bag of managed and unmanaged that is currently in the works.

Even better is that their is an article on using the code on the .NET Compact Framework - which means I might be able to convince the boss to let me build the application for a PDA.


Links:

Monday, February 5, 2007

My First SDP

Well, I finally wrote my first Software Development Plan (SDP) and it's going to peer review within a few days. Actually, I should re-phrase that - I've almost written my first SDP. I didn't fill in the schedule as that's tracked separately in a MS Project file. It wasn't nearly as onerous as I feared it would be when reading the DID for the first time.

Now, I just get to see how much proverbial red-ink our Senior Systems Engineer pours all over it at the peer review. Go me!

Related Links:

Sunday, February 4, 2007

Run BASIC

A week or so ago, I read an essay from a rather well-known science-fiction writer complaining about the fact that he was unable to find a simple, free and easy-to-use BASIC compiler which he could use with his son to build those sample exercises that grammar school math books always seems to have at the end of the chapter.

Enter Run BASIC.

It's a web-based BASIC compiler. I'm talking the old-style BASIC, which I learned how to code in on a Commodore 64 way back in the day. Useful? Probably not that much, but it sure is fun!

Friday, February 2, 2007

A Better BulletedList

I think this article on a developer's need to output HTML formatted text in one of the new .NET 2.0 web controls is probably one of the better articles on extending a control that I've seen over the past few years.

Clear, concise, and explains a very important aspect of ensuring that you don't destroy needed features while adding new ones to a control.


Of course, on the other hand, I read this CodeProject article and wondered why on earth the author felt that it was worthy of being an article.

Thursday, February 1, 2007

"Most Recently Used" Menu List

There are a few gaping holes in the .NET Framework which Microsoft seems unwilling or unable to fill. The first of these is a framework to allow communication with smart cards. Implementing a framework utilizing the PC/SC standard should not be that hard, of course I have seen a library that does so on CodeProject, so maybe in .NET 4.0 we'll get it.

A second hole is no Most Recently Used menu option. They provide an interface to automatically allow MDI windows to be populated under a WINDOW menu, but for whatever reason you have to design and build a system for MRU.

And yes, a MRU is a very, very important user interface component. Such things makes application which open files much, much easier to use. I often find myself using the MRU on Visual Studio, Office, and the one which Windows provides on the Start menu. I really do not understand why this type of menu option was left out of the Framework.

Of course, since I'm a programmer, I'm lazy and went looking for one before I spend hours on end building one (hey, why re-invent the wheel?).

Well, CodeProject came to the rescue, and thanks to one Joe Woodbury over there, I now have a nifty MRU menu class. That particular version is for .NET 2.0, but Joe initially built that class for .NET 1.1, this is just an updated version using the new menu structures.

I plugged this into my application, and after a few minutes of poking and prodding at the demo, the application I'm working on has a handy, dandy MRU. Thanks, Joe!

Blog Widget by LinkWithin