|
 Monday, May 05, 2008

Software Development: Greeenfield vs. Brownfield

Jargon, slang, blah blah blah... So what's the difference between the two? Its quite simple actually, so lets dive right into it.

Greenfield Development

Greenfield Greenfield Development happens when you start a brand new project, as in, clean slate development. No legacy code lying around, no old development to maintain. You're starting afresh, from scratch, from a blank slate, with no restrictions on what you're doing (other than business rules of course).

The definition from the Wikipedia Entry states: "In software engineering jargon, a greenfield is a project which lacks any constraints imposed by prior work."

It's also described as "File --> New Project/Solution".

In my experience, a true Greenfield projects is quite rare in line of business applications. Almost always you have to interact with some legacy code at some point in time and perform integrations with that legacy code that impose limitations on your development.

Examples of Greenfield Development

  • Building a new E-commerce solution from the ground up
  • Implementing a new rules engine for your company from the ground up.
  • Rewriting an old app in a new language (maybe C++ to C#) but not utilizing any of the old code other than for business rule reference
  • A new startup wants application X Built. Application X has never been built before, therefore Application X is a greeenfield endeavor

 

Brownfield Development

Brownfield Brownfield Development happens when business decide to develop/improve upon an existing application infrastructure. As an upgrade is implemented into an existing solution, the development is said to be Brownfield.

The Manning "Brownfield Application Development in .NET" book defines Brownfield development as: "A Brownfield application is a project, or codebase, that was previously created and may be contaminated by poor practices, structure, and design but has the potential to be revived through comprehensive and directed refactoring."

I'm not sure if if completely agree with the definition above, but I do think its close. Brownfield Software Development is about working with previously created code. To me, it does not mean that the code is legacy, as the term "legacy code" has a completely different connotation as soon as you've read Feathers "Working Effectively with Legacy Code". I believe Brownfield development can occur on an excellent foundation of code. What if the application that we need to enhance has 90% code coverage? Does that mean that the code is poorly structured and hard to update, and contaminated? No, not at all. I'd argue that it doesn't have a contaminated structure with that much code coverage, but then again, it depends on the code and how it was architected.

Examples of Brownfield Development

  • Adding a new feature to software that was developed last year
  • Altering the functionality of the code to enhance the performance of an application
  • Upgrading the codebase to expand the working set of functionality across the board.

 

Conclusion

My experience in the field varies between Greenfield and Brownfield. I've spend 1/2 my career behind the desk at companies as an employee. I've spent the other 1/2 as a consultant. I've seen quite a few Greenfield projects, and I've seen even more Brownfield developments. As a standard employee at any company, I'd say that 50% of what I did was Greenfield (and I know that's not normal from talking to my colleagues), and 50% was Brownfield. From a consultant standpoint, I normally perform Greenfield development. But as of lately I've been on a Brownfield engagement that's spanned many months. I'd have to say at this point in time I'm doing about 70% Greenfield and 30% Brownfield as a consultant.

What's the norm? I can't say, I'm no governing source of this info, but from what I've seen in the field it looks like to be ~20% Greenfield and ~80 Brownfield.

Does it matter which type of development you're involved with? Yes and No. If you want to make great software, you can do that in both areas. If you want to run with the latest and greatest technology in the field, perhaps you should consult a little more. But in the end, what really matters is that you have passion for what you do regardless of the type of development you're doing.

#    Comments [1] |
 Thursday, May 01, 2008

By Far, The Coolest Flash App I've EVER Played With

I've played with a lot of Flash applications, hell, I've written a TON of them. I was one of the very few developers developing/integrating PHP/MySQL/Flash 5/MX/ActionScript programming that I know of at the time. Here's a few links to some of them I built that are still online.

Unfortunately the Internet archive doesn't keep track of flash movies that well otherwise I'd link the SUPER COOL ones (tons of animation based upon user input and data from the persistence store) I did that had TONS of integration. I had a ton of other ones that I've done but either the band or label went under so they're not online and I don't have a portfolio site for them (although I should for historical purposes). Between my stints at Lava Records, Atlantic Records, Dreamworks Records, Nitro Records and the now defunct Grave 9 Records I wrote a lot of PHP/MySQL and Actionscript. Thank god those days are over. Oh .NET how I love thee... anyway... enough geek talk.

Why The Best Ever?

One of my favorite hip-hop artists, Atmosphere, released a new album called "When Life Gives You Lemons" (You Paint That Sh!t Gold). Seriously, its a great album, but this isn't a music review site - its a technology blog so lets back to topic Felker ...

With the release of this album they released a web app that allows users to "Tag The World" (www.paintitgold.com) which in effect lets the user take a screen capture (through the use of a Flash App) by typing in a URL and then you can use a set of tools to tag up the site of your choice.

You can use spray paint, stencils, different colors, sizes, markers, etc, its cool. I literally lost about 2 hours on this site. I got sucked in this evening. That NEVER happens, so when it does I'm completely amazed at how the site did it. After being on the net for 10+ years I thought I'd seen it all, NOPE. This is cool. I've seen some "Paint" sites before, but this one got me sucked in.  The other sites that implemented the "paint" feature were very MSPaint. Lets face it, MSPaint, well... sucks. Its great to grab screen shots, but then again, why aren't you using Paint.NET?

