Starting a project

Isn’t it great, you suddenly have THE idea, the one that will change the world, or at least your financial situation :-)

But besides having that idea, creating and delivering it you will also have to organize, structure, create/find/share information, collaborate… and preferably in a cost effective way (free) Here I’ll give you some ideas and tools to accomplish this. All the tools are based on collaboration and sharing over the internet so your partners in crime can even be on different continents and these tools are not only for technical projects.

Structure

First of all you’ll need to structure the files and information you’ll be creating and gathering…. This will help you find the documents and keep a clear overview of the information. Here is an example structure, feel free to create your own:

00 Initiate
01 Requirements
02 Application
     01 Design
          Graphics
     02 Test
     03 Manuals
     04 Operations
          Setup Client
          Setup Server
03 Data
………..

Tools

Organization
This means structuring the execution of the project, todo lists, milestones, discussions, responsibilities… Checkout Basecamp, they have several plans including a free one to handle 1 project.

Sharing
To easily share your files I propose Microsoft Live Mesh, it allows you to sync files between your pc’s, your online Live Mesh Desktop and with other people using Live Mesh. Think of it as syncing your files in the cloud. You just have to install the client, tell it which folders to sync and you’re ready. Just work on your files locally and when you save them they will automatically get synced with the cloud and with the people that have access. It works on Windows, Windows Mobile and Mac. Even if you’re working alone on this project I would suggest using this tool, you automatically have a backup and you can reach your files from any pc with an internet connection. The only thing it doesn’t do is keep a history of your files so you can’t retrieve an older version of your document, for that you’ll need the the tools from the following section…

Versioning
If you want to keep track of previous versions of your documents (code, graphics,…) you’ll need a versioning tool. Most free solutions are based on Subversion, this is an open source source-control system. This is a bit more technical to implement but not to difficult. You’ll need a hosting company for your repository and one or two client applications.
XP-Dev has several plans to host your repository including a free one. Once this is set up you’ll need an application to retrieve and commit changes from and to your repository. TortoiseSVN is a free tool that integrates with the file explorer and if you’re using Visual Studio to do the coding you can use AnkhSVN to integrate with the IDE.

Information
In the course of the project you will probably also do a lot of research and information gathering. This will not always happen in a structured way, you’ll want to gather the information first, analyze it and then maybe give it some structure. THE tool for this is Evernote, it runs on every platform and it has a handy browser plugin that allows you to store chunks of information from a website directly in your Evernote notebook. If you use it on your PDA you can take pictures with it and when it gets synced to your notebook it also gets indexed with OCR.

Motivation

Now comes the most important part, delivering the actual project. This might sound easy in the beginning but after a few weeks or months you might get a bit demotivated, distracted with other things. Basically you lost your motivation, this can easily happen when you’re working alone on the project. In a group this will happen less likely because you keep each other accountable for the progress and result, of course working with other people (friends, family…) will have other impacts or difficulties on the project but those are outside the scope of this article.

If you’re doing it on yourself try to find somebody that will keep you accountable. Also try to use that person as a mentor, someone who has an opinion and ideas. Don’t ask somebody who is too nice, it needs to be somebody who will chase you if you don’t deliver.

Another way is to promote your product/service when it’s still in its concept or development stage. Write blog about your progress, twitter and facebook it. Don’t be affraid to share your ideas and progress. This might create a community from which you can get fresh ideas and input from possible clients. This will also make you accountable to the whole internet :-)

Posted in general | Leave a comment

Understanding SOA – Introduction

Service-Orientation, Service Oriented Architecture, web services, if you’re not using the word service you’re just not cool!! :-)

As explained in my previous post I’m currently preparing to get SOA certified and so it might be a good exercise for me to talk about service-orientation and SOA in my own words. To keep it readable this will be done in a series of articles, each focused on a specific topic.

Before I start the first article I want explain a naming convention. In a lot of articles and books the term "SOA" is used while they are actually talking about Service-Orientation (SO), SOA is actually part of SO. Mainly I’ll be talking about SO but to keep things simple I will also use "SOA" for both definitions.

Introduction to SO(A)

