|
 Wednesday, November 14, 2007

Comma Delimiting Strings in .NET - The Framework Way

It's common to see a developer use a StringBuilder or basic string concatenation to concatenate strings in .NET code.

You'll usually see something like this:

string comma = ",";
StringBuilder sb = new StringBuilder();
sb.Append("Donn");
sb.Append(comma);
sb.Append("Felker");
sb.Append(comma);
sb.Append("Jiu-Jitsu");
sb.ToString(); 

And this will return "Donn,Felker,Jiu-Jitsu"

But the .NET framework has something built in just for doing this type of operation.

Its called the CommaDelimitedStringCollection and it's located in System.Configuration namespace. What it allows you to do is to add items to a collection and then just access the "ToString" method of the class to return the value of the collection, delimited by comma's.

Here it is, in action:

CommaDelimitedStringCollection coll = new CommaDelimitedStringCollection();
coll.Add("Donn");
coll.Add("Felker");
coll.Add("Jiu-Jitsu");
coll.ToString();

This will return "Donn,Felker,Jiu-Jitsu".

Much easier, much nicer.

Enjoy.

#    Comments [1] |

Vitamin or Prescription?

As developers we're constantly inundated with requests like this ....

  • Can you add a button that does does ________
  • On this screen _________ I need to have a chart of ________ displaying data ...
  • I need a report that shows me _________
  • Can we add _______ to this page?
  • It shouldn't be too hard to add this, its just a field on the screen .... (then they explain what its supposed to do)...

(classic scope creep)

Prioritization

The order in which a developer prioritizes items in their "todo" list is often determined by the urgency placed on them by their direct managers (or higher ups). More often than not we find a high level executive or decision maker wants a feature implemented because they "think" it will add value to the product. Again, more often than not, the executives theory of how this feature is a viable request has no data to back it up. Therefore a feature is implemented with no verification that its a needed or requested feature. Please remember, this doesn't always fall upon the shoulders of the decision makers... as developers we're enamored with making things sparkly and shiny. If we think of a cool new "hot key" that we can add to our app, we'll do it, even though it might take four hours to implement, we're confident it will be the feature that saves the world.

Uhhhhh, Nope. Afraid not McFly.

 

What's the root of the issue?

We need to ask ourselves a simple question....

Question: Is this feature a vitamin or is it a prescription?

Before we can answer this... lets look at some simple definitions...

Vitamin - A supplement that helps you, its good for you, its nice to have, but its not required.

Prescription - Medicine that helps you. Its required, it helps you survive.

 

Answer: It depends. (the classic developer answer... well... it depends... :)   )

 

The Process of the Request

When an feature request comes in you need to ask (as well as the client who requested it) ...

Is this feature/request a Vitamin or a Prescription?

This is the same as asking...

Is this feature request a "nice to have" or a "requirement to survive"?

This is going to determine if the request is worth putting into the system immediately. If you have 10 tasks, ask this question ten times and  you might some up with something that looks like this:

(This mimics a fake Online Order Management system - for example purposes)

VitaminsPerscriptions

As you can see, we see that everything on the LEFT is a requirement for the system "requirement to survive" (prescription). Everything on the right is a "nice to have" (vitamin).

We may need graphs of data, but we don't need 3-d graphs. We may need Web Access to the Order Management System, but we don't need a Silverlight implementation to get this project to work. It would be "nice to have" a Silverlight implementation, but its not required.

Conclusion

The next time you're asked to implement a feature, ask yourself...

Is this a vitamin or a prescription? Then put it in that bucket. Then, once that's figured out, go into the prescription bucket and prioritize those upon business requirements. Then, when you've taken all of your prescriptions (all of those items are complete), ask yourself if the "vitamins" are going to add value to the project. if they are, then ask that question again (is this a vitamin or a prescription).

This ultimately comes down to an agile type of development process. We should only be implementing the things that add value and that are required for the app to serve its purpose. Most of the time a lot of these "Vitamins" will never make it into the system because its just not cost effective or necessary. Eventually some vitamins will make it into the system and sometimes its these Vitamins that make your system a step above the other systems, but this cannot be established until you've taken all of your prescriptions. If you're sick and bed-ridden, you can't take muscle vitamin supplements to get muscles big. You have to take the prescription to get well, then you can take the muscle supplements to get muscular.

Next time you get ready to implement a feature/request - ask yourself ...

Is this a Vitamin, or a Prescription?

#    Comments [1] |
 Monday, November 12, 2007

MODI - The Lightweight DOM Inspector Bookmarklet