Anyway, that aside here's what I did to my site. Honestly, I must have created over 50 of these before I just said screw it and decided to save it for the heck of it.

(click the image to see a larger version on the actual site)

The real awesome-ness is that the spray paint has pressure, and you can size the stencils, rotate them, and just go crazy in general. Afterwards,  you can submit your "masterpiece" (if you want to call it that - mine definitely is ... look at my new digs on my picture above - *haha*) to a gallery on the site. Afterwards it gives you code to post your masterpiece on your blog (which is how I got it to my site).

Conclusion

Take a look at how simple it is to use this site.

I mean it, literally look at how easy it is to use. You don’t have to be a computer genius to get it to work. It just works. This site has a GREAT UX and its fun as hell. There is music playing in the background. You get to tag up a site, hell, just have fun, and you can save your drawing in the end. Every single Web 2.0 designer that wants to make a fun compelling app can learn something from this site. The saying goes "Don't Make Me Think". Not only did this site NOT make me think, it led my hand to allow me to escape into their site (and literally escape reality for a couple of hours).

The only thing I wish they had was a "undo" feature that worked as I expected. From what I could find it you could only "clear the canvas" ... but... then again... this is a hip hop site and the hip hop culture embraces graffiti, and in a true blank canvas sort of way this site embraces the graffiti element beautifully. In the real world you can't just "undo" a line of paint on a wall (or train for that matter). :) You have to keep on going whether you like the piece or not. Its art. :)

Final Thoughts

Kudos to the developers of this site, great job guys.

Heuer lets create a version in Silverlight that blows this one out of the water. :)

#    Comments [4] |
 Tuesday, April 29, 2008

3.5 Beta Exams Not Available In Phoenix

I meant to post this a couple of weeks ago but unfortunately I didn't get the chance to. Anyway... I was a little bummed out to find that the ASP.NET 3.5 Beta Exams were being offered to MCP holders until late April (I believe it was up until yesterday), but unfortunately NOT A SINGLE EXAM SITE IN PHOENIX can house this Beta Exam.

I spoke to a ProMetric rep who stated that the exam sites such as Interface, ValorIT, and even ProMetric's own testing facility were not a high enough site rating. Apparently they need a level 4 site rating to hold these beta exams, these sites only obtain a level 3 or less rating.

Upon further inspection, the closest testing facility that would allow me to take this Beta exam was at Yavapai College in Prescott, AZ (see map below). Look how far away that is:

Map image

<-- Here's where it is in relation to Phoenix.

The part that baffles me is how Phoenix can be in the top 5 largest cities in the USA (I can't find my reference for when we passed Philly, but I heard we did somewhere - If I'm wrong, oh well) and we don't have a testing facility that allows us to take Beta Exams. Don't get me wrong, I'm happy that we even have facilities that do this, but I'm amazed that a city of this size does NOT have a level 4 facility in the metro area. Literally, the metro area almost spans nearly ~100 miles in diameter.

Anyway, I'll hit up the exams when they're released. No big deal. :) I was just amazed that we didn't have the capacity to hold these exams.

Here's the links for the .NET 3.5 Study Guides:

ASP.NET Application Development (70-562)

ADO.NET Application Development (70-561)

#    Comments [0] |

TechEd Developer 2008 & Party With Palermo

If you're going to be at TechEd 2008, let me know as I'll be there.

 

Also if you're going to Palermo's event, let me know as well because I'll be there as well - "im up in yer partee - rubbin' dem elbows".

Party with Palermo See ya there.

(Click the image for more info)

#    Comments [0] |

Simple Download Counter HttpHandler

[Full code sample provided at the bottom of this post]

I use A-Drive from time to time to host small files that I want users to download for various personal projects (mainly to help conceptualize the market for entrepreneur start-up ideas). Lately I needed to use it for a project where I needed to track the number of downloads a particular file had. Normally this is something I could code up real quick, but I literally wanted to get this up and running within minutes. I'm running a site using the Graffiti CMS so I'm doing this to get some quick feedback cycles in regards to if my "product" I'm offering is worth the time to invest a full implementation. (MicroTesting).