SOA ≠ web services and you’re not obliged to use web services to implement SOA. Are web services the best way to technically implement SOA? I’m confident to say yes but I do want to stress that web services are only the technical implementation of a service-oriented design. To make it short, it’s not because you’re using web services that you are doing SOA. Think of services as a collection of capabilities focused on a certain topic, this topic could be a business entity, a business process… (Invoice, Accounts Payable,…). In the next article(s) I will talk in more detail about services, their design and principles.

SOA is also not a pure technical idea, it doesn’t only concern developers or architects. It concerns the business of the enterprise, short (tactical) and long (strategic) term goals, SOA can define how a WSDL will look like but it also defines who has access to technical documentation of the service, SLA’s are also part of SOA.  Don’t think of a SOA implementation as a single project within the company, each project should strive towards and contribute to a global SOA within the enterprise.

SOA is about centralizing "logic", making it available through standardized interfaces, managed by a centralized governance and has as purpose to deliver strategic goals and benefits to the company.

Standardized interfaces are very important as it can lighten the integration burden that exists in enterprises that use different development environments (.net, java…) and different application vendors (SAP, Microsoft…). In the case of web services these standardized interfaces will be WSDL for the service contract, XML and XSD for type declaration and WS-* standards (policy, reliability…).

The governance is responsible for how services are designed, developed, published, versioned and for standardizing the internal process to deliver those activities

Reaching SOA "utopia" is an evolution, most of the time you will start by using web services to connect or integrate with different applications, then service contracts will be more formally standardized, as the service inventory grows the need for governance over this will become mandatory to successfully maintain, evolve and version the inventory. But it’s not necessarily a natural evolution, planning and preparation, such as an inventory blueprint, are needed for a successful evolution.

Let’s have a look at some of the goals of SOA…

  • Increased Interoperability

    By consistently applying service principles and design standards (standardized contracts…) services are automatically interoperable. Because of the interoperability, integration processes start to fade. Services can be used and composed more naturally even if they were created by other teams/projects or if they were created in the past.

  • Increased Federation

    This means that applications and resources are united/composed but still maintain their autonomy and self governance. As with interoperability, the application of principles and standards is needed to achieve this unity.

  • Increased Vendor Diversification

    By designing a neutral service oriented architecture (i.e. web services) an organization has the possibility to choose the best products from different vendors. This gives the options to extend, change or replace vendor implementations without "destroying" the global architecture.

  • Increased Business and Technology Alignment

    To create the correct levels of abstraction and to determine service candidates the deep involvement of business experts is mandatory to create services that can withstand change and that can be recomposed if needed to follow the business changes.

…and now the benefits…

  • Increased Return on Investment

    As isolated applications need to grow and evolve over time so does the complexity and cost of managing the application. SOA advocates creating agnostic services that can be (re-)used and composed for different purposes. The initial creation of this piece of logic will have a greater cost compared to the creation of a classic application but it will be better positioned as an IT asset that will reduce the cost of change and evolution over time.

  • Increased Agility

    As the  service inventory grows over time with more and more agnostic services that don’t belong to a certain application but are a real IT asset, IT can adapt more quickly to changing or new business requirements.

  • Reduced IT Burden

    As the SOA infrastructure grows and matures IT can focus more on adding value to the business and less on plumbing and integration. This will also reduce redundancy, overhead, size and the operational cost of IT withing the company and it increases efficiency and agility.

This was a little introduction into the what and why of SOA, the next articles will go deeper into the design and principles of services.

Posted in SOA | Tagged | Leave a comment

Studying towards Certified SOA Consultant of SOASchool.com

I’ve been interested in SOA and web services for years and to make things "official" I’ve decided to get certified in this area. After looking around for the possibilities I decided to take the certification of SOASchool.com. Why did I choose this "vendor", it’s based on the excellent books of Thoma Erl and it’s technology agnostic. The fact that it’s technology agnostic is very important to me, SOA is a lot more than generating some web services from a development tool.

