Visual Studio 2008 isolated mode shell reminds me the Eclipse rich client platform (RCP).
The most important architectural characteristics of Eclipse is the Plug-in architecture, which has concept of Plug-ins, Extensions and Extension-Points.
Plug-ins are the smallest deployable and installable software components of Eclipse. The similar concept in VS is VSPackage. After this eveything began to be very different.
Eclipse plug-ins are pure Java libraries on Java platform.
VS Packages are .NET libraries on COM based on platform through COM interop and MPF.
Eclipse plug-ins are described in XML.
VS replies on registry. VS Packages are using pkgdef and pkgundef files and code attributes.
……
From the Visual Studio 2008 Shell offcial definition:
The Microsoft Visual Studio 2008 Shell provides a core integrated development environment (IDE) to help you build and ship specialized languages and development tools.
Looks like it is only targetting development tools, not general application platform.
What about DSL then? Bound DSL only to VS shell is really limitting the potentials of DSL.
March 9th, 2008
I have created two DSL projects on codeplex.com.
Agile Planner: A This tool is for agile project teams, who currently are using sticky notes on the wall. With this tool stories, backlog and iterations are managed in a graphic designer, saved as files within visual studio projects and can be exported to images, reports and etc.
SharePoint Services Site Top Navigation DSL: A DSL tool that models top navigation of WSS sites with a code generator that generates PowerShell scripts to create the navigation bar.
All successed with visual studio integrated mode (deploy as vspackages). All stucked with isolated mode (deploy as a stand alone application). It took me 2-3 day each to do DSL model. Now more than a week passed, I still did not finish a shell.
I wish I can host DSL designer directly, because it is really difficult to customize Visual Studio Isolated Shell. I explained in MSDN forum thread Re: Can we host DSL designer in a custom host application?
As using VS isolated shall for DSL, my first difficulty is to organize/hide the out-of-the-box packages, editors, templates. After copied the pkgundef file from the story board designer, web site template is gone, but something like “connect to database”, “class view”, “code definition window” are still there. Those GUIDs are pretty hard to manage.
Second difficulty is to deal with solution-project-file concept in VS. To implement custom project like in the story board designer is not easy. Actually I just want simple File | New, Open, Save …, not to use solution and project at all.
I thought maybe I can hide all out-of-box menus and supply my own menus. Then it comes to the thrid difficulty, which is to customize menus. VSCT is much better then CTC, but it requires editing XML file and matching GUIDs, IDs in code. Compare using visual studio cutomize ribbon and task pane for Word and Excel, how hard it is.
One day, customization of visual studio will become as easy as customization of Office applications. I believe that. But it will still face the requirement of integrating DSL designer with LOB applications. DSL has possible wider usage outside of development(code generation) world. DSL designer is expected to appear in custom applications, SharePoint sites and Office applications. For example, if the DSL designer is hosted in Word, our BA can then use the story board designer while writing the documents.
So please MSFT, consider unleashing the potentials of DSL. Follow the workflow designer brother, free the DSL designer to outside of VS shell.
IMHO, DSL itself can be a great product, not just a visual studio extension.
March 9th, 2008
I used to think controller in MVC is to separate the view and the model, until I saw this blog An Introduction to the Model-View-Controller, Model-View-Presenter, and Presentation-Abstraction-Control Patterns where Derek Greer wrote,
One common misconception about the relationship between the MVC components is that the purpose of the Controller is to separate the View from the Model. While the MVC pattern does decouple the application’s domain layer from its presentation layer, this is achieved through the Observer Pattern, not through the Controller. The Controller’s job is to mediate between the human and the application, not between the View and the Model.
While the original idea of the Presenter was seen by the Taligent team as a Controller elevated to an application level, the Dolphin team mistakenly considered it a replacement of the VisualWorks’ Application Model and maintained the Presenter as a mediating component within the triad.
- In MVC, controller is the human to model connector (intercepts user input).
- In Taligent MVP, the presenter is the subsystem component connector (manages application subsystems).
- In Dolphin MVP, the presenter is the presentation to domain connector (manages access to model updates).
- In Passive View, the presenter manages presentation logic.
- In Supervising Controller, the presenter assists with presentation logic.
February 10th, 2008
The code beside technology is used by the visual studio designer. E.g. for each Windows Form, visual studio designer generates two partial classes, one for creating UI elements, and the other one is the place to write code. I think it is a MVP/Passive View already.
- Windows Froms App, The SomeForm.designer.cs is the view and the SomeForm.cs is the presenter.
- ASP.NET, the aspx/ascx is the view and the aspx.cs/ascx.cs is the presenter.
- WPF, the xmal is the view and the xmal.cs is the presenter.
If it Visual Studio generates an interface, ISomeForm.cs. Then have SomeForm.cs reference to this interface, instead of being partial class of the view. It is exactly MVP/Passive View. This would make unit testing easy based on ISomeForm.cs and SomeForm.cs. I would not mind if Visual Studio does this (in fact it might be something good to suggest MS to do).
In SCSF and WCSF, there has to be another presenter class. This makes me feel it is a redundant, because presenter class ties/couples to the view. It can hardly be reused. And you have to create extra code to delegate user input/UI events to the presenter. That’s part of reasons why I am not satisfied w/ MVP in SCSF and WCSF.
The original force of MVP is to ease unit testing. Current unit testing on the presenter is to mock interfaces of view and model. Because there is no other better method, this leaves the mocking on interfaces only one to use practically.
What about to have a tool that generates mock object from aspx/ascx to make aspx.cs/ascx.cs unit test-able?
February 10th, 2008
ASP.NET framework is already a MVC framework that allows to implement MVC.
Within ASP.NET, there is a front controller.
The controller itself is usually implemented in two parts: a handler and a hierarchy of commands. The handler has two responsibilities:
Retrieve parameters. The handler receives the HTTP Post or Get request from the Web server and retrieves relevant parameters from the request.
Select commands. The handler uses the parameters from the request first to choose the correct command and then to transfers control to the command for processing.
The commands themselves are also part of the controller. The commands represent the specific actions as described in the Command pattern [Gamma95]. Representing commands as individual objects allows the controller to interact with all commands in a generic way, as opposed to invoking specific methods on a common command class. After the command object completes the action, the command chooses which view to use to render the page.
The upcoming ASP.NET MVC framework is another front controller implementation.
ASP.NET’s default front controller truns plain http request into view state and server side events. ASP.NET AJAX extended the ASP.NET web form to support partial page render.
ASP.NET MVC replaced (not extended) the default front controller, so that there won’t be view state, nor server side event any more, in order to have SEO/REST style URL. Not sure if it is worth to trade REST style URL with view state, server side events and partial page render.
February 10th, 2008
I have uploaded two articles to codeproject.com.
Presentation Model in Action
Presentation Model in SharePoint
In the second article, because I wanted it to be focused on Presentation Model itself, one peice omitted which is using SharePoint Designer 2007 to create a new aspx page.