I had uploaded the file, and then accessed it from three different networks to realize that the incremental counter was NOT incrementing. WTF?! I messed around with it some more... I deleted my cookies (thinking that maybe they wrote a cookie to verify I downloaded it so it didn't double dip in the count for my multiple downloads - aka: Unique Downloads). I contacted support, but it was the weekend so I didn't expect a reply.

Update

I received a reply from the company in regards to their download counter not working:

Dear Donn,
This is currently a bug in our system that we will resolve very soon.
Thanks,
-ADrive Support Team

So.. it was now time to create a simple HttpHandler to count downloads for me.

How To

Note: This is a very very very simple example of how you can count downloads (and no, it does capture unique user downloads). This can be altered very easily to do this.

My Simple Requirements.

- Persistence Medium For The Counter (XML)

- Increment the counter

- Allow the user to download the file

The best place to implement this functionality is inside of an HttpHandler by using the IHttpHandler Interface. The reasons are simple: I don't need a UI, I don't need complex business logic (remember - this is a super quick implementation to fix a simple problem).

Code

1 using System; 2 using System.IO; 3 using System.Text; 4 using System.Web; 5 using System.Xml; 6 7 /// <summary> 8 /// Increments a counter and forces a download to the user. 9 /// </summary> 10 public class DownloadHandler : IHttpHandler 11 { 12 private readonly string COUNTER_REPOSITORY = "App_Data/ExampleCounter.xml"; 13 private readonly string MY_FILE = "App_Data/Example.pdf"; 14 private readonly string SAMPLE_DOWNLOAD_COUNT_ELEMENT = "SampleDownloadCount"; 15 16 #region IHttpHandler Members 17 18 ///<summary> 19 ///Enables processing of HTTP Web requests 20 /// by a custom HttpHandler that implements 21 /// the <see cref="T:System.Web.IHttpHandler"></see> interface. 22 ///</summary> 23 ///<param name="context">An 24 /// <see cref="T:System.Web.HttpContext"></see> object that provides 25 /// references to the intrinsic server objects (for example, Request, 26 /// Response, Session, and Server) used to service HTTP requests. </param> 27 public void ProcessRequest(HttpContext context) 28 { 29 IncrementCounter(context); 30 SendFileToUser(context); 31 } 32 33 ///<summary> 34 ///Gets a value indicating whether another request can use 35 /// the <see cref="T:System.Web.IHttpHandler"></see> instance. 36 ///</summary> 37 /// 38 ///<returns> 39 ///true if the <see cref="T:System.Web.IHttpHandler"></see> instance 40 /// is reusable; otherwise, false. 41 ///</returns> 42 /// 43 public bool IsReusable 44 { 45 get { return false; } 46 } 47 48 #endregion 49 50 /// <summary> 51 /// Sends the file to the user. 52 /// </summary> 53 /// <param name="context">The <see cref="HttpContext"/> that 54 /// contains the request.</param> 55 private void SendFileToUser(HttpContext context) 56 { 57 // Send the file to the user. 58 FileInfo fileInfo = new FileInfo(context.Server.MapPath(MY_FILE)); 59 60 context.Response.ContentType = "application/pdf"; 61 context.Response.AddHeader( 62 "Content-Disposition", 63 "attachment; filename=" + fileInfo.Name); 64 context.Response.WriteFile(fileInfo.FullName); 65 context.Response.End(); 66 } 67 68 /// <summary> 69 /// Increments the counter. 70 /// </summary> 71 /// <param name="context">The <see cref="HttpContext"/> that contains t 72 /// he current request</param> 73 private void IncrementCounter(HttpContext context) 74 { 75 int value = int.MinValue; 76 string fileName = context.Server.MapPath(COUNTER_REPOSITORY); 77 using (XmlTextReader reader = new XmlTextReader(fileName)) 78 { 79 reader.ReadStartElement(SAMPLE_DOWNLOAD_COUNT_ELEMENT); 80 value = Convert.ToInt32(reader.ReadString()); 81 } 82 value++; 83 using (XmlTextWriter writer = new XmlTextWriter(fileName, Encoding.ASCII)) 84 { 85 writer.WriteElementString( 86 SAMPLE_DOWNLOAD_COUNT_ELEMENT, 87 value.ToString()); 88 } 89 } 90 91 92 93 94 } 95

How It Works

We have to add a line to the web.config to tell ASP.NET about the Handler and to only listen to the "GET" Http Requests.

1 <httpHandlers> 2 <add path="Download.ashx" verb="GET" type="DownloadHandler"/> 3 </httpHandlers>

When the app is fired up we first access the request, then open an XML file that looks like this:

<SampleDownloadCount>8</SampleDownloadCount>

The file is parsed, the value is incremented and then we write the value back to the file. I'm almost positive there is a more elegant solution to this but remember, I wanted this to get done FAST, I'm not looking for pretty in this implementation. Technically, this is throw away code if my test works (my 1 week MicroTesting phase). Then I go into full development.

After the counter is incremented we send the file to the end user through the response.

Note: The file "Example.pdf" is hard coded in this example but you could easily set this up so that the file represented an  identifier through the query string (download.ashx?DownloadId=1) where 1 might equate to "Example1.pdf" and 2 might equate to "Example2.pdf". Think about it awhile and run with it. Remember, this is an extremely simple example for how to count downloads.

Conclusion

It's very simple to implement this counter in a regular ASP.NET web site. Although its not production quality code, it will work for simple testing and monitoring of file downloads and should supply you with a starting point to move forward with download counters.

In a future post I will show you how you can use this inside of the Graffiti CMS to help track your download counts.

Downloads

You can download a sample example site here: FooTheory.DownloadHandler.Example.zip (7.39 KB)

#    Comments [0] |