So the plan is to become a SOA Certified Consultant by the summer of next year, we’ll see in a few months if this is too ambitious. I received the self-study kit and text books this week, delivery took about 10 days (from Canada to Belgium). Every exam kit includes a printed version of the course presentation and some sample questions, self-study guide that links to the book chapters you need review for the exam, audio tutor cd’s, flash cards and a Prometric exam voucher. For the complete contents of each study kit go here. As mentioned in the first paragraph, the exams are based on the books of Thomas Erl so you’ll also need those. The first exam (S90.01A) uses the book SOA Principles of Service Design, for the full Certified Consultant track you’ll need these 4 books:

For the full exam/book correlation go here.

I’ll keep this place updated with my progress and my opinions on the contents and exams as I progress. If you’re interested in other SOA certifications you can have a look at an article of Eric Roch.

Posted in SOA | Tagged , | 2 Comments

Web Client Software Factory (WCSF) – reusing views PART 2

Here is my solution for the problem explained in the previous post.

So the problem was, how can you reuse views (aspx pages) in different controllers (processes, pageflows, … whatever you want to call them)?

I’m still using the standard Model-View-Presenter-Controller pattern used by WCSF but I’m abstracting the controller part from the presenter and I’ll be passing the view (through it’s interface) to the controller.

ICanHandleView<TView>
For every view the controller can handle the controller will implement an interface ICanHandleView<TView>. This generic interface has two methods, HandleView(TView view) and FillView(TView view). FillView will be mostly called when the page is loaded to fill the view with state information and HandleView will be called when an action occurred (e.g. a button click). In the implementation of HandleView you take the data from the view, store it in the controller and then decide to which page you will redirect the user. So basically the Presenter is just there to translate actions of the UI into calls to the controller.

BasePresenter
When you add a page with WCSF it will also generate a presenter that inherits from Presenter<T> where T is the interface of your view. I’ve created a class BasePresenter that inherits from Presenter<T>. BasePresenter has a property Controller that returns a ICanHandle(TView), behind the scenes this property uses a static class ControllerFactory that creates a new controller or correlates the current request to an existing controller. So, when WCSF created your presenter you just change the Presenter<T> it inherits from with BasePresenter<T>.

ControllerFactory
This little workhorse is responsible to do the correlation between a request and a new or existing controller. Actually ControllerFactory is just a static class that will instantiate the real factory, in my case WebControllerFactory. This was done to abstract the asp.net infrastructure from the rest of the system as the WebControllerFactory will use the HttpContext to do the correlation.

I hope I can make this all a bit clearer with the following class diagram:


(click to enlarge)

Correlation
The correlation strategy of my WebControllerFactory is the following:


(click to enlarge)

red dots: flow when the first page of the process is first requested
green dots: flow when the first page of the process is postbacked
blue dots: flow of all the following pages in the process

The reason I use the hidden field is to avoid that on a postback, of the first page of the process, a new controller would be created.

Some technical details:
When a controller is redirecting to the next page it should add the “flowid” parameter to the url. To get to the page object of a request, to add or read the hidden field value, I use HttpContext.Current.CurrentHandler, this is a IHttpHandler that can be cassed to a System.Web.UI.Page. To instantiate the correct controller factory and controllers I used Unity, the details of this I leave as an exercise to you the reader.

All of this might seem a bit complicated but once this is implemented it’s really easy to use:
- generate your pages and presenters with WCSF
- write the code of your controller, unfortunately you still have to do this yourself
- configure unity
- change the base class of the presenter to BasePresenter<…>
and it’s ready!

If something is not clear or if you would have a better way to do this please let me know.

Posted in architecture | Tagged , | Leave a comment

Web Client Software Factory (WCSF) – reusing views

This is a compilation of my comments on the blog of Simon Ince concerning reusing views in the WCSF framwork. If there are more comments posted I will also update this article. Please feel free to share your ideas as well.

First of all, if you don’t know WCSF check out the articles on Simon’s blog, you can find my comments on part 2 of his series.

comment 1 (me)

First of all thanks for the great articles about WCSF!

But I do have a question:

How do you achieve reusing a view (.aspx page) in a different page flow (process)?

