Home avatar

Thoughts and code

Nothing But .NET, Calgary 2007 - Day 3

They say “The more you know the less youA0 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.

Nothing But .NET, Calgary 2007 - Day 2

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 andA0 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 is a gateway to get an Iterator
    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 –> 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 oppositeA0 (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 —A0
    22:30 EOM

Motivation Injection

While talking to JP, I have mentioned that everyone needs to have once in a while what I call a 'motivation injection'. Being a software developer, this 'injection' means a lot. It gives you the drive to lift yourself to the next level by just realizing there's a next level. So when the last time you had you shot? :)

Nothing But .NET, Calgary 2007 - Day 1

I had/will not have time over the week of the training course to sort out all the notes I am taking while participating at the session. Saying that, I want to make it clear that these are uncensored  thoughts of mine at a crazy pace of the course with tones of new material flying around between 0800 and 2400 (with a few little breaks in between).

One more thing I had to mention - feeling like a fish in water is a  great feeling. What I’m down to is that finally it feels good to be around smart and intelligent people that are striving to get the knowledge as much as you are if not even more.

Getting Ready for nothing but .net

JP has instructed the group to make certain things before the training course will start. So what is required to do the job?

  • Visual Studio .NET 2005 Professional
  • SQL Server 2005 Developer Edition /SQL Server Express
  • ReSharper 3
  • TortoiseSVN

TDD should cover things like:

  • Continuous Integration with NAnt and CruiseControl .Net
  • xUnit framework –> MbUnit

I am looking towards a very productive work. Things that according to JP “have made sneak appearances” in previous training (and I hope we get there):

Assembly Fun in ASP.NET

I used to be a big fan of Assembly (x86) in the past when doing graphics for the ancient 320x200x256 and later when lecturing about 80x86 to practical engineers. These days I don’t do that anymore, but I think knowing the basics does make sense.

This project is nice - it allows to run x86 code in ASP.NET.

_realDEVELOPMENT_07 - Real Disaster

Let me first clarify - John Bristowe is a great speaker, but what he was presenting - shame on Microsoft Canada.The topics promised so much, the *real* thing was so disappointing. A few samples:

  • Subject: browser support / JavaScript issues. Sample: document.all.placeholder –> common, that’s the cross-browser?
  • Subject: XHTML and strict mode –> What about how to make VS.NET digest it?…
  • Bunch of tools that should be presented at a webcast, not a national tour
  • Diagnostics.Debug to trace issues –> what about Diagnostics.Trace for the real tracing? Production?
  • More…

Now the question - is this the REAL development for web community? Am I missing something? Felt like attending a show for kids, and not developers. No wonder Java community folks are looking at us as armatures. Why it has to take an ‘underground’ meeting like ALT.NET to address the REAL development? Time to mature for ASP.NET community.

ReSharper

Today I'm happy to be a team leader. The reason - I managed to convince the management to get ReSharper for all our developers. I'm more than convinced that developers will find it more than useful. The problem is where to send them to have the best and quickest tutorials of the most useful features. If you have links and don't mind to share - grate.

Has anyone tried to write plugins for R#?