Development
Posts about .NET software development
Just a quick note on add-ins and the VS2005 Project Templates Cache. I have a collection of custom solution templates which i have quite happily been using both directly in Visual Studio as well as through add-ins (programmatically accessing the location of the cached template on disk). One thing i just ran into was the issue that when i installed GAT and GAX (Feb 07 CTP), the entire cache disappeared. (it could also have something to do with installing Resharper 3.0 - but i doubt it cos i have come across a couple of posts where people have had all the standard and custom templates disappear after installing the WinFX extensions -at least mine didnt disappear - they just couldnt be accessed programmatically).
Anyway, i tried reinstalling them using the
devenv /installvstemplates command but that didnt work either. Those of you who have created add-ins would recall that the cache is in the Environment.SpecialFolders.ApplicationData folder and the
installvstemplates command usually rebuilds that folder. When i ran the add-in VS just complained helpfully that "the index did not fall within the range" :-).
It appears that the solution/workaround to this issue is to do the
installvstemplates as above, then open VS and add a new project/solution making use of your custom template (but dont do this via the add-in - just use the regular menu options of the IDE). This seems to kick-start VS into life and the ProjectTemplatesCache folder gets rebuilt nicely and the add-in should start to work.
I have no idea why this happened, but if you get stuck with this issue, hopefully the steps above will help you.
So by now most people would have heard about the ruckus that's going on in the blogosphere regarding Microsoft and Jamie Cansdale's TestDriven.NET tool. In case you haven't heard, the issue, as I read it, is that Jamie found a way to make the TD.NET add-in run inside VS Express and Microsoft sent him a formal letter asking him to stop making this available. The issue Microsoft has is not with TD.NET as an add-in or whether its a free or commercial tool but the fact that it is being used with Express and that's something they don't want to encourage and have said that extensibility is disabled by default in Express.
Predictably, this issue raised a lot of hackles in the community and many people took this as an opportunity to aim more broadsides at Microsoft. There were some good points in some blogs (check out one here and look for some of the posts and comments on Oren Eini's blog here and also Dan Fernandez's blog -one of the posts being this and Jamie himself lists the communications here) but amongst those pearls I was disappointed (but not surprised) to find just loads of vitriol. Some people see it as a hack and some as a legitimate back-door and some say that if there is an API on the machine, they are going to use it and MS cannot stop them. (By that logic, you could be releasing any additions to windows that were unsupported just because the system DLLs are on c:\ drive, and expect MS to sit back and smile indulgently)
Now let me state first of all that I really appreciate Jamie's add-in. I cut my teeth on unit testing and TDD with that tool (nowadays i use JetBrains UnitRun), and it was very useful indeed. I can see how using this in express will open up the world of TDD to hobbyist developers and others who don't use the higher end editions, and this can only be good for the programming community in general. However, i can also see Microsoft's points. I have written a couple of small add-ins for my team and find VS Extensibility quite easy and the possibilities are almost limitless. If MS were to allow Jamie's tool, lots of other tool developers will jump on the bandwagon and write add-ins for Express and pretty soon it will become a little Eclipse-like ecosystem on its own. If that happens, where will that leave VS Standard and higher end editions? (Yes, there is an argument for supporting unit testing in express and exposing newbie's and non-pro dev's to good programming practices, but how do you draw the line?)
This is just plain business considerations folks. Microsoft is not running a charity. Sure, there are good groups in MS like PAG who want to make things easier for architects and developers and are producing a ton of free stuff that helps us get better at what we do (yeah, so some people don't like the patterns and the wizards, but there's a rather large part of the .net world that does), but MS is first and foremost a business and profit is primary and there's nothing wrong with that. How will they sell Visual Studio commercial editions if Express could be used to do everything that, say, Team System does? Of course, not all third party add-ins are going to be free and ISV's are bound to continue the tradition of having some free editions and some paid for 'rich functionality' editions, but there are some top notch developers in the open source community who could whistle up some free add-ins that trump the commercial ones. So where will that leave MS? What about all the hard work the IDE team is putting into Orcas and Rosario and whatever comes after? Does it have to be free? (Okay, so I benefit from a corporate MSDN subscription and should i ever have to pay for the tool myself then shelling out for VS,especially some features of VSTS, would burn a rather large hole in my pocket, but that's another story).
Express is Microsoft's entry point into the non-pro developer world. They could have engineered a completely new locked down product where there were no DLLs in the GAC or anything for people to tap into, but perhaps that would have cost more than just stripping out some functionality and making a "lite" edition like Express is. As someone pointed out (cant remember where), this could well result in MS pulling the express line completely and that wouldn't be good at all.
Anyway, that's my two cents worth (and no, I'm not getting paid to write this !!). In summary I'd say to these parties , "Jamie, well done with TD.NET and well done on getting a huge groundswell of support especially from some of the more articulate developers around", "Microsoft, there are folks who understand your position, but it could be made a bit more clear without bringing in lawyers against well meaning developers" and to the general community "Folks, there's always a wide audience for well written comments no matter whose side they are on. Make a clear stand and stop the sniping and broadsides just because MS is a huge,obvious target.".
Ciao!!
Finally, something on practical application design without all the academic theory. Most of the articles i have got to read on the subject of writing maintainable code are just long winded theory stuff about interfaces and mocking and DIP etc without actually being concrete and understandable. But now, heres a brilliant explanation from Jeremy Miller on writing maintainable code replete with a real life example and some extra scenarios and thoughts thrown in.
Check it out at
http://codebetter.com/blogs/jeremy.miller/archive/2007/01/08/Orthogonal-Code.aspx
Now if only more people could explain refactoring and design patterns in that way, it would make that world much easier to get into.
I spent a rather interesting day at Microsoft , Reading at the Grey Matter Architect Forum. The focus of todays sessions was all about how other companies/partners are using VSTS and extending it. Heres some of my thoughts on the sessions today and on some of the things that sort of emerged along the way (at least, in my mind).
(1) MSF and VSTS: The session was by far too short. Alan Cameron Wills is a very engaging speaker and this talk came across very well. The first half was familiar territory since i have been looking at VSTS since TechEd 2004 and started using it recently. It was good to see that MSF is getting into the Factories space so that the process guidance can be tailored to fit with the factory approach. It would have been good to delve into more detail about what MS's plans are but we didnt have enough time. There were a couple of things that came up in the Q&A session at the end where Alan indicated that the CMMI template will have enhancements because MS is working with SEI to make things better. I gather that some extra stuff will also turn up in the Agile template. He did make a good point that we arent really expected to use the entire process template as is and that most companies will resort to customizing it in one form or another. As such, the out of the box templates are only a starting point, and they dont claim to be the final word on how you implement your process, so whatever enhancements MS provides would be cool but not something that should stop us from getting on with things now. Although the process templates are customizable, i gather (from other articles and books) that in the currentl scenario, this is not for the faint of heart. MSF is moving to a more 'composable' approach where instead of siloed "Agile" or "CMMI" templates, there will be a solid catalog of practices to choose from to make the process you want. There, of course, needs to be validation to check that we dont come up with some weird unworkable combination of practices.
I like the way VSTS chucks a ton of work items at you when you instantiate a team project. It gave me a lot of food for thought when starting a recent project. Its quite common to look down the list and think "Ooops!! forgot to sort that task out" so it helps keep you honest and on track. One thing I personally would like to see is "
Project Profiles". What i mean is this: if you take a large SOA project, when you instantiate it in CMMI and Agile (for instance, SCRUM) , what does the guidance look like? how does it differ amongst the two templates? what do the out of the box iterations look like? what do they say you should focus on first and what you should avoid? Similarly how about a B2B or a B2C project? what are the best practices there? when should we rely on the factories and when should we look elsewhere? This would be very helpful in figuring out which approach you want to take for your particular project. I guess that for very experienced architects the answers would be obvious, but this would be a solid fallback and a guide/checklist for those of us who arent exactly gurus in this.
(2) SCRUM and VSTS: Colin Bird from Conchango presented this. As quite a few people know, Conchango developed a SCRUM plugin for VSTS (collaborating with Ken Schwaber). Actually I didnt know it was free till today. Now i gotta go download it !! It was quite a dep talk on how to scale Agile with VSTS. Since I am not all that familar with Scrum (i mean i know what Sprints are etc but not very much more), i cant really comment on the content but it was quite interesting to hear what they have learned from large projects (some distributed and some co-located). These talks make me feel rather wistful sometimes. I wish I could be in a project where you can just have a quick/solid planning workshop and then go heads down in development while someone sorts out the impediments for you. If things arent fitting in the sprint, re-prioritise with the involvement of the client and move it to the next sprint. Wow!! I've heard this from many people including some of my friends who've worked with companies that are very heavily into Agile methodologies (names withheld). This has never happened to me. Its always been the case that my clients want the stuff done fixed price and they have commercial deadlines so they have to know when we are going live before we start!! Im sure im not alone in this!!
(3) Select Perspective: Rather all-encompassing toolset. I've heard a lot about it so it was good to see a demo. I did however disagree with the label "agile" applied to it by the speaker. I will agree that its adaptable and that we need to be more adaptable and flexible in the way we pick our processes and practices for the type of project at hand and it that sense the toolset with its collected "executable wisdom" helps us to be "agile", but this much of a modelling heavy environment surely cannot be a proper "agile" candidate can it? Isnt one of the main principles of agile to focus on working code rather than heavy documentation and models? If we spend so much time working out various architecture models then wheres the code? which stakeholder is going to pay for pictures? Now dont get me wrong. I'm all for setting out a blueprint before coding and detest the cowboys who plunge into code without a thought to the overall architecture.(okay, so if the whiteboard or the metaphor is enough and your stakeholders are happy with that, go for it!) My clients need to know how the system is broadly going to function and what the moving pieces look like at a high level and in my opinion any architect worth his or her salt who has worked in a particular domain for a while should be able to provide this info without having to first write a hundred unit tests and all the code for it. And im sure that the MDA camp would say "yeah, but spend time on the PIM and push the magic button and voila, its the PSM/code, so you havent wasted any time making that nice pretty UML model ". Something doesnt feel right to me. However, im not slagging off the toolset per-se. It looks quite solid and very formal risk averse environments would enjoy using things like that. I just dont think it should be labelled "agile".
(4) Essential Unified Process: Star Wars!! The Empire strikes back!! It looks like this is the return of the unified process albeit in a more "developer friendly" way. Take heart young Jedi, your process guardian is near!! IMO, the most outstanding thing (which unfortunately was only alluded to and not demonstrated) was the "intelligent agents", your persona/role buddies who can take on some of your workload in producing/reviewing artifacts etc, but otherwise nothing really stood out. Sure, its looks cool that you now have electronic storycards in VSTS and its nice to know that all the process vendors recognise that people are going to mix and match and are opening up their toolsets to allow this. IMO, this is a big plus and boost for Microsoft (but thats a post for another day). But for the folks who like the EssUP approach and who are investing in VSTS, this integration is sure to mean a great deal.
Now, how many feathers have i ruffled today?
For a change I'll get off my Biztalk and BizUnit Soapbox and write about different things.
(1) First up is the
Web Service Software Factory: Just downloaded it a couple of days ago and watched Don Smiths webcast. I must say its brilliant stuff. I've been using WSCF for a while but that just builds the ASMX facade (and does a pretty good job of it too). I've been looking for something that could go all the way down through the layers and into the database and it looks like i've finally found it. It was interesting the way we can either generate the business objects from the tables if we already had a database as well as generate database entities from the classes (he didnt actually show this but theres a menu option i need to explore). Its also good that we can collapse the code into a single project if needed instead of having 6 separate projects (although I prefer the latter). It's use of Enterprise Library was also good.There was some
controversy earlier about the patterns it uses, but IMO it does an excellent job and if you dont like the patterns, change the T4 templates and use whatever pattern rocks your boat!
(2) Next up is
EasyObjects and MyGeneration : Very impressed with this too. It took hardly 3 minutes to generate all the CRUD stored procedures and the business tier AND use Enterprise Library. Decent stored procs and decent code. Wasnt too comfortable that the abstract business classes had an underscore to start their name, but im sure that can be changed in the template. The thing is CRUD is usually quite simple and it would be interesting to see how it works with custom stored procedures that act on more than one table. What happens to the class corresponding to this new composite SP in terms of the object model and its relationship to other classes? Does the design still remain valid OO (although some purists might argue that if we are generating from the db then we are hardly doing actual OO, rather we are in a data driven object world). Wonder what you folk think about this?
(3) Third up is
SubSonic: I finished the introductory webcast to Subsonic just about 10 minutes ago and was nearly blown away by its simplicity. The BuildProvider with the classes all hiding in the background seemed rather like magic. I was on more comfortable ground with the class generator and batch class generators actually as that can be used to build an entire Domain layer or Business Logic layer. The scaffolding for "admin" screens is also really nifty. Since this is inspired by RAILS, i think i better start looking at Rails myself. It must be really something, just reading about it on blog articles at various sites and finding how people are going crazy over it. I have pinged the owners to see if we can get a strong named version of the ActionPack DLL so i can use it in my Biztalk projects when i need to call out to custom class libraries since BTS needs stuff to be strong named and placed in the GAC.
Im now rubbing my hands in glee. More toys for Christmas!! Now which shall I choose for my long term work? Since my immediate project is in .NET 1.1 and BTS 2004 , EasyObjects is the only one i can use. However, there are some other projects kicking off in .NET 2.0 /BTS 2006 as well, so i can move into the WSSF for the services and then use SubSonic for the general business+data components and possibly in the ASP.NET apps as well, although it will run into strong competition in this area (at least in my projects if not amongst the general populace) when the Web Client Factory is released. IMO, Subsonic is definitely more lightweight but it isnt a complete factory either. WCSF needs us to use workflow foundation for complex page flows so it seems more suited for the complex heavy hitting apps, but lets see how it turns out.
If you havent seen these tools in action, do check them out. The WSSF webcast is only an hour, EasyObjects takes a few mins and the Subsonic webcast is 20 mins.. In 2 hours you can have more options at your disposal than days of researching!! Enjoy!!
After a few months of being NAnt infected, I'm at another crossroads. Now that we are starting up on the .NET 2.0 world and are seriously considering the whole VSTS package, MSBuild is a big contender for the building and CI backbone. We didn’t actually get round to using CC.NET in the first phase of our integration project as the team was new to unit testing and automated builds etc, but we've made some good progress and have more or less sorted out an automated build and CI is the next step so Team Build may have its uses there.
We took inspiration from Scott Colestock's deployment framework and built a decent build and deploy engine and are now refactoring it to be more generic. In the beginning, since Nant was quite new to us, I didn’t make complete use of Scott’s tool as-is, because it would have been a big learning curve and with multiple solutions I didn’t like to have to put the deployment framework folder in every single solution. I guess I could have modified it to take stuff from a central location, but hey, those were early days and I was moving away from a batch file centric BTS deployment that I had used till then. Ironically, while generalising the engine now, we are finding that it looks very much like Scott’s, so maybe we’ll move back to Scott’s tool and he has upgraded it to work with v2006 as well.
But that brings us to the crossroads now. Do we throw away our investment in Nant and move off wholesale to MSBuild? What does MSBuild have that could make it worthwhile?
On the surface, it seems like there isn’t very much going for MSBuild. The Nant community is very strong and there are heaps of tasks for various things. Added to that, I think the script is quite expressive and although I haven’t written custom tasks yet, I gather that they are quite easy to write. However, the UK SDC of Microsoft has been going hammer and tongs on this aspect and the Enterprise Solution Build Framework is quite impressive. Guy Smith-Ferrier showed some of the tasks in the SBF at the recent VBUG conference and I was surprised to see how big the task library has grown. The MSBuild script is very similar to Nant too, so if we needed to convert, we could write XSLT and convert most of it.
From the Biztalk aspect, there are a ton of tasks that are coming out from MSBuild. Stephen Thomas deals with some of them in his article here. Since our architecture revolves around Biztalk, this will be a key factor. Right now its all command line based and having to explicitly start, stop and remove ports associated with orchestrations is mind numbingly painful and very difficult to keep in sync. We were planning to take some of the examples shown in the MS Applied Integration Baseline (which contains a C# deployment engine for BTS) and write more custom tasks to slim down the Nant files and make them more reliable, but the MSBuild library is very tempting indeed. Hmm… how about a Nant container for MSBuild tasks? (!!)
One of the irritating things about Biztalk is that you cannot build it without Visual Studio, so there’s no option but to call DEVENV from the command line and that slows down compilation of large solutions. The problem still exists with MSBuild, and that’s a real minus, in my book, for the BTS and VS teams. They should have done better. Well, there’s still time. MSBuild is only v1.0 and maybe the BTS team will get this sorted. (Another annoyance is that if you want to change the assembly version or file version, you have to crack open the btproj file cos theres no AssemblyInfo.cs file for BTS. We are going to use the Nant xmlpoke task to do this).
There are some irritants though, with MSBuild. Steve St.Jean has written about its failure to work properly with secondary references. Actually if you haven’t seen that article, check it out. Apparently MS recognises the limitation, but, get this, instead of enhancing MSbuild, they want to dumb down VS so that VS stops recognising secondary references. Doh!!! Homer Simpson moment for MS !!
Theres an interesting discussion on Nant vs MSbuild at the MSDN Forums. In particular, Faisal Mohamood’s post there is a nice explanation of the positioning of MSBuild. But the forum posts also reveal problems such as the limitations with solution file structure and so on.
So, its rather tricky right now. If VSTS plays nicely with Nant (and I don’t see why it shouldn’t, but you can never tell) I might just stick with Nant for the next few months and undertake to write more custom tasks for biztalk or convert the MSBuild tasks to work with Nant (hope that isn’t unethical?) and eventually when MSBuild matures and there are tools which can help us with the migration, I may switch over to MSBuild.
Do feel free to comment if you want to share your thoughts on the subject.
I replied to a post on this subject earlier and then decided i'd make it a full blown post of my own. Here are my thoughts on VSTS and open source alternatives. A comparison matrix would probably be a better representation, but i'll wait till i collect more information and then produce one.
Before going on, let me state that I am fully aware that there are many folk in the agile world, for whom a daily scrum and a whiteboard/flipchart (and possibly a wiki of sorts) + an assortment of stuff like Nant, nunit, ndoc etc is enough collaboration and info sharing for the entire project. I respect that (and will probably blog about dev philosophies later) and the rest of this post is not for them. This discussion represents the visual tools driven approach.
I think that for the most part the TS features are mirrored by open source alternatives(MSBuild does have some way to go to get as comprehensive as NAnt/NantContrib) and there isnt an official MS version of CC.NET either (although there are some articles appearing on how to do CI in VSTS). Not sure of what the open source alternatives are for Team Test (load test etc).
However, i think a key selling point of TS is its project portal, integrating VStudio tasks with MS Project and Excel as well as TFS work items, display of bug reports and status directly in the project portal and so on. I dont think there is any open source offering that matches that.
Having said this though, we need to see how exactly this integration is going to pan out. For instance, how low level must your tasks in MS Project be to have relevance to the developer.? and then again, if your tasks are that low level, perhaps they shouldnt be there in MS Project. I believe in planning a project properly and assigning tasks to developers but i prefer to keep them at the use case level or story level rather than down to components or lower. VS tasks are too low level for my taste, although an alert system to notify developers that TODO's and other flagged things are still pending is quite useful. Earlier, in my company, we had integrated CVS with Bugzilla but now we use SVN and JIRA and they arent integrated.
Also dont forget that the SOA designer and its extensibility is worth a lot to architects especially as DSLs start to take root in the larger developer consciousness. The SOA designer,deployment designer and SDM is also a part of VSTS (okay, its part of Team Architect but there are plans to extend this well beyond into deployment packaging, possibly integration with Application Center and so on) , so this has to be factored into the comparison equations. Where is the open source alternative to the designers?
I guess theres a lot more but thats all i could think of for now. Comments and feedback would be welcome. I think we would all benefit (yes including MS) if there was an open source alternative in the .NET world to give VSTS a run for its money which would spur more innovation and improvements in the products. There, I'll stand down from my soap box now.
I'm probably a little late to the party, but if there are others out there who havent read this before, go and take a look at Scott Bellware's post. MS recently published (and promptly took down ) an article outlining guidelines to TDD and created a huge storm of protest. As Im not an expert on the subject, all I can say is that Scott's post and the comments to the same as well as others on sites such as ObjectMentor have explained quite painstakingly why the MS bunch who wrote this have scr**d up.This is quite a pity as i was hoping the 'recognition' of Agile Development in VSTS would actually help the developer community instead of some folk trying to force a VS view of the world into development. Whats even more disturbing is how this conflicts with some of the well written articles from the P&P folk and other good bloggers from MS.
But one of the most interesting statements from Scott is as follows: "You simply cannot achieve the aims of Test-Driven Development if you start with sweeping assumptions of the structure of classes before you set down the kind of code that incrementally validates your assumptions.
If a developer leaps to conclusions about design of a class or family of classes, he will have missed the optimal design of the class. As the implementation of a class deviates from its inherent optimal design, implementation and maintenance costs for that class increase exponentially as the effort to cajole misshapen classes together into a system of misshapen classes increases. This increase in cost an effort is compounded by the number of classes in a system. Most codebases can’t sustain this pressure for too long and they are often disposed of and re-written entirely from scratch – using the exact same development methodologies that caused them to degenerate into entropy to begin with. "
I think thats a great way of putting it.
So we finally got rid of VPC completely because of the problems with Yukon and rebuilt the box with Windows 2003. Now everything connects properly. We've started a couple of sample applications to run through the features.
Since there are two developers on this work we've split it such that I check out Team Architect and my colleague checks out Team Developer. We'll then try out stuff like MSBuild and see how that goes.
I'm still around. The folks at CodeBetter dont seem to want to give me a blog, so I'm going to stick around here for a bit. Donny has disabled some file that deals with comments so the spam has reduced now (only 2 yesterday - or maybe that was before he disabled it.)
So I finally hit the Whidbey and Yukon trail and am stumbling a bit now. I'm using the DVD set i got at the DeveloperDeveloperDeveloper event.
Using the install guide I managed to get the base products installed. My config is : DELL workstation (1 GB RAM) running XP and Virtual PC 2004 running Windows Server 2003. TFS is on the VPC and the VS 2005 tool and the client are on the main workstation.
The problems are
(1) There is not enough documentation (or not enough GOOD documentation , more accurately) on how to get started. The Install Guide is just that, an install Guide. After that you have to connect to Team Foundation Server (if you want the team stuff), but it does not tell you how to handle the errors and problems there. Luckily i found this post that deals with connection problems to the TFS. My problem was that my VPC 2004 instance (running the servers) was logged in with domain user X and the parent workstation which had the client was logged in with domain user Y. Both were admins on the machines, but that didnt help.
(2) The SQL Server Management Studio is corrupted. It gives some horrible interface registration error messages and refuses to launch.
(3) AdventureWorks sample database doesnt get installed, even when explicitly chosen. By the way, you have to go into the ADVANCED option and into the Books/documentation option to get at the sample databases. So beautifully intuitive (not). Apparently it just puts an MSI into the Tools/Samples folder and then you have to run the MSI.
(4) You cannot REPAIR an installation. I dont remember if we could do this in SQL 2K but this time its really bad. I wanted to reinstall Management Studio but the install application wanted to reinstall the lot. These things have a mind of their own. Unfortunately for me, im rather stuck now since I cannot reinstall without overwriting the TFS stuff.
(5) Not enough RAM. This is not Microsofts problem. They recommend a machine with 1 GB RAM for the server. Added to this, VPC is slow so the install , esp SQL, just crawls like a dying animal.[I tried installing SQL on the base machine and it went quite quick] I can only give 600MB to the VPC. Generally this VPC thing is beginning to look very dodgy indeed. Im going to need 4GB of RAM on the workstation if both are going to be running simultaneously.
(6) How do you test the installation? Nothing around to tell you, try out so and so application which will exercise the suite completely so you can know its fine. In an era of TDD is an installation sanity checking app too much to ask?
As a side note, I got a bit of a fright when I tried to create a web service and couldnt find the project template to do that. I finally found it under the 'Web Applications' option. Whew!!
Has anyone come across problems with the Yukon April 2005 CTP? Drop me an email through the Contact link and let me know.
Anyway, I got my first assignment on this. I have to do a presentation comparing and contrasting MSBuild with NAnt/CC.NET.
I've heard a lot about MockObjects and I just came across this article dealing with the topic. Unfortunately I still dont understand what the heck they are and how to use them.
The sample given in the article doesnt make any sense to me since there is no explanation of what the author actually wanted to test and what he would have done in the absence of mock objects.
It also appears that some other readers of the article couldnt even get the code to compile, so I'm not alone in this.
Can anyone point out some really good links to understand this concept?.
Hoping for some good pointers.