It seems to me that this is impossible in WCSF. The view receives the presenter from the system and the presenter receives the controller but I don’t see any possibility to decide which controller to use. I have the impression everything is hooked up in the wrong order to achieve reusing a view in an other page flow. In WCSF a user browses to a page and so it’s actually the view that decides which process (page flow) is started. Would the ASP.net MVC framework be better suited for this?

Steven Hillaert

comment 2 (Simon)

@ Steven,

that’s a good question. I think it applies equally to the MVC framework as the WCSF – remember the Controller in MVC is not an "Application Controller". Instead the MVC is similar to MVP, so in fact the question is how do we decide which Application Controller (or any page flow implementation) to use from within the Presenter (in MVP) or Controller (in MVC)? I find it curious that not many people have discussed using an Application Controller in MVC yet.

Anyway, the issue you’re referring to is that in the WCSF most people inject a controller into the presenter using a [CreateNew] attribute… but you needn’t do it that way if you don’t want to. You could instead inject a ControllerFactory of some form, and use that to create a Controller based on further metadata available to the Presenter (perhaps some session data, or a querystring argument). You could also use a Service Locator approach instead of injection to achieve the same thing.

The other way that view reuse can be achieved is to create a User Control with an MVP trio… although how you compose these can be a complex subject so give it a try and see if it fits your approach.

Does that help?

Make sure you check out Blaine’s post & survey here and feedback if this needs further guidance;

http://blogs.msdn.com/blaine/archive/2009/07/20/patterns-and-practices-wants-you-to-take-the-web-guidance-survey.aspx

Simon

comment 3 (me)

@ Simon,

Concerning WCSF:
During the weekend I came to the same conclusions as you on how to implement this in WCSF. I think the the querystring is the most flexible and practical, the only problem I see with this is that the page could be "injected" into a different process (pageflow) quite easily, some security will be needed here. An other issue is that the controller will have to implement an interface for every step (view) of the process because the presenter might used several controllers that don’t necessarily have the same interface.

Concerning MVC:
I had a quick look at it (reading) and I would think that reusing a view is a lot easier here. The controller in MVC is a front controller, the user actually "surfs" to the controller and not directly to a view. So you can make the user surf directly to a process and then the process (controller) decides which view to load.

Thanks for your help Simon, I will definitely take the survey and give feedback concerning this topic.  

Steven

UPDATE
My implementation of a possible solution.

Posted in architecture | Tagged , | Leave a comment

Customizing controls in Interface Builder doesn’t give expected result

In my previous post I talked about pimping the standard UISlider, I did the same with the UIButton and in both cases I found out that changing the images of the controls in Interface Builder doesn’t give you the expected result.

For instance, to pimp the UIButton I changed the background image to a nicely shining transparent and glowing button but when I set this image in Interface Builder it still showed the standard button image behind it. If you have a non transparent image that nicely fills the UIButton you probably won’t notice it but in my case it was really obvious.

When you create the button in code it appears just like you expect, no residue what so ever of the original UIButton.

If somebody has a solution or some advice on this topic please enlighten me.

UPDATE:

Fred Garvin has shown me the light.
In IB, if you use the UIButton and you want custom graphics, you need to set the "type" to "custom" (this gets rid of the other button image stuff). Then use the "Image" rather than the "Background Image" for the various assets (up, over, down states etc) by switching the drop down that defaults to "All".

Posted in iPhone | Tagged | Leave a comment

Pimp My UISlider

To make the interface of our application a bit more sexy we wanted to customize the standard controls of the iPhone. For instance, we designed some glassy and glowing bars to pimp the standard UISlider control.

All you need to do is create some images and write a few lines of code.

So first create your images:
- one for the thumb button
- one bar image for the left side of the thumb button, e.g. a glassy bar with an outer glow to show the "progress"
- one bar image for the right side of the thumb button, the same as the left bar but without the glow

The only thing you have to pay attention to is that both bar images have the same size. In our first test the glowing bar image was a bit bigger than the non glowing one and this caused the glow not to appear. Once we changed the right bar image to the same size everything worked perfectly.

Now you just need write some code to set the images:

CGRect rect = CGRectMake(16.0, 390.0, 297.0, 35.0);
slider.frame = rect;

