May 15, 2008
@ 11:19 AM

There is a Code Camp event being hosted and sponsored by the Enterprise Developers Guild in Charlotte NC. A co-worker, Adam Mckee, and I will be attending.

The session tracks and schedule are available here, and I believe there are still seats available if you are interested in attending.

Registration is free, and lunch is provided. It's an all day event and looks like it should be very informative.

I have included a snap shot of the schedule, click for a larger image, but of course you should check the site for last minute changes, additions etc.

image

If you are planning on being there and would like to meet leave a comment or send me an email or phone call, my contact details are on my main blog page.  http://www.rp2c.com/blogofbob

Cheers,

Robert Porter


 
Categories: Programming | User Group


Beta versions of SP1 for both Visual Studio 2008 and the .NET 3.5 Framework are now available. Check ScottGu's Blog post here for more information.

For the record, I am holding off on installing these for a couple days, I will probably wait for the shipping versions, but if you are a bleeding edge type they are available!

Cheers,

Robert Porter


 
Categories: Programming | Visual Studio


It seems I keep having the same conversation when it comes to BPM, Content Management and Workflow. Everyone has a different idea what each one means, how they relate (or don't relate) to each other. And of course there is always the "what exactly is <insert term from above>" question and debate.

Remember the saying "One man's code is another man's data.", well that same thought process applies to Content Management, Process Management and Workflow.

#1. Content folks will tell you that Process and Workflow exist in order to accommodate CONTENT.

Content Management 

#2. While folks from the Process Management pool will tell you that content and workflow are just aspects of THE PROCESS.

process

#3. Then there are the Workflow centric types who will gladly explain that without WORKFLOW there can be no process and content will have no meaning.

Workflow

So what conversation do I keep having? From my own experience and point of view all 3 of the above views combine to make a whole. Content in and of itself is just so much data. Workflow, while it can exist without content is usually the way that content gets consumed by, wait for it, a process!

Each of the 3 components, Content, Workflow, and Process, can exist in their own right. (Although I would tend to argue that a "workflow" is a process by definition.)

But from a very real world point of view (after all IT systems are primarily a way to model the "real" world right?), most process's are enriched by and contain content and workflow's. Even if they are not formally identified as such. For example, take buying a house, from the buyers perspective.

There is a fairly standardized process to buying a home. Once the offer is accepted, you enter the final phases of that process culminating in a sub process called a closing.

Some of the steps, workflow anyone, in that process are having the home inspected, having the home appraised, having a termite inspection, acquiring an insurance binder, checking the title, etc. Some of these steps are independent and can proceed asynchronously, other aspects are serial or synchronous in nature. (Appraisal first then check on Insurance etc.)

How about some content in this process? My last home purchase generated somewhere in the neighborhood of 500+ pages of reports, inspections, loan documents, insurance documents, tax information etc, etc. Talk about content! A home purchase is swimming in content.

So there is a real world process that requires both content and workflow in order to come to a successful conclusion. The content alone would do me little good without a process to give it context, and without a workflow to give it meaning and order.

So my conversation is usually something to the effect that Process Management, includes Process, Content, and Workflow. And that they are all interdependent on, and mutually beneficial to, each other. So lets all quit trying to shoehorn everything into a <insert part here> centric view.

So, to use another well used phrase; Can't we all just get along?

Cheers,

Robert Porter


 
Categories: Programming | Ramblings


If you get this error trying to set and hit a breakpoint, there are a couple of things to look for to resolve it. Typically what this error means is that the compiler cannot find debug information for the file you are trying to set a breakpoint in.

The first thing to check is that you have compiled the assembly in debug mode.

image

If you build the assembly in Release mode it will not generate the necessary debug information. Also be aware that there are two modes the compiler can use to generate the necessary program database (pdb) file for debugging, but only one of them actually enables incremental linking of the debug info.

/debug:full or /debug:pdbonly. Building with /debug:full generates debuggable code. Building with /debug:pdbonly generates PDBs but does not generate the DebuggableAttribute that tells the JIT compiler that debug information is available.

Depending on how you are building your solution you either need to look at the msbuild file or if you are building from within Visual Studio you can right click the project file and select properties. Then select the Build tab, and then the Advanced button. You will get the following dialog (VS2008, 2005 may look slightly different.)

image

Notice under Output the line for Debug Info, make sure this is set to full. The other values available are none, and pdb-only. Neither of the latter two values will result in debuggable code.

The next most common cause is that the [assemblyname].pdb file is not being copied or updated correctly to the bin folder of the startup project in a multi project solution.

You can manually copy the assembly file and the pdb file from the bin folder of the assembly you want to debug into the bin folder of the startup or calling project. Or into the web application bin folder if you are calling the assembly from a web application.

Thanks to Adam McKee of Ironworks who recently reminded me of the fix for this problem. I have put the information here to hopefully help the next person.

Cheers,

Robert Porter


 
Categories: .NET | C# | Debugging | Programming | VB.NET | Visual Studio


May 10, 2008
@ 07:04 PM

There are a number of add-on's for Fiddler, and every time I have to install Fiddler on a new machine I am always surprised when I go to use an inspector only to find out it is not there.

The best source of information for Fiddler Add-On's is the Fiddler Web Site itself. There is an Add-On link from the home page.

My favorites are:

The Syntax View Inspector

syntaxview

This add-on shows you syntax colored views of the captured session traffic.

 

The Web View Inspector

WebView

This inspector shows you the session data as it would be rendered via IE's rendering engine.

These are only two of the many available add-on's for Fiddler. But they give you a feel for what is available, and of course if there is a feature you want or need that is not already available, you can always write your own inspector!

Step by step instructions on building your own inspector are available here. Fiddler can be extended with .NET code or by using it's own built in Fiddler Script engine.

Cheers,

Robert Porter


 

I love Fiddler, it is a great aide in developing web applications, web tests and in general figuring out what is happening between your browser and server.

That said, it can be rather frustrating to get Fiddler working under certain circumstances. Over the years I have collected the following answers to the most common annoyances. Most of the following information I found on blogs, forum posts, and newsgroups. I have collected it here for convenience.

Two of the most common errors and fixes when trying to use Fiddler for a proxy debugger.

1. [Fiddler] Connection to localhost. failed:

[Fiddler] Connection to localhost. failed.
Exception Text: No connection could be made because the target machine actively refused it

Go to Fiddler Options and uncheck 'enable IPv6'

image

The alternative would be to configure your local IIS to listen to IPv6 traffic but this won't help if you are using the built in dev server that comes with Visual Studio

2. If you are not seeing any traffic on your local machine:

IE7 and the .NET Framework are hardcoded not to send requests for Localhost through any proxies, and as a proxy, Fiddler cannot intercept such traffic. There are several fixes to this problem.

The quickest fix is to substitute your machine name for localhost in the url so instead of http://localhost:1841/MyPage.aspx use http://mymachinename:1841/MyPage.aspx.

Another fix is to insert a '.' (period) right after the localhost in the url. e.g. http://localhost.:1841/MyPage.aspx

You can also edit your local hosts file to alias 127.0.0.1 to something like 'local'

A great deal of information on specific configuration issues in a variety of client systems is available on the Fiddler web site on the Configuring Clients page.

Enjoy!

Robert Porter


 

Two of my favorite bloggers/authors and fellow developers are combining to create what I hope will become one of the greatest developer resources on the web.

Joel Spolsky of Joel on Software fame and Jeff Atwood of Coding Horror fame are partnering to create stackoverflow.com which from their respective announcements sounds like a combination of Google and Experts Exchange on steroids!

Joel’s announcement

Jeff’s announcement

Go read them yourself, but I am excited! I can’t wait to see how this plays out, hopefully I will be able to get involved. The site itself is also available, albeit in a very “startup” mode at stackoverflow.com.

Cheers,

Robert Porter


 
Categories: Programming | Rave | Reviews


I had an interesting conversation with a long time friend and fellow IT worker, Eric Moore, today. Our conversations tend to ramble unpredictably at times, and this evenings was no different.

In the course of the conversation Eric elaborated a series of connected thoughts about IT projects that hit home with me. It was not that anything he said was a new concept in and of itself, but the way he said it was what I found so compelling. I’ll get to what, and how, he said in a moment, first I need to set the stage a little.

I believe that Agile development, TDD and the other iterative approaches to development offer significant benefits over more traditional Waterfall approaches. I believe this, getting clients and employers to understand and accept the benefits is more difficult.

Over the years I have seen a familiar pattern play out in Waterfall style projects. As the project nears or completes the Verification portion of the life-cycle, one of a number of things happens.

WaterfallBecause of the long(er) duration of time between the Requirements/Design phases and the Verification phase in Waterfall projects as compared to typical Agile projects there is often a period of frantic redesign and tweaking during verification.

This is caused by a number of issues but a frequent cause is the fact that the stakeholders that participated in the Design phases are gone by the time the Verification phase begins.

Or, the Stakeholders were not committed to the process and did not take seriously the necessity to actually design first. Remember this fact, it becomes important later.

One way or another, by the time your project reaches the Verification phase it degenerates into a series of recriminations, “thats not what we meant/wanted/needed”, meetings, and emergency changes in order to achieve what was really needed.

Waterfall development tends to exacerbate this tendency because of the longer timeline as I mentioned before. Agile development on the other hand tends to minimize this symptom due to its short cycle iterative approach.

(Agile development can also be abused to inject continuous never ending scope creep precisely because of its shorter cycles. Keep this in mind as well, it to becomes important.)

Iterative

Because Agile builds the design as it goes, with minimal requirements gathering, it usually results in delivering exactly what was actually needed. Its iterative approach allows the stakeholders to continuously fine tune their goals and design within a feedback loop that is typically very fast.

But if you are working with someone that wants to keep tweaking and tuning with no end in sight then you have entered the Agile “death spiral” and need to break out.

So no matter which methodology we use, we are often faced with a similar set of frustrations, both as developers, and stakeholders. The “Just one more thing” Frustrationsyndrome, or the “thats what I asked for, but it’s not what I wanted/needed/meant” syndrome.

In order to avoid these sources of frustration and project failure you need to deal with the “Economies” in software development.

Finally we are back to my friend Eric, he pointed out a general truth that applies to both IT projects and life in general.

Paraphrasing, Eric said something along the lines of. If something is free and seemingly plentiful, people tend to be wasteful and careless with it.

They will take more than they need, tend not to treat it with respect and in general not show appreciation for it. But when you make that same thing “cost” in some way, then they will tend to be more careful of it, take it more seriously, and treat it with respect. The trick is how to instill “cost” into whatever it is you are dealing with.

Design and requirements are often looked at as “free” by the business side, in the sense that they can continue to revise and expand on them, therefor they don’t really need to put a great deal of effort up front, since they know they can tweak and expand on them “once I see the product running”. In Watefall approaches that is a red flag that indicates the project is going to go over budget and exceed schedules. In Agile approaches that is expected behavior, too a point, but not when it becomes excessive.

So how do we prevent this in either method? Add cost to changes. Make the participants have to “pay” some kind of cost for making changes. This could be time or effort on their part. Have them participate in the design sessions and change sessions along with the rest of the team. Not going home on time, or loosing time in other areas of their life and work is usually an effective “cost”.

If it is a client that is making changes frequently or inappropriately, begin to micro manage their expectations. Call and email them about each and every step along the way, literally drown them in information and requests for clarification. Sooner rather than later they will realize that changes are costly to them, then you will begin to find out what is really important to them.

I am sure I will expand on these thoughts later. This is not meant to be an exhaustive comparison between design methodologies or project management and risk management approaches. Just some thoughts on the “Economies” of Software Development.

Cheers,

Robert Porter

 

 

 


 
Categories: Programming | TDD


April 10, 2008
@ 11:57 AM

I have recently had to do some script debugging, both client and server side and found some good resources on the topic I thought I would pass along. This is one of those things I have do remind myself of how to do from time to time. I typically use Firefox to debug Javascript, but there are times I have to do it with IE.

So below for my own reference as well as hopefully some one else's, are some useful links for debugging Javascript in IE.

Microsoft's Script Debugger can be downloaded from here.

Directions on using it are here.

Monica Rosculet wrote a great article about debugging script with Visual Studio here.

The source of most of this information came from an IEBlog entry that can be found here.

Hope this saves someone else some research time!

Cheers,

Robert Porter


 
Categories: ASP.NET | Browser | Javascript | Programming | Visual Studio


My first project at Ironworks also involves my first experience with Commerce Server from Microsoft. I had not previously worked with Commerce Server so it has been a bit of a learning curve.

I expect to blog about my experiences with this product as I reach a point where I have something significant to say about it. For now I am very much in learning mode.

The other technology areas this project involves are ASP.NET, Plumtree Portal, Javascript, and some BizTalk integration. With the exception of Plumtree I am familiar with the remaining technologies. May or may not post about Plumtree, as I have to say I am less than impressed. I think Sharepoint does a better job than what I have seen of Plumtree but will reserver final judgment for later.

Cheers,

Robert Porter


 
Categories: .NET | ASP.NET | Javascript | Programming | Commerce Server | C#


February 15, 2008
@ 08:20 PM

 

I am going to Code Camp RDU tomorrow. Hosted by ECPI and Trinug. More information is available here. It looks like it should be an interesting day! There are 5 tracks to attend so as usual I am going to miss something I wanted to see... sigh...

Trinug has been around for quite awhile now, and I have attended rather sporadically at best. I hope to be able to begin to attend more frequently in the near future. User groups are always a great way to network and meet folks to exchange information, tips, gripes etc.

I will post about what I learn and see at Code Camp when I get back, it's 7:00 AM - 5:30 PM.

TrinugHeader2


 
Categories: Programming | Trinug | User Group


February 12, 2008
@ 10:58 AM

 

I have stumbled on, been emailed about, or otherwise notified of several interesting new resources of interest primarily for Microsoft Developers. So I thought I would share them here.

MSDN Code Gallery

The newest addition to the ever growing collection of MSDN resources is the MSDN Code Gallery. The code gallery contains code of course, along with video tutorials, sample applications and lots of other resources. It supports user uploads as well, so count on the gallery growing over time. From a rather quick look see on my part it does seem to contain some worthwhile resources.

MSDN Reader

If you have used or seen the New York Times reader then you will instantly recognize the new MSDN Reader. It is a WPF based application that allows you to read MSDN Magazine online. It appears that you do not have to have a subscription to use this, however I am unsure if that will remain true. But it is certainly worth a look.

MSDN Windows Vista Developer Center

This site has recently been overhauled significantly and (to me) seems easier to navigate and find information on. The Windows Vista Developer Center is full of resources related to developing applications that run on Vista and take advantage of features available in Vista as well as the recently launched Windows Server 2008. Of interest on this site was the announcement that SP1 for Vista has been released to manufacturing. Most folks don't consider an operating system or application as truly viable until at least the first service pack. So if you have been waiting for SP1 to look at Vista, your wait is over.

Hopefully one or more of these resources will prove useful to you!

Cheers,

Robert Porter


 
Categories: .NET | Ajax | ASP.NET | Programming | Reviews | Tools and Toys | VB.NET | Visual Studio


 

I had need to be able to play a video file (both mpg and wmv) in a WinForms application recently. I thought it would be rather straightforward, and for the most part it was. However there were a few gotcha's I ran into so I thought I would document them here in case anyone else runs into the issue. Also, if anyone knows a better way please let me know.

One of the conditions I had to meet was that the video file had to play in a loop continuously, as the application is designed as a Kiosk application. Another condition was that I did not want to display any of the UI controls, just the video itself to avoid users stopping or otherwise altering the video playback.

I decided to use the ActiveX (COM) version of the control for simplicity, so I right clicked the Toolbox and selected the Choose Items option and on the resulting dialog box I selected COM Components, scroll down and select Windows Media Player: (Click on the image to see it full size.)

image

Once that is done we drop the control onto the form, and set it's properties as needed. Some of the properties that I set at design time are shown below:

image

Notably, I set FullScreen to false, and uiMode to none which means that there will be no visible interface, Play, Stop etc will not be displayed to the user allowing me to have more control over the end user experience.

It is important to note that uiMode is not a drop down in the designer, the relevant values for this property are:

  • invisible - Windows Media Player is embedded without any visible user interface (controls, video or visualization window).
  • none - Windows Media Player is embedded without controls, and with only the video or visualization window displayed.
  • mini - Windows Media Player is embedded with the status window, play/pause, stop, mute, and volume controls shown in addition to the video or visualization window.
  • full - Default. Windows Media Player is embedded with the status window, seek bar, play/pause, stop, mute, next, previous, fast forward, fast reverse, and volume controls in addition to the video or visualization window.
  • custom - Windows Media Player is embedded with a custom user interface. Can only be used in C++ programs.

I chose none because I wanted to preserve the option of allowing the interface to be shown for administrative users without messing up the visual layout, none reserves the space necessary to display the UI controls.

With the design time properties set I then wrote the following code to load and play a video file:

   1:          wmpMain.URL = mConfig.VideoFile
   2:          wmpMain.settings.setMode("loop", True)
   3:          wmpMain.settings.autoStart = True
   4:          wmpMain.Ctlcontrols.play()
 

mConfig.VideoFile is a string property that contains a fully qualified path and filename and is used to set the file to be loaded. The second line of code was the tricky part for me, searching for various combinations of .NET and play video in a loop etc resulted in lots of examples of embedding the player in a web page with an attribute called "loop" set to true, but I could not figure out how to implement that in a WinForms version.

Eventually I stumbled on the setMode reference which is rather vague when it comes to intellisense. The available setMode settings are:

Syntax: player.settings.setMode(modeName, state)

    Parameters

    modeName (one of the following)

  • autoRewind - Mode indicating whether the tracks are rewound to the beginning after playing to the end. Default state is true.
  • loop - Mode indicating whether the sequence of tracks repeats itself. Default state is false.
  • showFrame - Mode indicating whether the nearest video key frame is displayed at the current position when not playing. Default state is false. Has no effect on audio tracks.
  • shuffle - Mode indicating whether the tracks are played in random order. Default state is false.
  • state - Boolean specifying whether the new specified mode is active or not.

So in a nutshell that is the basics of getting a video (or audio) file to play in a loop in a WinForms application. There is a lot more you can do with the player, you can programmatically create playlists, react to events the player raises etc. But this illustrates the basics.

Cheers,

Bob Porter


 
Categories: .NET | Programming | VB.NET | Visual Studio


Microsoft has released a number of exciting new tools and technologies that certainly bear some watching! These are preview releases so the usual caveats apply about installing these on a production system.

The "home" page for Microsoft's Data Platform is here and it contains the most up to date information about the various shiny new pieces.

The main bits are ADO.NET Entity Framework Beta 3, ADO.NET Data Services CTP1, and ADO.NET Entity Framework Tools CTP2.

So what exactly is the Entity Framework? It's a toolset and framework that enables a developer to visually design and model data driven applications, both forms based and web based.

Collectively these technologies are part of the ASP.NET 3.5 Extensions which are in preview mode at the moment. Combined these technologies allow a developer to expose data from their applications in well known formats, some of which are not Microsoft specific such as JSON and REST and also in standards based formats such as XML.

There are a number of QuickStarts that the ASP.NET team has made available. Also as part of this release the ASP.NET MVC framework is available.

Go check it out!

 


 
Categories: .NET | ADO.NET | Ajax | ASP.NET | Programming | SQL | Visual Studio


Ray Ozzie proposed his concept of Simple Sharing Extensions back in 2005, and then more or less went silent. Until now!

Another Live Labs technology preview release arrived this week. It's called FeedSync and it is the current incarnation of the concept Ozzie developed to allow data sharing over web protocols like RSS.

The initial specification is available as version 1.0 at the time of this writing. It extends both the Atom and RSS specifications to incorporate item sharing which Microsoft defines as "bi-directional, asynchronous synchronization of new and changed items amongst two or more cross-subscribed feeds".

(Hmmm, calendar sharing anyone?)

The samples in the specification deal with a fictional task list example. Here is the code (emphasis added) for the sample RSS feed.

<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:sx="http://feedsync.org/2007/feedsync">
 <channel>
  <title>To Do List</title>
  <description>A list of items to do</description>
  <link> http://example.com/partial.xml </link>
  <sx:sharing since="2005-02-13T18:30:02Z"
    until="2005-05-23T18:30:02Z" >
   <sx:related link="http://example.com/all.xml" type="complete" />
   <sx:related link="http://example.com/B.xml" type="aggregated" 
    title="To Do List (Jacks Copy)" />
  </sx:sharing>
  <item>
   <title>Buy groceries</title>
   <description>Get milk, eggs, butter and bread</description>
   <sx:sync id="item_1_myapp_2005-05-21T11:43:33Z" updates="3">
    <sx:history sequence="3" when="2005-05-21T11:43:33Z" by="JEO2000"/>
    <sx:history sequence="2" when="2005-05-21T10:43:33Z" by="REO1750"/>
    <sx:history sequence="1" when="2005-05-21T09:43:33Z" by="REO1750"/>
   </sx:sync>
  </item>
 </channel>
</rss>

Notice the namespace reference sx=http://feedsync.org/2007/feedsync the "sx" prefix is the one designated in the spec.

FeedSync supports multi-master topologies which means it can be used to send and receive data to multiple clients. An example topology is shown below, (image from Microsoft's web site.), as you can see clients can be bi-directional or pull only.

feedsyncdiagram

The possibilities are many, I am already thinking about using this technology to allow calendar syncing between Google Calendar, and Outlook. Another thought that jumped to mind would be to allow sharing appointment data for a centralized calendar among a group of subscribers on a project I am working on.

Best of all, the technology has been released and licensed under a Creative Commons license which means the technology is likely to be extended.

The best place to start looking for developers is the FeedSync For Developers page.

Have fun! Share with me your observations and ideas!

Cheers,

Robert Porter


 
Categories: .NET | Mobile | Programming | Reviews | Tools and Toys | Visual Studio | XML


December 7, 2007
@ 10:01 AM

Microsoft has released a Live Lab's (Microsoft Research and Live Services) preview technology package called Volta.

Volta is a framework that allows a developer to potentially build a multi tier application initially as an client application, and then use a technique called "declarative tier-splitting" to identify which pieces of the application run on a server and which pieces run on the client.

This is accomplished by using and XML like declarative markup within the code. With this approach a developer can focus on getting the application designed and functional and then let Volta split the tiers and create the communications "glue" that lets the applications tiers work together.

How this is accomplished is rather interesting, Microsoft decided to go with an MSIL based approach, mostly accomplished in the post compilation area. MSIL code is rewritten to run in Javascript for the client, and ASP.NET for the server side, typically as a web service.

Since Volta works it's magic at the MSIL level, any CLR targeted language is supported, C#, VB.NET, IronPython and others. Visual Studio 2008 is required at this stage, 2005 is not supported and it is unclear if it will ever be.

So show me some code already!

The code shown below is from the Volta Recipe's page. It shows the [RunAtOrigin] custom attribute in use.

namespace VEMashup.Weather
{
    [RunAtOrigin]
    public class WeatherSvcProxy
    {
        public string GetJsonWeatherInfoFor(double lat, double lng)
        {
            var baseUri = @"http://ws.geonames.org/weatherIcaoJSON";
            var uri = baseUri + "?lat=" + lat.ToString() + "&lng=" + lng.ToString();
            var xhr = new Microsoft.LiveLabs.Volta.Xml.XMLHttpRequest();
            xhr.Open("GET", uri);
            xhr.Send();
            if (xhr.Status == 200)
                return xhr.ResponseText;
            else
                return null;
        }  
    }
}

 

This is an example of "tier splitting" via markup. This tells the Volta framework that this code is destined to run on the server. Code not marked will continue to run on the client. This means that as a developer you can postpone deciding how and where to partition your application until the last minute.

The agile developer in me seriously enjoys this particular aspect! Volta technology is seriously early in the life cycle however, so bear in mind that this will change before it gets released.

There is a handy list of known issues you should review before you start playing with the framework.

You could think of Volta as architecture refactoring on steroids. As shown below Microsoft has designed it explicitly with that in mind. (Image from Volta Web Site.)

image001

Bear in mind that you are not limited to 2 tiers, you can retarget portions of your application to as many tiers as you want!

All in all I think this bears some watching!

Cheers,

Robert Porter


 
Categories: .NET | Agile | ASP.NET | Javascript | Programming | Reviews | TDD | Tools and Toys | VB.NET | Visual Studio | XML


November 27, 2007
@ 11:36 PM

No matter how agile your development practices are, and no matter how skilled your team is, you can still generate a failure.

There are some sure signs you are headed for a failure that you can watch for. One of the most obvious and common is when deadlines are set without regard to input from the development staff.

Artificial "drop dead" dates are always a sure sign of trouble to come. It is especially worrisome because it is so prevalent. I have participated in a number of projects where the milestones, phase durations etc, are set in stone before all of the analysis is even complete.

A common scenario, particularly in "internal" non commercial projects is that the business unit identifies a desired set of functionality and delivers the desire in the form of a loosely defined set of requirements, accompanied by a delivery date that is usually wildly optimistic.

I actually worked for a company where the development manager was fond of saying: "The customer will settle for 80% of the desired functionality."

This is far more common than anyone would like to believe. And the particular company I am speaking of is still developing internal projects with the same mentality 10 years later. (I am no longer there, but people I know still are.)

The result of this "settle for" mentality is that there is a loss of confidence in the development group by the customer, and a sense of hopelessness in the developers that becomes pervasive. Most developers leave, a core group will stay until they burn out, but by and large these teams are marred by high turnover rates, low morale and frequent re-organizations.

Do you work for a settle for group? Any idea on how to combat this from within? Please share your thoughts!

Cheers,

Robert Porter


 
Categories: Programming | Ramblings | Rant | TDD


November 16, 2007
@ 04:00 PM

I just came across this site and the resources contained for the first time today! Thanks to post by Robert C. Cain better know (at least by me) as Arcane Code.

Take a peek at the .Net University web site and materials, it is well worth the visit!

The available courseware is freely downloadable and they allow it to be "re-delivered" to technical audiences.

Their mission statement gives a pretty good idea what they are all about:

Welcome to .NET University! Our mission is very simple. We want to give you a good developer-oriented overview of new and emerging Microsoft technologies.

This site has been added to the bookmarks!

Cheers,

Robert Porter


 
Categories: .NET | Programming | Rave | Reviews | User Group | Visual Studio


If you write code for a living, no matter what language, flavor, or IDE, sooner or later you begin to develop/write code to a set of unwritten rules that experience has taught you. Sometimes these rules are based on great, hard won lessons, wrested from spectacular failure or success. (Both failure, and success are great learning opportunities.)

Other times they are holdovers from some other project or something you learned from someone else. Or even something you just do but can't explain. My favorite story about the genesis of those kind of rules is as follows.

Child watches Parent making a meatloaf, after the meatloaf is made, Parent takes it out of the pan and cuts about 2 inches off one end and then puts it in the oven. Child ask's Parent why they always cuts 2 inches off the meatloaf? Parent pauses for a moment and says they are not sure why, but their Parent always did that. They decide to call Grand Parent and ask them, Grand Parent thinks for a minute and says it's because their Parent also did the same thing. A quick IM to Great Grand Parent asking why this was done results in the response: "Cause my oven was small and a full size meatloaf would not fit!"

Sometimes, we continue a practice out of habit, not because the need is still there. Most of the time this is fine, but sometimes we unconsciously propagate a behavior or methodology that has lost it's meaning or usefulness over time. Sometimes even to our detriment. It is useful therefor to question why we do things the way we do every now and again. A few moments of introspection can lead to an "Ohhhhh" moment.

I recently experienced such a moment when I was explaining some code I had written to another developer. Once I had finished my explanation they asked me a series of questions about why I did it this particular way as opposed to another. My knee jerk response was "because it's the best way" followed by an unspoken "that I am aware of".

The discussion continued and I soon learned that the method I was using was not only obsolete but was potentially dangerous because of changes in the underlying structure of the language I was using. Changes I was not only ignorant of, but which made a much more robust solution possible.

The method, involving collection classes, that I was using was one I had been using in one form or another for years. I was so comfortable with it, that I had ceased to question it, or look for alternatives. I had developed a blind spot when it came to that particular topic because I was so deep in my personal comfort zone that I subconsciously did not want to move away from it.

This is also an example of the benefit of pair programming, TDD and agile methodologies. To a lessor extent the same results can occur in any team environment. Looked at another way it is an example of why solo developers sometimes do not fare as well. Not having a team to bounce ideas off, or to have question and challenge you on assumptions and approaches can often lead to practices that become bad habits.

That is not to say that all solo developers progress less slowly or that all teams progress better. There are plenty of examples out there of "Toxic Teams" and solo Super Hero coders. But it is nice to be exposed on a daily basis to others points of view, experience and skills. You can derive a lot of the same level of benefit, albeit less interactively, by reading blogs, and participating in development forums all over the net.

But every now and then, solo or team member, you should stop, reflect, and refactor your own thinking process and assumptions. Weed out the things that no longer work for you, and try and replace them with things that do. Learn something new, test it against your own experience, if it seems to fit consider making a new habit to replace an older one!

Cheers,

Robert Porter


 
Categories: Agile | Programming | Ramblings | TDD


I was recently refactoring some code in a Web Service that is called by numerous external consumers as well as internal clients. As we all know when you publish an interface you are more or less signing a contract not to change that interface. This becomes even more of an issue when clients outside of your organization are calling your code.

Or perhaps you have written and distributed an SDK or API that is used by others to access functionality in your application. Either way, you change such public facing interfaces at your peril! It's why you often see method names like the following in public SDK's:

ShinyMethod
ShinyMethod2
ShinyMethod3
NewShinyMethod

This results from having realized, after the fact, that your public interfaces were unable to do something you want/need them to. Or perhaps something you are calling changed and now you need more information or different parameters than before. Whatever the reason since you signed the contract, you had to implement different methods leaving the old ones intact so that you don't break every caller instantly during your next update.

This is a legitimate response to a common problem. Now don't start screaming at me about better design, overloading methods etc. I know there are dozens of ways to tackle issues like these. I am using this as an example about how to notify your callers that you are about to "renegotiate" your contract in a gentle kind manner!

So, let's say you have a method, called MyShinyMethod that takes two integers and a string as parameters. For 6 months or so that method has sufficed to handle it's intended function. Then one day you get a call from accounting telling you that now you need to handle two integers, 1 string and a double! Ah, you say, no problem and add an overload to your method.

Then, sometime later accounting and marketing call, now the calling programs need to be able to pass 2 doubles, 3 strings, and a boolean and return an XML file.

Ok, you see where this is going, you really can't continue to handle this with overloads, and what you really want to do is change your public interface. But you can't do that, at least not immediately. So we need a way to tell all our callers that we are going to change our interface. In comes the "Obsolete" attribute.

You build a new version of you service, with the existing public methods you had, and you add a new even shinier method called MyNewShineyMethod that is designed to take just about anything and return even more!

Now we need a way to notify existing clients that there is a new method in town, and that the old method will soon be leaving!

Your old method would look something like this:

Public Function MyShinyMethod(ByVal int1 As Integer, ByVal int2 As Integer, ByVal str1 As String) As Boolean
     'do something cool here
     Return True
End Function

 So now you add your new method, and need a way to tell your callers that they should start to use the new method, and get ready to stop using the old one:
 <Obsolete("This method is not so shiny anymore, start using: MyNewShinyMethod")> _ 
Public Function MyShinyMethod(ByVal int1 As Integer, ByVal int2 As Integer, ByVal str1 As String) As Boolean
'do something cool here
Return True
End Function
Public Function MyNewShinyMethod(ByVal params As Collection) As String 
'do something cooler here
Return ""
End Function

Now when users compile their applications that call your service, they will get a warning error if they are using the old version with the text you supplied with the Obsolete attribute. They can still compile run and call the method, but they will begin to see the "error of their ways" in the form of compiler warnings.

Now, eventually you want to be able to "retire" the not so shiny method. Change the attribute as shown below, and instead of warnings, the caller will get Errors!

 <Obsolete("This method is no longer available, use: MyNewShinyMethod instead.", True)> _ 
Public Function MyShinyMethod(ByVal int1 As Integer, ByVal int2 As Integer, ByVal str1 As String) As Boolean
'do something cool here
Return True
End Function
Public Function MyNewShinyMethod(ByVal params As Collection) As String 
'do something cooler here
Return ""
End Function

By adding the "true" parameter we are telling the IDE in the calling applications to flag this as an error and not allow compilation. But the error message shows the caller what to use instead!

Hope this helps!

Cheers,

Robert Porter


 
Categories: .NET | Agile | Programming | Visual Studio


October 25, 2007
@ 10:38 AM

Ever been stepping through code using F10 and F11 and forget to step over something that you did not want to step into? Like a whole series of Get/Set calls on a bunch of properties for a class that you know is fine?

You can control what the debugger steps into by using method attributes and decorations. Using these you can essentially make parts of your code invisible to the debugger.

The first one I want to discuss is the <DebuggerStepThroughAttribute>. Using this attribute will prevent the debugger from stepping into the code it is applied to.

VB.NET

Private ReadOnly Property LastName() as String
     <DebuggerStepThroughAttribute()> _
     Get
           LastName = m_LastName
     End Get
End Property

C#

private string LastName
{
    [DebuggerStepThroughAttribute()]
    get
    {
         LastName = m_LastName;
    }
}

With the above you can still set a breakpoint inside the methods and execution will stop when the breakpoint is reached. If you want to make the code completely invisible to the debugger including not being able to set breakpoints then use the second attribute.

<DebuggerHiddenAttribute>, This attribute will essentially hide the methods it is applied to from the debugger entirely. 

 

VB.NET

Private ReadOnly Property LastName() as String
     <DebuggerHiddenAttribute()> _
     Get
           LastName = m_LastName
     End Get
End Property

C#

private string LastName
{
    [DebuggerHiddenAttribute()]
    get
    {
         LastName = m_LastName;
    }
}

Note that in order to get the debugger to honor these attributes you need to turn off the "Just my Code" option in Tools|Options|Debugging Options.

Oh, and finally you need to import the System.Diagnostics namespace for this to work at all.

Hope this helps, I know I use it a lot, once I knew it existed.

Cheers,

Robert Porter


 
Categories: .NET | Programming | Visual Studio


October 24, 2007
@ 01:51 PM

Ok, I know I promised I would post about but to be honest I am not sure I myself fully understand the difference or need. Mock objects are easy to understand, but I have yet to find two people that agree on the definition of Virtual vs. "regular" Mocks.

Wikipedia has entries for both Mocks and Virtual Mocks, but at least at the time I write this there was little to no content on the Virtual Mock entry. The main difference would appear to be that Virtual Mocks can Mock a concrete class, while normal Mocks are used to simulate the interface only.

More on this as I learn more. But my use of Mocks in TDD has been pretty much limited to interface level work. There is a huge and at times, nasty debate in the blogosphere relating to Mocks, particularly as they relate to coupling issues, Dependency Injection (DI) and issues. Which also ties into the growing debate on "design for testing", which means that you write your code to facilitate testing from the start.

I honestly don't have the required background to register a viable defensible opinion on all of these issues. What I can say is that using TDD and Mock's has enabled me to produce better quality software, faster than I ever have before. With fewer debugging sessions, and as an added benefit it tends to make me write code that is easier to refactor later to introduce new features etc.

One of my most memorable moments in my journey along the TDD path of discovery was when I had to add significant new functionality to an existing application that I had written. The application had existing tests, with probably close to 80% coverage.

I made the first round of changes, ran the tests, had two failures, refactored the new code to get the tests to pass, added a couple of new tests related to the new functionality, fired the tests one last time, all green! Turned the code, with confidence, over to QA and testing and was done! It was a personally very satisfying moment. Previously I would have held onto the code for at least another two or three days trying various combinations of simulations and debug stepping and then been still unsure of the state when I turned it over.

Mocks come in very handy for me when I want to decouple the system under test from dependencies that are expensive (Database calls, Web Service Calls), or ones that don't exist in any form except for production. (I have worked for clients that could not or would not set up a complete DEV/TEST/PROD triad of environments, and in some cases, some systems only existed as production instances.)

Remember, when you are testing and developing you are testing your code, not performing integration testing of the whole system. That comes later.

Mocks also come in handy for cases when you need to test your codes response to what is in essence a "black box call" to a component or system for which you don't have code, or don't have the access etc. In short Mocks help me focus on my code and the system under test and not someone else's.

In an upcoming post I will show some examples of how and when I have used Mocks. And attempt to explain the thinking I went through in deciding to use a Mock, and how to implement the Mock etc.

Meantime, keep the questions coming!

Cheers,

Robert Porter


 
Categories: Programming | TDD


Scott Hanselman and ScottGu did a recent public presentation on the new Model View Controller Framework implementation that Microsoft is developing.

Scott has a