November 2007 - Posts

Kids are original. My wife and I were kidding about who our 3.5 years old son will be when grows up:

"You will be a software developer" my wife says.

With all the disappointment in his voice he replies - "but I wanted to be a pumpkin!...". :)

Today had to spend a bit time on client side code for FireFox. Since I'm coming from IE development only, the whole thing was not so pleasant (plus the fact that either IE sins too much or FF is not really a saint, probably both). So I ended up with 2 things that literally saved my time - Prototype JavaScript framework and Firebug addon for FF. Great to things that just made my day.

Editing the project file and adding this section will ensure the MbUnit tests are executed on successful builds.

<PropertyGroup>
    <PostBuildEvent>"$(ProjectDir)<location in the project>\MbUnit.Cons.exe" "$(TargetPath)"  /sr /rt:text</PostBuildEvent>
</PropertyGroup>

location in the project - something that I picked up from JP Boodhoo. The idea is to keep all the tools used for the development encapsulated with the project. That way maintenance and setup on new workstations is not an issue.

I am not making any news by saying what was said before - R# folks were surprised as much as we were by so early release of  VS.NET 2008. I wonder what was the reason to this early release and how soon as a result of that we will be rushing to download SP1 for it... The point is not that. What I would suggest is do not run R# in VS.NET 2008 without proper support on R# side. Wait a bit, it will come. I am saying so because coding in VS.NET 2008 without fully capable R# running is PAIN...

PS: Any ideas how soon R# will be updated to deal with reality?

The adding is free and allows to work with SVN from the VS.NET (from the context menu). If your preference is not to leave the IDE and you want visual indication of the file status, AnkhSVN is the one you should check out.

The final day. People are tired and some 'deliverables' are slightly trimmed, but we are heading towards the target. My personal target was to wrap around the idea of agile and TDD. I defiantly do not consider myself as a person that understands exactly all the details, but I definitely see the difference and know towards what I should be heading.

Saying this, I would like to thank JP for the 'injection' he provided. Not only the motivation to change, but also sanity check to stay alert and be aware of the professional skills.

Trimmed noted from day 5:

10:00 Visitor pattern
- Custom IRichList extending IList is better to use everywhere.
- Visitor Double Dispatch pattern - changing the behavior of visitor based on the type of the leaf (or its state/attribute)
- Visitor pattern can remove lots of redundant code (loops, etc)
- Visitor is concerned with a single item only, simplifies aggregate processing
- Visitor is statefull
- JP: Learn well Generics and IEnumerable<>
- methods instead of properties tp improve readability
- Composite visitor with commands (technique)
- http://filehelpers.sourceforge.net/
- Interface Factoring - multiple interfaces and not a single fat one
- "Common ReSharper, keep up!" - JP
- Immutable objects play nicely in multi threaded environment (or use thread-aware proxies)
15:00
- Generic mappers
16:20
- Custom Container
- MbUnit allows to decorate test methods with an extended custom attributes to fake container and items in it
19:00 Hooking all together
19:15 App Running
- "Each time sharpen your sward" - JP
23:45 Topics
- [v] Get rid of MVP
- [  ] Domain validation               
- [  ] Mapping from datatables to DB
- [  ] Web service
- [  ] Smart client
- [  ] Role based security
- [  ] Units conversion
- [  ] Lazy load
- [v] Automated unit testing of UI (WatiN)
02:30 Done.

'Almost' productive day - seeing how it works in reality is hilarious. TDD is not only allows testability,  but also to design better your code with regards to not 'what if', but 'what now'. Really powerful tool that would be great to have in my skills set. Script of the day:

10:00 Domain Model (Rich Domain)
- Domain object is more than just properties, it's also behavior
- 14 AA Points - here or -> jpboodhoo.com -> search for "Getting Started Learning Some new Developer Habits"
- R# -> Autocompletion -> Letters and Digits
- DynamicMock<T> vs. CreateMock<T> (dynamic will always provide the default value when "created" mock has to be told everything)
11:15 Domain Driven Design
- Thin service layer & Transaction Script () patterns
- Use R#, don't accept naked Visual studio - naked it's really ugly.
- TestDriven.Net
- [Setup] is for the hard dependencies of the SUT (ie DynamicMock<T>)
- Book: xUnit Testing Patterns
- Department / Products: DB relationship is one to many, Domain Model is one to one (ie not Department.GetAllProducts(departmentId), but Catalog.GetAllProductsBelongingTo(departmentObject) )
14:15
- Service Layer
- interaction test can later involve into integration testing
- REQUIREMENT: Important to understand the RhinoMock in order to use it and learn TDD
- R# CTRL-Shift-E parse the exception from clipboard
- Hard dependencies should be be dynamic ones and defines for the whole test class
16:10 Container
- Principles that container helps to respect: DIP, OCP
- Container (our) should be a static gateway that also an adapter to allow with variety of different containers
- Concrete dependencies should be removed by using container to decouple from concrete implementation
- pair-programming / TDD ping-pong
23:50
- JP is SO tired that reads for a minute a result of breaking test :)
- Building rich domain model = building smarts with objects (example: ShoppihgCart with CartItem through Factory)
00:50
Toasted...

