Hi Guys, it's been a long time since I post for the last time. In this oportunity I want to make the announce of Web Client Software Factory is RTM and available for download here.
What's Web Client Software Factory?

What's on the box?
- Application Blocks (Composite Web & PageFlow)
- Usefull Documentation, Quickstarts & How-To's
- Architecture guidance with Patterns & Practices for Web Client Applications
- Reference Implementation
What are you waiting for... GET THE BITS NOW!!!!
The team
What else can I say about this guys! It's an amazing job, and I'm really proud of beign part of such great team. I want to thank all the this guys:
Blaine (PM), Eugenio (PDM), Mike (Dev Lead), Ed (Architect), Matías (Dev), Mariano (Dev), Alan (Dev), Bob(Dev), Dragos (Architect), Tim (Tech writer), Juan Carlos (Dev), Prasad (Test) and Terrence (Test).
Stay tune because more stuff, content, and guidance is going to be published soon... And rembember that feedback is the key for improving our deliverables! So visit our community website at CodePlex http://www.codeplex.com/websf
thank you,
~j
Hi guys! I’m here at Microsoft, Redmond, working on an amazing project the Web Client Software Factory with Pattern & Practices team. In this factory we’re going to include
-
Scenario documentation
-
Architecture documentation
-
Design patterns
-
How-tos
-
Guidance Packages
-
Reference Implementations
-
Training content (Hands-On-Labs, demos, etc)
Also we’re going to provide UIP migration guidance to our new Page Flow structure. Please help us by filling this questionnaire http://www.zoomerang.com/survey.zgi?p=WEB225N5A8M9Q4.
The Vision & Scope document for this project is also available here (SCP-WCSF-VisionScope.ppt-V1.2-EA.ppt).
To check our current priorities visit this link (http://www.codeplex.com/Wiki/View.aspx?ProjectName=websf&title=Current%20Priorities)
Finally, I’m happy and proud to be part of a team with guys like:
So stay tune to our workspace on CodePlex, because our first weekly drop is out and available to the public.
Thanks!
Introduction
In this How To I want to show how to write code using TDD and leveraging the MVP pattern.This sample uses CAB and SCSF. The requirement
Retrieve contacts and put them in a datagrid when the Load button is pressed. - The user will be able to filter by Name, Last Name or Phone Number
- The number of contacts found cannot be greater than 10. If it is, we should display a message (“Too many contacts, please narrow your search”)
- If no contacts were found, we should display a message (“No contacts found”).
Using Mock Objects to fake the view and services
In the MVP pattern, the presenter knows about the view by its interface. To have a better separation of responsabilities, we use “services” that performs some logic. The presenter will also know about the services by their interfaces.
As we want to test interactions that happens in the presenter without testing the view or the services, we need to fake them.
Said that, the solution includes a few Mock Objects. These are: class MockView : IFindContactView
{
public bool DisplayContactsCalled;
public bool ShowMessageCalled;
public void DisplayContacts(List<Contact> contacts)
{
DisplayContactsCalled = true;
}
public void ShowMessage(string message)
{
ShowMessageCalled = true;
}
}
class MockService : IContactManager
{
public bool FindContactsCalled;
public int NumberOfResults = 0;
public List<Contact> FindContacts(string name, string lastName, string phoneNumber)
{
FindContactsCalled = true;
List<Contact> contacts = new List<Contact>();
for (int i = 0; i < NumberOfResults; i++)
{
contacts.Add(new Contact("John", "Doe", "43321232-23123"));
}
return contacts;
}
}
Note: In the MockService I included some additional methods for testing propose for example NumberOfResults, this method will generate the desired number of results.
Also the MockObjects includes flags to check the interaction as I mentioned above, these flags are like SomeMethodCalled that will help us when writing assertions.
Excercise
Step 1: Creating the test for the Simplest Scenario
The simplest scenario is when you call the Presenter.FindContacts method the FindContacts method of the service and the View.DisplayContacts method should be called.
- Open the FindCustomerViewPresenterFixture.cs
- Add the following code (in the FindCustomerViewPresenterFixture class)
[TestMethod]
public void ContactsDisplayedWhenApply()
{
mockService.NumberOfResults = 1;
presenter.FindContacts("john", null, null);
Assert.IsTrue(mockService.FindContactsCalled);
Assert.IsTrue(mockView.DisplayContactsCalled);
}
3. Now build the project, it should fail.
4. Open the FindContactViewPresenter.cs
5. Add the following code to the FindContacts method
public void FindContacts(string name, string lastName, string phoneNumber)
{
return;
}
6. Build the solution, it should run successfully
7. Run the test, it will fail.
What we have here? This kind of work help us to show our intention. This baby-steps will generate more consistent code. So the next step will be refactoring to pass the test.
Step 2: Refactoring the method to pass the test
- Open the FindCustomerViewPresenter.cs
- Add the following code on the FindContacts method
public void FindContacts(string name, string lastName, string phoneNumber)
{
List<Contact> contacts = this.ContactManager.FindContacts(name, lastName, phoneNumber);
View.DisplayContacts(contacts);
return;
}
3. Build the solution
4. Run the tests, now it should pass.
Step 3: Creating the test for no contacts found
Now we’re going to create the test method that will check that a message is displayed when the number of contacts is less than 1.
- Open the FindCustomerViewPresenterFixture.cs
- Add the following code (in the FindCustomerViewPresenterFixture class)
[TestMethod]
public void ContactsDisplayedWhenApply()
{
mockService.NumberOfResults = 0;
presenter.FindContacts(null, null, null);
Assert.IsTrue(mockService.DisplayMessageCalled);
Assert.IsFalse(mockView.DisplayContactsCalled);
}
3. Now run the test, it should fail.
4. Open the FindContactViewPresenter.cs
5. Add the following code to the FindContacts method
public void FindContacts(string name, string lastName, string phoneNumber)
{
List<Contact> contacts = this.ContactManager.FindContacts(name, lastName, phoneNumber);
if(contacts.Count < 1)
{
View.DisplayMessage("No contacts found!");
return;
}
View.DisplayContacts(contacts);
return;
}
6. Run the test, it will run successfully
Step 4: Creating the test when more than 10 contacts are found
Now we’re going to create the test method that will check that a message is displayed when the number of contacts is less than 1.
1. Open the FindContactViewPresenter.cs
2. Add the following code on the FindContactViewPresenterFixture class
[TestMethod]
public void MessageIsDisplayedWhenMoreThan10ContactsAreFound()
{
mockService.NumberOfResults = 11;
presenter.FindContacts(null, null, null);
Assert.IsTrue(mockView.ShowMessageCalled);
Assert.IsFalse(mockView.DisplayContactsCalled);
}
3. Build & run the test, it should fail.
4. Add the following code on the FindContactViewPresenter class (FindContactViewPresenter.cs) public void FindContacts(string name, string lastName, string phoneNumber)
{
List<Contact> contacts = this.ContactManager.FindContacts(name, lastName, phoneNumber);
if (contacts.Count < 1)
{
View.ShowMessage("No contacts found");
return;
}
else if (contacts.Count > 10)
{
View.ShowMessage("Too many contacts found, please narrow your search");
return;
}
View.DisplayContacts(contacts);
return;
}
5. Build & run the test, it should pass
You can download the code from here
Conclusions
We’ve fully implemented the requierement and the presenter has the expected behavior. We wrote consistent, robust and high quality code. The core idea of this is being consistent and develop using baby-steps to increase code quality.
Feedback is always welecome/expected
The last months I’ve been working on an exciting project using VSTO, Excel and Team Foundation Server. We discussed with Matias how we should design this application. In this kind of projects, a great deal happens in the spreadsheet, and the business logic behind, is big as well. If you did VBA programming you know what I’m talking about.
We needed a clean and extensible design. So we decided to use the Composite UI Application Block and the Smart Client Software Factory, because:
- It provided us with a Dependency Injection container (ObjectBuilder)
- Leverage the MVP pattern which is very TDD-friendly
- Separate functionality in different modules
We realized that the key for being successful was the orchestration between the spreadsheet and the services. This is where TDD proved to be the correct path because allowed us to design this orchestration in a clean way.
The following illustration put it more clear.
- The View is the spreadsheet
- The Presenter performs the business logic and he knows about its view and services by their interfaces
- The Services communicate with Team Foundation Server to retrieve workitems.
The following picture describes our solution
In the retrospective after finishing this project, we realized two things: - TDD was extremely useful to come up with a clean design that provided loosely coupling between the components
- In the final stages of the project, we met with a lot of technical details regarding VSTO and Excel and it was hard to keep the unit tests up to date. This is something that we are looking to improve in the following projects
[TestMethod]
public void CheckValidationAdded()
{
presenter.PopulateLists();
Assert.IsTrue(view.FeatureValidated);
Assert.IsTrue(view.OwnerValidated);
Assert.IsTrue(view.ItemOrGroupValidated);
}
In the example above we tested that when the PopulateList method is called the Presenter behaves properly that means to call AddFeatureValidation, AddOwnerValidation and AddItemOrGroupValidation methods. UPDATE: To take a deep dive in this check my recent post about How-To write MVP using TDD
As Mariano posted we’re doing a Certified Scrum Master course. Let’s start this amazing experience from scratch.
Day 1
Tuesday 9:15. I found myself lost @ Chatolic University asking everybody where is the “Scrum Course”. Nobodies answered fine, neither close to where the Scrum Certification was taking place. Finally I found a sheet of paper with “Scrum aqui” message. Yeah I found it!
Tuesday 10:00. The course was like I thought : a guy, speaking in English, in front of the course, with a laptop and a nice power point slideshow. But that’s the common course structure, but something started to smells when I look at the walls. Every wall was cover with an Sprint Backlog Task Board or sheets of brown paper where the trainer started to write in.
Tuesday 12:00. After a twenty minutes coffee break course continued as started. Talking about principles, and what’s agile, why it’s better than waterfall. And lunch time begun.
Tuesday 15:00 to 18:00. Wow! Scrum in-a-box simulation. We started in each table to work as a team to develop Scrum in-a-box (An off-the-shelf scrum training kit). Stories were vague, nobody knew what to do, we were on the edge of Anarchy (mapping it to Stacey Matrix). Teams didn’t understand requirements but the started spiking. Some team felt like they’re failing. But when we start sprinting everything was clear.
Day 1: We’ve learnt that you always have to move, to do, to fail early, your risks won’t go until you move. Spiking is a good technique for start working. A great agile principle (refactoring) was demonstrated.
Wednesday 9:00 thru 18:00. Course started different on Wednesday, we started sprinting, our Product Owner started re-writing the stories, etc. Was great, 2 days and were a team, I neither knew some team-mates names but I knew what they were committed on. This day was richer than the first one. We learnt lot of things, like estimating like a team, working in a time-box way, and Agile Stuff like that. This day was a sprint, although we stopped to lunch, and some coffees, it felt like we were working and sprinting like scrums teams does every day.
Day 2: I resumed what we learnt on description above, but there was something that really got my attention. Tobias Mayer, our trainer he is a very agile guy, he does with love, passion and happiness. He started the course like a common trainer but it seemed that he didn’t like to talk using the notebook. He is a great guy and knows a lot about organizations and teams. He as the teacher has added lot of value to this course. Learn by doing is great!!!!
That’s all, now I can show my diploma and this cute logo with my name.
Thanks to my table team, other teams, Tobias and Alan Cyment (the logistics and organization guy). This is one of the richer experiences of my life.
UPDATE - 2:00 a.m GMT-3: We're the first group of Latin America to achive the scrum master certification.
UPDATE - 2:20 a.m GMT-3: These are some pictures of this adventure! (Thanks Shaggy)
(Our off-the-shelf kit! Nice, but sincerly I didn't do these kind of stuff since I got out from School. Note for those who know me: Yeah, i did the artwork, with my hands, was like a miracle, I don't belive it yet, but it happend)
The TEAM (from right to left: Beto, Natalia Davidovich, Aureliano Calvo, Lito, Mati and finally me)
(Team in Action. We were like school kids, but we're nice , aren't we?)
Southworks Agile Experience Team (from right to left JP, Seba (above), Lito (below), Tobias (trainer - agilethinking.net) , Mati (below), me (above), Shaggy, Eze, Marian and Beto)
Release (Sprint Review Metting) (Mati showing the getting started guide while I was taking out the box contents)
Bonus Track - Certified Scrum Masters (a.k.a new sheepdogs)
UPDATED 02:17 p.m GMT-3 : You can see all the pictures @ http://www.flickr.com/photos/67651183@N00/ (that's my flickr gallery)
Today I taught LINQ in an open class at Moron University UM. The class was great, students from the 4th year of Computers Engeneering were at class. We talked about "impedance mismatch", ORM (object relational mapping), and others OOP topics. The duration of the class was 3 hours, and most student stay all the class. I've enjoyed this new experience, was different from all the conferences of this month.
Note to assistants: you can download the slideshow from here (note: this slideshow is the same but with slightly different template) and the samples can be downloaded from here.
Well, was a pleasure and thank to everybody who made this possible.
bye bye
johnny
Hi guys, how you doing? Today is a national holiday here in Argentina, so I'm a little relaxed. This time I want to share with you a new entry to the Wikipedia made by a co-worker Shaggy (Ariel Schapiro). This term added to wikipedia is "Ball Stopping", check what it is. This term came out of the monthly team meetings at Southworks S.R.L.
Check it on wikipedia : Ballstoping
bye
johnny.-
Here is the stuff from the LINQ Technight. Thanks to everybody who came to see Angel and me. For more information visit Angel "Java" Lopez.
Samples
To download the slideshow click here: TechNight Linq SlideShow
To download the samples click here: TechNight Linq Samples
Footnotes
To run the samples you'll need the following components:
*SQL 2005 (Could be express edition but you'll need the Northwind database).
* .NET Framework 2.0
* Visual Studio 2005 (Could be Visual C# Express)
* Microsoft WinFx Release 3.0 February CTP
* Microsoft Windows SDK February CTP
* LINQ Preview (May 2006)
bye, remember the 23rd May WebCast!
johnny
As I told you , I travelled around the country with Alejandro Ponicke (IT Pro), while we were flying to Santiago del Estero I was loading a Virtual PC, and suddenly he told me : "STOP! start using Virtual Server R2 Enterprise and you'll never come back". I switched Virtual PC for Virtual Server R2 and the performance was improved in a 100% . Hope this post helps you if you're using WCF-LINQ-WINFX to see how them work and you're using VPC o VMWARE. This tool rocks, you can connect by RDP Connections, you can select the resource allocations.
Download it! Now it's free (via Mariano Szklanny)
bye
johnny
Yeah Man, I'm finally @home, thank for read my posts about this trip.
c-ya tomorrow
johnny (I'm so happy , when the airplane landed I saw the face of my lady (thanks darling you really made happier than anyone today))