UIImage* thumbImage = [UIImage imageNamed:@"thumb.png"];   
[slider setThumbImage:thumbImage forState:UIControlStateNormal];

UIImage* leftImage = [UIImage imageNamed:@"SliderLeft.png"];   
[slider setMinimumTrackImage:leftImage forState:UIControlStateNormal];   

UIImage* rightImage = [UIImage imageNamed:@"SliderRight.png"];
[slider setMaximumTrackImage:rightImage forState:UIControlStateNormal];

Just make sure that the height of the frame is big enough for your image else it gets clipped.

Posted in iPhone | Tagged | Leave a comment

LINQ to SQL – mapping multiple resultsets to the same type

Apparantly LINQ to SQL doesn’t really support mapping multiple resultsets to the same .net type.

My situation is like this:
The stored procedure returns 4 resultsets and I want to map the first 3 sets to the same .net type. Those 3 resultsets also have different column names and different amount of columns.

The thing is, you can define the mappings but LINQ to SQL will always use the first mapping that was defined for for that .net type.

A workaround is to change the stored procedure so that the resultsets that you want to map to the same type always have the same number of columns and have the same column names.

Posted in .NET | Tagged , | Leave a comment

iPhone Development

I’ve started some iPhone development and what an experience it is.

As other .net developers who started development on this new and exciting platform will have noticed the difference with .net is HUGE but once you get used to the development philosophy of Apple it’s not that bad or difficult. The first impression you might have is that the IDE and language (objective-C) look prehistoric but you just have to accept that it’s a different environment and you shouldn’t compare it to Visual Studio or C# (or vb.net) and don’t think about how you would solve a problem or implement a requirement in .net, you just have to change your way of thinking and adapt.

The biggest issue I had to get started was how to use the MVC pattern that you are forced to use when creating an application, how do I react to events, how do I fill the UI … . I really grasped this concept when I read Cocoa Programming for Mac OS X (3rd Edition) . Although the book does not discuss the iPhone SDK it does give a great insight in the programming philosophy of Apple, this is a must read if you’re just starting Mac or iPhone development.

So in the future I will also post about my iPhone experiences, problems, tips and tricks…..

Posted in iPhone | Tagged | Leave a comment

WCF Routing

As a little experiment I’ve been playing with a WCF router. Basically a router will accept any request on a certain binding and forward the request to the real service. There are quite some examples available on the internet but they were never complete or everything was done in code instead of using the configuration file.

The service:
This could be any service, no special code is required.

The client:
Any client, no special code required.
I only created a behavior extension and message inspector for adding some headers with information (binding, contract, isOneWay) for the router before sending the request. These are “attached” to the endpoint by configuration so there is no impact on the implementation of the client itself. The binding and contract headers will be used to determine where the request has to be routed to. The isOneWay header is needed to distinguish request-reply from one-way messages, this will be explained in the next component.

The router service:
This is the part that does all the work. The routing is based on the binding and contract and my implementation is capable of handling standard request-reply and one way messages. If you don’t distinguish between them the router will throw timeout exceptions.

To accomplish this obstacle you first need three service contracts for the router.

[ServiceContract]

public interface IRouter

{

[OperationContract(ReplyAction = "*")]

Message Action(Message msg);

[OperationContract(IsOneWay = true)]

void OneWayAction(Message msg);

}

[ServiceContract]

public interface IGenericContract

{

[OperationContract(Action = "*", ReplyAction = "*")]

Message Action(Message message);

}

[ServiceContract]

public interface IOneWayGenericContract

{

[OperationContract(Action = "*", IsOneWay = true)]

void Action(Message message);

}

IRouter is the real service contract of the router service, IGenericContract and IOneWayGenericContract are only used as contracts in the endpoint configurations to the real service, they do not have an implementation. Also pay attention to the Action=”*” attribute, without this the WCF infrastructure will complain about incompatible actions. This is also the reason why we need to make two separate contracts, you can only have one OperationContract with Action = “*”.

The second part of the solution to the “standard” vs “one way” request problem is a DispatchOperationSelector, implemented as an endpoint behavior. This little critter will return the name of the operation that must be executed on the router. To make its decision it will check the header “isOneWay” that was added by message inspector on the client side. If the value of the header is true it will return “OneWayAction”, corresponding to the IRouter.OneWayAction method, else it will return “Action”, corresponding to the IRouter.Action method.