They say "The more you know the less you  have to say". Almost, my version is "The more you know the more you want to scream". Why scream? Because you realize each time how much more you don't know. Well, it's a healthy process besides the fact that from a side it looks like a total mental disorder... No comments. Day 3 notes:

09:00
- State testing initially only might be better that trying to apply both testing strategies (state and interaction)
- Developing Top-Down, not the Domain Model First
- Layers (horizontal, top down): UI, Presentation layer, Service layer, Domain/ORM
- Layers (vertical): Security, Logging, Utility
- UI pieces and stories
- DTOs and Domain Model are not pointing anything else (presentation, ORM, service, UI layers)
- DTOs allowing domain model and UI to be independent (UI does not dictate what model will be)
- Service layer is a (Application) Gateway and Facade
- Application startup is happening in Service layer
[Note:] Friday (9/11/2007) how to combine domain model business rules validations with client side
- Service layer should log exceptions
- Most of exceptions are in the mapping layer (DB constraints violations, timeouts, etc) and domain logic (business rules violation)
- The only time to catch an exception is to put the system in stable mode, otherwise let it go and show that a system has a bug that has to be fixed
- Auditing = Decorating the ORM components!
10:00 Story Document and Story Cards
- Story cards are 'like' use cases, story document is a bit more detailed
- Stories are one page long at most and dedicated to the users and products through out the life of the project
- Stories are ALWAYS coming from the business users with a DEFINED/UNIFIES domain language
- purpose of story card is to shortly and precisely describe 3 things: WHO / WHAT / WHY
- you need to have the story card and a strong access to the user (story teller) to supply the details , where strong access to the domain specialist is phone or one on one
- BA would flush out more out of the story card
- Story Document + Story Cards + UI prototype mock (what user NEEDS not WANTS) = deliverable for the iteration that both devs and client sigh off (for the iteration 0)
- Story will disclose many of domain objects (nouns in the domain language) (highlight them when writing)
"Days of head-down developers are done!"
- Remind the customer of time impacts on deliverable when adding to the story - let the customer to decide if they want a feature or a down scale of the feature based on what they need and what they want to invest into it
- Assumptions are evil, especially with clients
- Front load iterations planning meetings
- Story card summarizes what story document says in form of who/what/why
scoop: next year there will be an agile PM course.
10:45 UI layer
- Build box doesn't have IDE on it
- keep 3rd party assemblies in solution so you don't have to configure the environment to stat building (build) process
- Repeater is better than Grid, Alternate template is lame (?later)
- avoid postback as much as possible working with the plain html where possible
11:08 Presentation - Tests First - Pait Programming
- presenter roles: decouple view from model and route messages
- Interfaces are not serializable, therefor POCO DTOs are the way to go
- If a name (of a class or interface) does not disclose the meaning and usage, rename it
- To mock a DTO that cant be instantiated - mark all as virtual
- R# CTRL-ALT-Space
- Pair programming - one is building the test, another one is implementing
- Reading a test in plain English goes bottom to top, from SUT to record stage
- Test names should present what they really do. Example why: to create a list for QA for testing, reflectively processing the list of test methods
- Concrete dependencies for tests are initialized in SetUp() and defined as memeber fields
[Note: not switching to Mac!]
- NULLs are evil - avoid passing NULLs around
- Don't only write the test, also try to read it in plain English putting yourself the SUT perspective (as you were the SUT)
- Interface = contract/blueprint/contract
- Debugging tests smells bad!
Q: JP, who is Richard Hurse?
- WatiN project for UI browser-in testing
- Interaction tests should be understood how to read in plain language and not as a pure code
13:40 Linking UI and Presenter
- JP will build his whole site as an MVC project with MS MVC as an open source
Q: How to use DotTracer?
- .ASPX / .ASCX is a Template View patterns (classic asp was the same, but no support for separation of concerns)
- Let the view engine be responsible for rendering the template
Q: A page that requires more than one task/service AND how to not to couple between them but have cooperating with each other (event aggregator?)
- Spend 20 minutes on method visibility and 40 on customer feature to be implemented, and not vice versa
- A view without traces of Presenter --> presenter is actualy a Mediator pattern implementer
- For presenter, Task/service is not in place, so what we do is we create a private internal stub task/service class to fulfil presenter requirements and to be able to sign off. Stub class for servise/task will be eliminated asap.
- valueType.ToString("bla bla 0") - no need in curly brackets
- DTO allows Separation of concerns and SRP principles - a change in a DTO is not forcing a change in view nor presenter
- In an agile team the DBA has to take part in agile development and devs and DBA cooperate and resolve problems together

[Sean] Compilation should not be indication of syntax error. It should be an indication of bad design.