To do so, the code needs to be in aspx and created the file, web.config needs to be modified to allow compilation on the page.
<pageparserpath VirtualPath= “/Customer4.aspx” CompilationMode=”Always” AllowServerSideScript=”True” AllowUnsafeControls=”True” />
February 10th, 2008
Refers to an operation that produces the same results no matter how many times it is performed. For example, if a request to delete a file is successfully completed for one program, all subsequent requests to delete that file from other programs would return the same success confirmation message if the delete function were idempotent. In a function that is not idempotent, an error would be returned for the second and subsequent requests indicating that the file was not there, and that error condition might cause the program to halt. If all that were desired was to ensure a certain file was deleted, an idempotent delete function would return the same success result no matter how many times it was executed for the same file.
January 21st, 2008
Story began when I was customizing some wordpress templates on my vista powered PC. I was curious what kind of PHP source code is behind the “the_content” tag, so that I tried to type word “the_content” in the windows explorer’s search box. This search did not appear to work. No file found.
This triggered a long journey digging into how to search the text in php files.
Method 1: Use Visual Studio, Edit | Find in files … (27 files found)
Method 2: Use FINDSTR in command prompt.
>findstr /si the_content *.php
Method 3: Use PowerShell
> dir . *.php -r | select-string the_content | group-object Path | select-object Name, @{Expression={$_.Group | foreach {$_.LineNumber} }; Name=”Line Numbers”}, Count | format-list (c.f. this post)
Had so much fun learning PowerShell. :) Spent a lot time on this.
However, why Vista cannot search? The answer is the php files’ index options was “Indexing Properies”, but should be ”Indexing Properties and File Contents” in Control Panel - Classic View - Indexing Options - Advanced - File Types.
Finally also learnt that Vista search is word based, not character based. And maybe Vista search tokenized “the_content” same as “the content”, because the files have “the content” showed up, when searching “the_content”.
What a weekend, just like the comedy channel said, Time Well Wasted
January 20th, 2008
Here are the slide deck and source code used in my presentation about C# features for fellow developers. Topics include:
C# feature demo: Find even number from a list of integers:
- C# 1.x – Loop in Collection (Array)
- C# 1.x – Delegate (Custom Delegate)
- C# 2.0 – Iterators (yield return)
- C# 2.0 – Delegate (Predicate<T>)
- C# 2.0 – Anonymous Method
- C# 3.0 – Lambda Expression
- C# 3.0 – LINQ (Language integrated Query)
- C# 3.0 – Extended Method
LINQ demo: Match orders with appraisers
- Select: Default, Anonymous Class, Dictionary
- Where: Static, Dynamic Query
- Group: Aggregation, e.g. count
- Join: Inner Join, Out Join, Group Join
- Order: e.g. order by count desc
December 28th, 2007
Remebered the first Flash tutorial I saw was to morph/transform a rectangle into a circle. But This simple task cannot be done in Expression Blend 1.
Now with Expression Blend 2 preview, it is possible. This feature is called “Vertex Animation”.
Wait, I actually morphed a circle to rectangle, by converting circle into path on key frame 1 and editing the path to rectangle on key frame 2. It is not exactly same as the “Tweening: shape, Blend: Angular ” in Flash
How about morph text?
How about doing things like in the beginning Flash tutorials?
December 27th, 2007
MFC is the C++ wrapper to Windows API. It was a great help when moving from DOS to Windows where the Windows API required a new mind set.
Now it’s WPF age, WFP/XAML is another big mind set change. Acropolis came to help this time. Its wizard askes something like “Do you want SDI or MDI?” and “Do you want menu bar, tool bar and status bar?”. They are famous questions in MFC wizard.
December 6th, 2007
Just saw a demo of ASP.NET MVC by Jeffrey Palermo on DevTeach Vancouver. The demo used StructureMap to construct the controller DI/IoC way, but actually key point of this framework is the “URL routing handler” that maps URL request to controller class’ method. The mapping is configurable and has intelligence to map automatically by parameter.
It somehow reminds me ISAPI Extension. In Delphi, it was as easy as adding a WebAction component, set path then code in the OnAction event which usually calls methods in another controller class…
The second key point is the “RenderView” method from base class Controller. It invokes aspx as a template engine. The result is that view state, server side event are no more available.
To me, ASP.NET MVC is as same as Web Client Software Factory that I will not jump on immediately.
November 30th, 2007
Attended Jeremy D. Miller’s session about design patterns for WinForms where I finally learnt the differences between supervising controller and passive view.
As myself being a fan of “Presentation Model” and data binding, especially two-way data binding, I am glad to know from Jeremy that “Presentation Model is another name for the Model/View/ViewModel pattern being promoted by some of the WPF team at Microsoft.” from his presentation of his blog post.
Update on 12/5/2007: Acropolis, the WPF client application framework is really using the presentation model explained in this video presentation.
November 30th, 2007
Before, my guidance to developers is to avoid post and try always GET.
This rule now changed. All because of the UpdatePanel which essentially dose partial page updates.
Started to like post back because only post back, not GET will work with UpdatePanel.
June 26th, 2007
Too many debates are there about SOAP vs. REST, contract first vs. code first.
But here is my real life experience during developing WB Editor when it needs to connect web services through those famous RESTful style APIs.
First, the API documents usually have no schema definitions other than request and response XML examples. Examples are good for human to read. But after reading, where is the code that I can work with? I have to write code to parse those XML! - This is a pain. If there was schema, machine could generate client code stubs automatically. The nice “Add web reference” way.
Second, maybe the web service providers realized the issue mentioned above. Usually there are client libraries are also available, such as libraries for Java, for .NET, for PHP, for Python and for Javascript …. If using libraries, what is the differece between them to those C libraries ages ago? As long as the the library black box can talk to the server no needs to bother whether underneath it is HTTP, whether it is XML or binary.
I cannot imagine if in my company, when I publishing tones of web services to other departments or clients, I have to also deliver client libraries, for Java, for .NET ….
Tags: WB Editor, SOAP, REST, API, schema, Add web reference, web services
June 8th, 2007
No needs to rename every control from something like textBox1 to txtTitle
, because no more code like:
txtTitle.Text = article.Title;
article.Title = txtTitle.Text;
How much time can we save if there are 20 controls on the screen?
May 20th, 2007
Google AJAXSLT is an implementation of XSL-T in JavaScript, intended for use in fat web pages, which are nowadays referred to as AJAX applications. Because XSL-T uses XPath, it is also an implementation of XPath that can be used independently of XSL-T.
Selenium Core uses AJAXSLT’s XPath function to locate element on plain html. Selenium IDE can generate the XPath very much same as Solvent.
Here is a sample to extracting data from a web page using XPath using AJAXSLT.
<html><head>
<title>XPath-Test</title>
<script language=”JavaScript” type=”text/javascript” src=”xpath/misc.js”></script>
<script language=”JavaScript” type=”text/javascript” src=”xpath/dom.js”></script>
<script language=”JavaScript” type=”text/javascript” src=”xpath/xpath.js”></script>
<script language=”JavaScript” type=”text/javascript”>
function findElementUsingFullXPath(xpath, inDocument) {
var context = new ExprContext(inDocument);
var xpathObj = xpathParse(xpath);
var xpathResult = xpathObj.evaluate(context);
if (xpathResult && xpathResult.value) {
return xpathResult.value[0];
}
return null;
};
function start() {
alert(findElementUsingFullXPath(“//*[.='b']“, window.document).innerHTML);
}
</script>
</head>
<body onload=”start()”>
<div><p>aaaaa</p>test<div>bb</div><a>b</a></div>
</body>
</html>
May 16th, 2007
My default SQL CE database was deployed to ClickOnce Data Directory. If changed the database schema, ClickOnce will deploy the new database and keep the old database file (in .pre folder). Here is the psuedo code to migrate schema:
if (IsFirstRun)
{
if (customMigrationORMergeNeeded)
{
string dataFolder = call the API
// Database from V1 of the app
string oldDatabase = Path.Combine(dataFolder,”.pre\db1.db”);
if (File.Exists(oldDatabase))
{
string newDatabase = Path.Combine(dataFolder,”db1.db”);
//perform the task needed with old and new one
DoPerformCustomMigrationORMergeAsNeeded();
}
}
What about removed the program from control panel? Data are all gone.
Looks like better to copy database file to the application data folder.
May 15th, 2007
One of the Mix07 presentation mentioned VBx along the Ruby and Python. I realized immediately it must be something interesting.
While searching related staff, I also found this diagram.
May 6th, 2007
Most popular blog servers/engines such as WordPress, Drupal, Neclues and etc. are using RDS (Really Simple Discovery) to help client software like WB Editor to find the services that can be used to retrieve, modified and delete the blog posts.
Those blog servers/engines are also generating RDF (Resource Description Framework) for each blog post to give more information about the post, e.g. track back url. But not enough. I am looking for,
- RDF extension that describes the blog service API lisk WSDL dose for SOAP, so that WB Editor can generate dynamically proxies to the service.
- RDF extension that describes which HTML elements can WB Editor extract data from and then send to the blog service.
Here are some interesting references:
May 6th, 2007