sealed class DispatchOperationSelector : IDispatchOperationSelector, IEndpointBehavior

{

#region IEndpointBehavior Members

public void AddBindingParameters(ServiceEndpoint endpoint, BindingParameterCollection bindingParameters)

{

}

public void ApplyClientBehavior(ServiceEndpoint endpoint, ClientRuntime clientRuntime)

{

}

public void ApplyDispatchBehavior(ServiceEndpoint endpoint, EndpointDispatcher endpointDispatcher)

{

endpointDispatcher.ContractFilter = new MatchAllMessageFilter();

endpointDispatcher.DispatchRuntime.OperationSelector = this;

}

public void Validate(ServiceEndpoint endpoint)

{

}

#endregion

#region IDispatchOperationSelector Members

public string SelectOperation(ref Message message)

{

if (message.Headers.GetHeader<bool>(“isOneWay”, “http://company.com”))

{

return “OneWayAction”;

}

else

{

return “Action”;

}

}

#endregion

}

In the configuration file of the router there are 3 important parts
The mapping definition:

<routerServiceMappingxmlns=http://company.com>

<bindings>

<bindingname=nettcpbinding>

<contracts>

<contractname=ServiceContracts.IConcatendpoint=ConcatService/>

<contractname=ServiceContracts.ICalcendpoint=CalcService/>

</contracts>

</binding>

<bindingname=basichttpbinding>

<contracts>

<contractname=ServiceContracts.ICalcendpoint=HttpCalcService/>

</contracts>

</binding>

</bindings>

</routerServiceMapping>

For you information, to create custom configuration sections I use the Configuration Section Designer plugin of Jelle Druyts, this is really a must have.

The service definition:

<services>

<servicename=Router.RouterServicebehaviorConfiguration=“” >

<endpoint name=RouterService

address=net.tcp://localhost:3000/Router

contract=Router.IRouter

binding=netTcpBinding

behaviorConfiguration=DispatchBehavior/>

<endpoint name=RouterService

address=http://localhost:3001/Router

contract=Router.IRouter

binding=basicHttpBinding

behaviorConfiguration=DispatchBehavior/>

</service>

</services>

You’ll need one for each binding you want to support.

The client endpoints:

<client>

<endpoint name=ConcatService

address=net.tcp://localhost:2000/Concat

contract=Router.IGenericContract

binding=netTcpBinding/>

<endpoint name=ConcatService

address=net.tcp://localhost:2000/Concat

contract=Router.IOneWayGenericContract

binding=netTcpBinding/>

<endpoint name=HttpCalcService

address=http://localhost:2001/Calc

contract=Router.IGenericContract

binding=basicHttpBinding/>

<endpoint name=HttpCalcService

address=http://localhost:2001/Calc

contract=Router.IOneWayGenericContract

binding=basicHttpBinding/>

<endpoint name=CalcService

address=net.tcp://localhost:2002/Calc

contract=Router.IGenericContract

binding=netTcpBinding/>

<endpoint name=CalcService

address=net.tcp://localhost:2002/Calc

contract=Router.IOneWayGenericContract

binding=netTcpBinding/>

</client>

You’ll need one for each binding-contract-oneway combination you want to support.
I know that if you have a lot of services to route this will become a big mess, in that case you’ll have to look for another solution to “register” your services with the router. One possible solution is that the services themselves register with the router. This might seem as if the services need to know that there is a routing infrastructure but it will actually be the host or maybe an extension that will take care of the registering, the service implementation itself does not need to know that it can receive routed messages.

Download the complete solution, just keep in mind that this is “proof of concept” code that is not completely optimized, could contain bugs and is not intended to be used directly in real life applications.

If you have any comments, ideas or improvements on the code please let me know.

Other WCF articles:
- MaxItemsInObjectGraph and keeping references when serializing in WCF
- Tracing WCF messages
- Use your WCF proxies in a safe way

Posted in WCF | Tagged , | Leave a comment