- ITransformer - a compositional solution to do the fluent interface (ie to perform the conversion of type)
- .NET 3.5 will allow fluent interface implementation with extension methods (example: Container.DataItem.To<Abc>.Prop)
19:30
- Passive view - communication between view and presenter is done with events (enforces chattiness in both ways)
- >>>Supervising controller - logic pushed to the presenter (controller), ui related stuff stay in the view
- ASP.NET is a more complex abstraction of things that were less complex in the beginning
- Presentation model
- J. Miller "The most important 'ility' is maintainability".
- You have to bring the lowest common level developer to the level to understand agile and TDD or it wont work at all
- Dispair.com
21:40
- Building network - linking between blogs and sources
22:30
- Submitting data from the view to presenter
- R# CTRL-Shift-E - show stack tree for the exception text in the clipboard
23:10
- Duplicate code smells, including in tests - strive to eliminate it completly
23:30
- Design by Contract
- Pushing data from UI to Presenter - presenter is available for the view - keep a reference to it
- Exploring the beauty of discovering controls in a templated container in .NET - not a simple task at 00:11. Nope.
- Done exploring (00:16) Personal conclusion: no place for political correctness in a team, not in agile team for sure.
- 5 minute break
00:30
- Refactoring Patterns
01:01
- Lost it... "What are we talking about?" - Chicken Little
- Mapper on Repeater Item
- "What if" vs. "now what" concept; what if == premature generalization
01:17 EOM. Hibernating...

05:30 Hibernation failed. System is shutting down for 3 hours of sleep. (Talks about various subjects)

 

PS: I am so glad I got on this train, and met all the interesting people. I hope to ride this train for as long and as far as my capacities will allow me.

The second day was as good as the first, with a tiny exception for configuration of CruiseControl.NET - IMO, technique is valuable, not the technical details. Specification technique was bright, logging exercise was a healthy one. Learned to differentiate between state testing and  interaction testing, but I am not completely set on it. Here are the notes taken through out the day 2:

09:00
- http://codekata.pragprog.com
- Build process and not compilation in vs.net: speed; logging; testing;
- Spike new stuff, do not have a deep understanding, until you have to have it in your project
- "Use the tool knowing you can produce the same result without the tool." - J. Nielson
- "Speaking and writting is not an elite club - be honest and be good in what you do." - JP
- Plan success for yourself for a short/long periods of time.
- It doesn't matter what you do as you do it the best.
- IEnumerable<T> is a gateway to get an Iterator<T>
10:00
- "Introduce Local Extension" refactoring technique - exampe: IRichList and RichList
- Refactoring book - re-read
- Decorator has exactly the same interface as the object it decorates (intent: add functionality without changing the public interface)
- Client - dont care about what Decorator does. With "Local Extension" you care about implementation
- Extension methods in .Net 3.5 will introduce a form of a code reuse that can quickly become a code abuse
- IComparer<T> --> Strategy implementation for comparng in .Net
- R# CTRL-N *Pub will find all classes with "Pub" in it
- one ONE 1 return per method - old and good school
11:00
- Proxy = secured composing mechanism
- Use the best tools for the right tasks (me:)
- Aggregate - boundry of protection (library and it's books)
- Composite - complex structure - the root and the leaf are of the same interface and the difference is that some operations on leafs might not do what the do on root or opposite  (with Iterators and Visitors, with Command)
- Think Domain Driven, not Data Driven
11:30 Querying
[Q] How to do TDD with WebControls?
- function that return function -> return a new delegate
11:50 Specifications
// TODO: implement ISpecification for IEntityCollection
- Specifications create a tree of objects, that can be translated into a query for DB or any other repository
- LINQ: abstruction the details of how the provider takes the expression and converts into query
scoop: "Nothing But *" sessions will be coming soon with different well known people
13:25
- FW harvesting: design solution for the client and pull out pieces for the FW to be reused
- FW should be harvested from the real life projects and not built in isolation
14:00 DB
- Developers should have local DB to speed development and not to delay the rest of the team while testing/developing
- File Unlocker - http://ccollomb.free.fr/unlocker/
- Windows Task Switcher - http://ccollomb.free.fr/unlocker/
- MyUninstaller utility - keyboard friendly
- Console - tabbed console
- QueryExpress - sql server management studio alternative
A joke that CJ told: "I had a problem i wanted to solve with regex. Now I have 2 problems to solve."
15:37 Continuous Integration (WebApp)
- Test has A)Unit (test) B)Integration (test)
- Aspect# (Castle, AOP)
15:50 Mocked Testing
- Mocked testing is an interaction testing
- RhinoMocks framework
- using (mockery.Record()){}
- using (mockery.Playback()){}
17:30 Testing
- State Base vs. Interaction Based (mocked) testing
- Component partitioning - separating interfaces from implementors for separate packaging
- examples: Log class is a static gateway
19:00 CruiseControl.NET
- a front controller implementation that allows dashboard configuration through xsl files
- CI = Compilation, Unit testing, Code Coverage, FxCop, Versioning, Reporting, Publishing
- a role of a build-manager cycles through the iteration to spread the knowledge and know how to do that
- development cycle should be short (around 15 minutes) so when you commit the changes the amount of collisions when merging would be minimal
21:45 --- END OF ITERATION 0 --- 
22:30 EOM

There's a project "A notebook per child". I think we should extend that also to "A R# licence per developer".

More Posts Next page »