There are a ton of HTML DOM inspectors out there. I mean, a lot of them. They're helpful as hell when you're in a pinch and you can't figure out what the DOM is doing. I've used all kinds, from FireFox add on's to IE gadgets, to custom ones... But for the last couple of years I seem to have stuck with one that just seems to work for all of my needs. Its the Slayer Office Mouse Over DOM Inspector - MODI. Its simple, clean and very lightweight.

How It Works

Here's what you do... go to this page: MODI Help Page

Right click on the "Bookmark this link for MODIv2". This screen shot is in FireFox. Internet Explorer will warn you that its not safe to book mark these type of items, but just click Ok because this one is safe.

modi1

 

Then go visit a web site where you want to view the DOM. For example: www.codeplex.com. Once at the site, click your book marks and click the MODI book mark as shown below:

modi2

You will now see the Mouse Over Dom Inspector action. Move your mouse around and you'll see the parent elements, the classes each element inherits, etc. It will look something like this: (click for larger image)

modi3

The text that is circled in red is the element that we are inspecting. The details of that element are present in the MODI box (blue box). Move your mouse around the screen and you will see that MODI gives you the information about the DOM element that your mouse is currently over.

If MODI is over the element you're interested in inspecting, just click and drag the top of it and you can put it anywhere on the screen.

 

Conclusion

The best part about this DOM inspector is that I don't have to install it on anything on my machine. If I'm on a clients machine or on a server - using the browser - and I need to inspect the DOM, I can hit the MODI web page and then run the bookmark and I'm off into the DOM.

Simple, yet effective.

#    Comments [1] |
 Sunday, October 28, 2007

Becoming a Better Developer in Six Months

study

  Everyone and their mother has already posted this type of post, but this time I need to keep track of the code/processes I WANT TO LEARN. I'm positive these will help me in my everyday career as well as for my own well being and knowledge. Some of these things I want to know/do just for myself, some are to make myself more of an asset.

Here they are, in no particular order:

  • Andrew Kirillov's AForge.NET Framework -
    • When I learn (and understand all of this), I'll be a happy/smart man.
      • This code is just brilliant. Topics covered in the Framework:
        • Computer Vision
        • Artificial Intelligence
        • ImageProcessing
        • Neural Networks
        • Genetic Algorithms
        • Machine Learning
        • Motion Detection
  • BlogEngine.NET -
    • I'll probably be moving over to this blog engine soon enough. I enjoy all of Mads' articles on his blog, so I can only imagine that this project is riddled with goodness.
  • Finish my MCPD - Enterprise Application Developer Certification.
    • I'm already have my MCTS in Web Client Development so I'm only 3 exams away from finalizing this cert. This should only take about 3 months max.
    • There are debates all over the Internet about whether or not a cert helps you or not. I don't really care about them because here's my take -
      • If I truly pass all of these exams by reading the books and self study, I'm going to be a 10X better developer than if I didn't read them. There are times when you will NEVER know about a feature of the framework, but these books and exams force you to learn them. Example: For the longest time I didn't know about Isolated Storage and now that I do, I've used it on many occasions.
      • Also - I DO NOT use brain dumps for study material - I see this as a blatant slap in the face to true cert holders. Brain Dumps truly are cheating yourself. I use the book and MSDN and either Measure Up or Transcender for exam prep.
  • Master WCF
    • This itself, it just crucial nowadays. SOA is here, and I only see it getting stronger. I've worked with WCF for a while, but I want to know this technology in and out like the back of my hand. I've worked with SOA for quite awhile with many clients, but WCF is where its at. The applications I've built with WCF are insanely fast and scalable. The more knowledge that is present in this area, the better off everyone is.
  • Silverlight
    • This technology is just plain awesome. As Shawn Wildermuth said on DNR Episode 258 - its the perfect entry point into understanding WPF. I'm not using it to learn WPF, but that's just an added bonus.
    • I've worked with Silverlight 1.0 and 1.1 and even created a few test projects. I'm in the midst of creating a new media site for Geffin Recording artist BLESTeNATION (good friends) in order to test out some new functionality.

There are a TON of other things that I really want to learn, but this is enough for the next six months for me.

#    Comments [2] |
 Saturday, October 27, 2007

VS2008 VPC's Are Expiring Prematurely on Nov 1st

expiredReading Jeff Beehler's blog posted a thread here stating that the VS2008 VPC's are going to  terminate prematurely because of an OS expiration date of Nov 1st 2007.

If you're using any of the VS2008 VPC's you'll want to read this. You're going to have to back up your TFS database, and then restore it into a new VPC that is being created as we speak and is expected to be live early next week.

Read More Here

#    Comments [0] |