CodeBetter.Com
CodeBetter.Com
RSS 2.0 via Feedburner
           Do you Twitter? Follow us @CodeBetter

Jean-Paul S. Boodhoo

Develop With Passion

June 2007 - Posts

  • Nothin But .Net - New York , NY ( October 22nd - 26th, 2007 )

    That’s right folks. Nothin But .Net is coming to New York.

    The course is going to be held at TCCIT Solutions.

     The course runs for the week of October 22nd – 26th, 2007.

    Overview

    Nothin But .Net is a five day boot camp that will focus on pragmatically applying .Net within the context of developing a working N-Tiered application. Registrants will learn about advanced features of .Net (2.0/3.0) as they are applied to the task of building a complete application from the UI layer all the way down to the mapping layer.

    WARNING!!!!

    If you are expecting to come to this course to learn about how to have VS.Net automatically generate an “application” for you, then this course is NOT for you.

    This course is all about taking control of the .Net framework and having it work the way you want. This course will place a heavy emphasis on getting back to the basics and making .Net do things the way you want it to, in a predictable and testable way.

    This course will focus on a code centric view of application development vs. the typical databinding/designer magic covered by many typical .Net courses. You will walk away with a deep understanding of fundamental aspects of .Net and how these pieces can be used to develop and deliver enterprise scale applications.

    Core Concepts Overview

    • Expanding the capabilities of developing with VS.Net - Enter ReSharper (a productivity add-in for Visual Studio .Net)
    • There’s more to life than generated code
    • Automation for the developer
    • Generics ( they’re not just for collections )
    • Back to basics - Rules Of Good Object Oriented Design
    • Dependency Injection
    • Object Relational Mapping in .Net
    • Applying the dependency inversion principle
    • Domain Driven Design
    • Passive View/Supervising Controller (Model View Presenter)
    • Creating layered architectures
    • Driving out functionality and design through testing
    • Taking Control Of Databinding
    • Behavior (Test) Driven Development
    • Core design patterns applied
    • Pragmatic Productivity Tools For Developers

    Although the list may look rather daunting, the majority of the bullet points will be covered during the evolutionary design and construction of the sample project.

    One of the main goals of the course is to show how to effectively use behavior (test) driven development, design patterns and a solid toolset to develop a portion of a non-trivial application.

    The course will allow students to pragmatically apply BDD practices as well as teach people how to utilize fundamental OO concepts and techniques that will allow for them to have cleaner, more loosely coupled architectures. It will also be an opportunity for students to see what is involved in creating applications that utilize a Rich Domain Model,and the supporting infrastructure that is required to use "Plain Old Objects".

    I have successfully delivered this course several times with great success. I anticipate that people who are interested will find that this is a very unique course offering, not typical of what is being delivered in the mainstream.

    Seats are limited. The course costs $3000/US for a full 5 days. The fee covers:

    • 5 (8 - 14 hour days, depending on the audience availability) of bootcamp style instruction
    • Breakfast
    • Hot Lunch
    • Book - Patterns Of Application Architecture
    • Software – ReSharper 3.0 License

    If you have any questions please don't hesitate to contact me at jp@jpboodhoo.com.

    To Register for the course please use the following link:

  • Typing with the datahand

    Starting time 12:02.

    This is my first post writing with the datahand. Let`s just say that this is an exercise in patience.

    I was a fairly proficient keyboarder, and lots of people made fun of me for carrying around my natural keyboard.

    This keyboard is going to be my one big learning for this year. I am going to stick with it, and have already tested it on all of my resharper shortcuts. Lets just say that once I get proficient with this, that I think the potential for productivity increase is possible.

    More importantly, because this keyboard supports people who experience RSI pain (and I have definitely started to experience that) I am hoping that getting to grips with this keyboard will help keep RSI at bay.

    This is my second day with the device and it still feels pretty alien to me. I am hoping that over the course of the next few weeks that it will start to feel more natural!!

    I will keep you posted as to how it goes!!

    Ending time 12:15.

  • Nothin But .Net - London, England (September 10th - 14th)

    That’s right folks. Nothin But .Net is coming to England. This is especially sentimental for me as I was born and raised in England, and I have been waiting for an opportunity to go back and show my family the wonders of England.

    The course is going to be held at the Hilton London Euston. If you are needing a room for the week, the Hilton has offered up a discounted rate for anyone who books a room before the 10th of August. The room rate is 179GBP a night excluding VAT. This rate includes an English breakfast.

     The course runs for the week of September 10th – 14th, 2007.

    Overview

    Nothin’ But .Net is a five day boot camp that will focus on pragmatically applying .Net within the context of developing a working N-Tiered application. Registrants will learn about advanced features of .Net (2.0/3.0) as they are applied to the task of building a complete application from the UI layer all the way down to the mapping layer.

    WARNING!!!!

    If you are expecting to come to this course to learn about how to have VS.Net automatically generate an “application” for you, then this course is NOT for you.

    This course is all about taking control of the .Net framework and having it work the way you want. This course will place a heavy emphasis on getting back to the basics and making .Net do things the way you want it to, in a predictable and testable way.

    This course will focus on a code centric view of application development vs. the typical databinding/designer magic covered by many typical .Net courses. You will walk away with a deep understanding of fundamental aspects of .Net and how these pieces can be used to develop and deliver enterprise scale applications.

    Core Concepts Overview

    • Expanding the capabilities of developing with VS.Net - Enter ReSharper (a productivity add-in for Visual Studio .Net)
    • There’s more to life than generated code
    • Automation for the developer
    • Generics ( they’re not just for collections )
    • Back to basics - Rules Of Good Object Oriented Design
    • Dependency Injection
    • Object Relational Mapping in .Net
    • Applying the dependency inversion principle
    • Domain Driven Design
    • Passive View/Supervising Controller (Model View Presenter)
    • Creating layered architectures
    • Driving out functionality and design through testing
    • Taking Control Of Databinding
    • Behavior (Test) Driven Development
    • Core design patterns applied
    • Pragmatic Productivity Tools For Developers

    Although the list may look rather daunting, the majority of the bullet points will be covered during the evolutionary design and construction of the sample project.

    One of the main goals of the course is to show how to effectively use behavior (test) driven development, design patterns and a solid toolset to develop a portion of a non-trivial application.

    The course will allow students to pragmatically apply BDD practices as well as teach people how to utilize fundamental OO concepts and techniques that will allow for them to have cleaner, more loosely coupled architectures. It will also be an opportunity for students to see what is involved in creating applications that utilize a Rich Domain Model,and the supporting infrastructure that is required to use "Plain Old Objects".

    I have successfully delivered this course several times with great success. I anticipate that people who are interested will find that this is a very unique course offering, not typical of what is being delivered in the mainstream.

    Seats are limited. The course costs $4000/US for a full 5 days. The fee covers:

    • 5 (8 - 14 hour days, depending on the audience availability) of bootcamp style instruction
    • Breakfast
    • Coffee Break
    • Hot Lunch
    • Supper
    • Book - Patterns Of Application Architecture
    • Software – ReSharper 3.0 License

    If you have any questions please don't hesitate to contact me at jp@jpboodhoo.com.

    Requirements

    • You will be required to bring your own laptop ( VMWare / VPC images will be deployed to your machine on day 1 of the course)

    To Register for the course please use the following link:

  • Essential (almost) Language Agnostic Programming Books

    Scott Hanselman posted about six essential language agnostic programming books. I agree on not being bound to one language. Currently my most used language is C#.

    A while ago I created an Amazon listmania called Building a Solid Core, that focuses on a bunch of language agnostic books mixed in with some killer C# books.

    Check it out here, as I feel that all of the titles on the list are essential reading.

  • Refactoring to reveal intent

    Bil Simser had a post up the other day about Refactoring Dumb, Dumber, and Dumbest away. I had some small suggestions that I offered up and Bil implemented some of the changes that I had mentioned. Here is the code as it stands right now :

    public class SegmentConfigurationFactory { /// <summary> /// Gets the configuration given the values provided. /// </summary> /// <param name="cableSegmentCount">The cable segment count.</param> /// <param name="segmentCount">The segment count.</param> /// <param name="passesCount">The passes count.</param> /// <param name="segmentIndex">Index of the segment.</param> /// <param name="supplyVoltage">The supply voltage.</param> /// <param name="voltageDrop">The voltage drop.</param> /// <param name="segmentPercentage">The segment percentage.</param> /// <returns></returns> public ISegmentConfiguration GetConfigurationGiven( int cableSegmentCount, int segmentCount, int passesCount, int segmentIndex, int supplyVoltage, decimal voltageDrop, decimal segmentPercentage ) { ISegmentConfiguration configuration = new DefaultSegmentConfiguration(1, supplyVoltage, voltageDrop); if (segmentCount > 1) { if (cableSegmentCount == 1) { if (passesCount > 1 && (segmentIndex <= (segmentCount - 2))) { configuration = new MultiPassConfiguration(passesCount, supplyVoltage, voltageDrop, segmentPercentage); } else { configuration = new SinglePassConfiguration(cableSegmentCount, supplyVoltage, voltageDrop, segmentPercentage); } } else { configuration = new MultipleCableCountConfiguration(cableSegmentCount, supplyVoltage, voltageDrop, segmentPercentage, passesCount); } } return configuration; } }

    I was then asked how I could potentially take the refactoring further. I had mentioned that there were a lot of “magic numbers” in the code, to which Bil correctly replied that there are, but they were numbers that represented real business rules, and as such were not that “magic”. Armed with the following set of rules that center around the messy if statement: 

    • If there is one pass we use a single pass configuration
    • If there is one segment we use the default configuration
    • If there are multiple cables in a segment then we use the multiple cable count configuration
    • If there are multiple passes or the segment we’re looking at is the 2nd last one we use a multiple pass configuration

    I decided to take the refactoring a step further to introduce a bit more readability into the Model. I got into mad refactoring mode and decided to pair back the final implementation. The result of the refactoring is as follows: 

    public class SegmentConfigurationFactory : ISegmentConfigurationFactory { public ISegmentConfiguration CreateUsing(SegmentConfigurationParameters parameters) { if (new MultiPassSegmentConfigurationParametersSpecification().IsSatisfiedBy(parameters)) return new MultiPassSegmentConfigurationFactory().CreateUsing(parameters); if (new SinglePassSegmentConfigurationParametersSpecification().IsSatisfiedBy(parameters)) return new SinglePassSegmentConfigurationFactory().CreateUsing(parameters); if (new MultipleCableCountSegmentConfigurationParametersSpecification().IsSatisfiedBy(parameters)) return new MultiCableCountSegmentConfigurationFactory().CreateUsing(parameters); return new DefaultSegmentConfigurationFactory().CreateUsing(parameters); } }

    The first step to achieve this refactoring was to introduce a parameter object that encapsulated all of the arguments that use to be called on the method. This:

    public ISegmentConfiguration GetConfigurationGiven( int cableSegmentCount, int segmentCount, int passesCount, int segmentIndex, int supplyVoltage, decimal voltageDrop, decimal segmentPercentage )

    Became this:

    public ISegmentConfiguration CreateUsing(SegmentConfigurationParameters parameters)

    I won’t bother showing the parameter object as it is just an object that exposes all of the original parameters as properties.

    Now that I had the parameter object, I could leverage it from a new factory interface:

    public interface ISegmentConfigurationFactory { ISegmentConfiguration CreateUsing(SegmentConfigurationParameters parameters); }

    If you look back to the original code you will realize that at each branch that is creating a configuration, a potential different set of arguments is being used. By coming up with an interface for the factory, I can now have specific factories that create specific configurations based on the configuration parameters:

        public class DefaultSegmentConfigurationFactory : ISegmentConfigurationFactory
        {
            public ISegmentConfiguration CreateUsing(SegmentConfigurationParameters parameters)
            {
                return new DefaultSegmentConfiguration(1, parameters.SupplyVoltage, parameters.VoltageDrop);
            }
        }
    

    public class MultiPassSegmentConfigurationFactory : ISegmentConfigurationFactory { public ISegmentConfiguration CreateUsing(SegmentConfigurationParameters parameters) { return new MultiPassConfiguration(parameters.PassesCount, parameters.SupplyVoltage, parameters.VoltageDrop, parameters.SegmentPercentage); } }

    public class SinglePassSegmentConfigurationFactory : ISegmentConfigurationFactory { public ISegmentConfiguration CreateUsing(SegmentConfigurationParameters parameters) { return new SinglePassConfiguration(parameters.CableSegmentCount, parameters.SupplyVoltage, parameters.VoltageDrop, parameters.SegmentPercentage); } }
     

    public class MultiCableCountSegmentConfigurationFactory : ISegmentConfigurationFactory { public ISegmentConfiguration CreateUsing(SegmentConfigurationParameters parameters) { return new MultipleCableCountConfiguration(parameters.CableSegmentCount, parameters.SupplyVoltage, parameters.VoltageDrop, parameters.SegmentPercentage, parameters.PassesCount); } }

    Each factory is responsible for creating a specific configuration based on the parameters. This introduces a nice separation of responsibilities, because properties can be added to the SegmentConfigurationParameters without introducing any change to the individual factories and the original SegmentConfigurationFactory itself. It also allows each individual factory to only leverage the properties on the parameter object that it needs to. This allows fine grained tests against the individual factories to ensure that they are only pulling from properties that they should be, and that they are providing the configurations they create with the correct information.

    That’s great JP, you’ve introduced discrete factories but we are still left with the if statements and “magic” numbers. Remember that at each branch in the if statement (where a configuration is being created) that configuration matches a certain “Specification”. I just gave it away!! I can introduce discrete specifications that encapsulate the business rules so that each conveys more clearly what “Cable” specification it matches. Once again I can use the parameter object in the new interface:

    public interface ISegmentConfigurationParametersSpecification { bool IsSatisfiedBy(SegmentConfigurationParameters parameters); }

    If you are not familiar with the specification pattern you can stay tuned to DNRTv as I am going to be drilling down deep into the pattern (way more than I am showing here!!). Here are specifications for the main types of configuration:

    public class MultiPassSegmentConfigurationParametersSpecification : ISegmentConfigurationParametersSpecification { public bool IsSatisfiedBy(SegmentConfigurationParameters parameters) { return parameters.SegmentCount > 1 && parameters.CableSegmentCount == 1 && parameters.PassesCount > 1 && (parameters.SegmentIndex <= (parameters.SegmentCount - 2)); } }
     

    public class SinglePassSegmentConfigurationParametersSpecification : ISegmentConfigurationParametersSpecification { public bool IsSatisfiedBy(SegmentConfigurationParameters parameters) { return parameters.SegmentCount > 1 && parameters.CableSegmentCount == 1 && parameters.PassesCount == 1; } }

    public class MultipleCableCountSegmentConfigurationParametersSpecification : ISegmentConfigurationParametersSpecification { public bool IsSatisfiedBy(SegmentConfigurationParameters parameters) { return parameters.SegmentCount > 1 && parameters.CableSegmentCount > 1; } }

    As you can see, each specification is responsible for answering the question “Does this parameter object meet the ‘Specification’ of a certain type of configuration. Again, each class can be tested independently of one another. Notice that there is duplication between the classes that could be easily refactored out by using composite specifications. I tried to name the specifications and factories so they conveyed clearly to the developers what business rules they were encapsulating.

    To recap, the refactorings are as follows:

    • Introduce Parameter Object
    • Replace business specific conditionals with Specification (that is not an actual Refactoring, but I think I’m going to coin that name!!)
    • Introduced discrete factories for the different configurations.

    Of course, taken it to the Nth degree you could introduce the following interface (I won’t bother showing the implementation, but I’ll give you a hint ‘Use Object Composition’):

     

    public interface ISegmentConfigurationSpecificationBasedFactory : ISegmentConfigurationParametersSpecification,ISegmentConfigurationFactory { }

    With that interface in hand SegementConfigurationFactory can become:

    public class SegmentConfigurationFactoryToTheMaxx : ISegmentConfigurationFactory { private IEnumerable<ISegmentConfigurationSpecificationBasedFactory> configurationFactories; public SegmentConfigurationFactoryToTheMaxx(ISegmentConfigurationFactory defaultConfigurationFactory, IEnumerable<ISegmentConfigurationSpecificationBasedFactory> configurationFactories) { this.configurationFactories = configurationFactories; } public ISegmentConfiguration CreateUsing(SegmentConfigurationParameters parameters) { foreach (ISegmentConfigurationSpecificationBasedFactory factory in configurationFactories) { if (factory.IsSatisfiedBy(parameters)) return factory.CreateUsing(parameters); } throw new ArgumentException( "There is no factory configured to create a configuration from the set of parameters"); } }

    Which now leaves the SegmentConfigurationFactory adhering to OCP.

    Once again, like all of the refactorings I have demonstrated on this blog, this is just an example to show that there are always ways you can refactor code. Whether the extent of the refactoring is warranted is something that you have to figure out between you and your team members. I am not suggesting that this is the route you want to go (although it could be).

    Have I had to introduce more classes and interfaces? Absolutely. Do I have more testability from going this route? Absolutely. Have I made the domain more resilient to change? I think so.

    When you are refactoring to reveal intent, don’t expect that your codebase is going to shrink. To make the model more expressive sometimes you will need to introduce new concepts into the codebase that up the LOC, but increase the readability and maintainability. 

    At the end of the day, if the original code conveys intent more clearly (Good rule of thumb is to use the 6 month rule, in 6 months when you come back to look at the code, will it still convey its intent) then that trumps elegance of the code.

    In all of this make sure that “Maintainability” trumps all the other “ilities”.

  • Nothin But .Net (Build A Solid Core) - Wenatchee, WA (August 20th - 24th)

    I have now secured a location and date/time for a course to be held in Wenatchee, WA for the dates of August 20th-24th. The following is a description of the course with a registration link at the bottom of the page.

     

    Overview

    Nothin’ But .Net is a five day boot camp that will focus on pragmatically applying .Net within the context of developing a working N-Tiered application. Registrants will learn about advanced features of .Net (2.0/3.0) as they are applied to the task of building a complete application from the UI layer all the way down to the mapping layer.

    WARNING!!!!

    If you are expecting to come to this course to learn about how to have VS.Net automatically generate an “application” for you, then this course is NOT for you.

    This course is all about taking control of the .Net framework and having it work the way you want. This course will place a heavy emphasis on getting back to the basics and making .Net do things the way you want it to, in a predictable and testable way.

    This course will focus on a code centric view of application development vs. the typical databinding/designer magic covered by many typical .Net courses. You will walk away with a deep understanding of fundamental aspects of .Net and how these pieces can be used to develop and deliver enterprise scale applications.

    Core Concepts Overview

    • Expanding the capabilities of developing with VS.Net - Enter ReSharper (a productivity add-in for Visual Studio .Net)
    • There’s more to life than generated code
    • Automation for the developer
    • Generics ( they’re not just for collections )
    • Back to basics - Rules Of Good Object Oriented Design
    • Dependency Injection
    • Object Relational Mapping in .Net
    • Applying the dependency inversion principle
    • Domain Driven Design
    • Passive View/Supervising Controller (Model View Presenter)
    • Creating layered architectures
    • Driving out functionality and design through testing
    • Taking Control Of Databinding
    • Behavior (Test) Driven Development
    • Core design patterns applied
    • Pragmatic Productivity Tools For Developers

    Although the list may look rather daunting, the majority of the bullet points will be covered during the evolutionary design and construction of the sample project.

    One of the main goals of the course is to show how to effectively use behavior (test) driven development, design patterns and a solid toolset to develop a portion of a non-trivial application.

    The course will allow students to pragmatically apply BDD practices as well as teach people how to utilize fundamental OO concepts and techniques that will allow for them to have cleaner, more loosely coupled architectures. It will also be an opportunity for students to see what is involved in creating applications that utilize a Rich Domain Model,and the supporting infrastructure that is required to use "Plain Old Objects".

    I have successfully delivered this course several times with great success. I anticipate that people who are interested will find that this is a very unique course offering, not typical of what is being delivered in the mainstream.

    There are only spots for 8 people to register. The course costs $2500/US for a full 5 days. The fee covers:

    • 5 (8 - 12 hour days, depending on the audience availability) of bootcamp style instruction
    • Book - Patterns Of Application Architecture
    • ReSharper 2.0 License

    If you have any questions please don't hesitate to contact me at jp@jpboodhoo.com.

    Requirements

    • You will be required to bring your own laptop ( VMWare / VPC images will be deployed to your machine on day 1 of the course)

    To Register for the course please use the following link:

  • DNRTv Episode 3 - Correction

    A lot of people have been quick to point out the fact that .Net 1.1 does not have generics, even though I forgot to mention that fact also. In response to this, here is how you can implement the ListEnumerable in a pre 2.0 environment:

     

    public class ListEnumerable : IEnumerable { private IList itemsToEnumerate; public ListEnumerable(IList itemsToEnumerate) { this.itemsToEnumerate = itemsToEnumerate; } public IEnumerator GetEnumerator() { return itemsToEnumerate.GetEnumerator(); } }

    I hope that clears that up!!

  • Nothin But .Net - What's The Deal?

    Just completed another 5 amazing days of intense coding madness with the wonderful people at the Edmonton Catholic Schoolboard.

    There is nothing better than leaving a course and knowing you have had both a professional and personal impact on the people that you have taught!

    Someone once asked me, what’s with the name “Nothin But .Net?”. There is a bit of meaning to the name of the course. Aside from the following tools:

    • MBUnit
    • NAnt
    • TortoiseSVN and Subversion

    All of the code that is developed over the course of the week is done on the Naked CLR. I am a big fan of open source frameworks and tools, as well as tools that I have to purchase to make myself more effective. I regularly use NHibernate and tools from the Castle stack to make myself more productive. The only reason I feel I am effective at using the tools is that I feel that I have an understanding of how the tools work and the problems they are trying to solve. I am a huge proponent of Building a Solid Core. It is the reason that over the course of the week I don’t introduce any tools to solve the ORM, IOC, or other problems. I love these tools, but I love for people to have the grounding from which to gravitate toward these tools. By the end of the week they are left with a set API’s that can be migrated without any change to client to tools like NHibernate,Castle Windsor, Log4Net etc; but more importantly understanding has been brought to the table.

    Over the course of the week along with getting a solid understanding of some framework fundamentals, the goal is to deliver a working, small section of an enterprise application. I show up on the first day with a set of completed web pages (without any accompanying code-behind), after the first day of framework fundamentals covered; Day 2  introduces people to the concepts of domain driven design and interface based programming, all within the context of Test Driven Development. Over the remainder of the week we drive out the different layers of the application, with the main pieces being:

    • UI
    • Presentation
    • Thin Service Layer
    • Domain
    • ORM

    By the end of the week people leave with a solid understanding an application of the following concepts, patterns, and practices:

    • Test Driven Development
      • State Based
      • Interaction Based
    • Automated Builds
    • Object Oriented Programming
    • Interface Based Programming
    • Dependency Inversion Principle
    • Dependency Injection
    • IOC
    • Logging as a debugging replacement
    • Domain Driven Design
    • Object Relational Mapping
    • Factory Pattern
    • Proxy Pattern
    • Decorator Pattern
    • Unit Of Work Pattern
    • Specification Pattern
    • Identity Map Pattern
    • Adapter Pattern
    • Query Object
    • Data Mapper Pattern
    • Lazy Load
    • Model View Presenter
    • Notification Pattern
    • …..

    The last bullet point there is a placeholder for a bunch of other stuff that is covered. In five 9 - 14hr days, there is a lot of ground that can be covered. Having delivered the course 4–5 times this year so far, it is fun to see how different each of the code bases have been from course to course!! Students are also provided with upto 60hrs worth of screencast recordings that are captured over the course of the week. This has been a big hit as people know that they can go over the sessions again from the comfort of their own homes. They also get the complete repository dump from the class so they can rollback to day 1 and see where the code evolved from.

    What is the end goal for me delivering this course? I want to demonstrate to people the practicality of all of these “buzzwords” in the realm of practical software development. Furthermore, I want to make sure that when attendees of my class inevitably start to use tools like NHibernate and the Castle stack, that they are able to use them with intelligence.

    In my opinion, there is no value in learning tools without prefixing it with a solid understanding of the fundamentals. Having given this course several times this year, I glean great joy from seeing the lights go on and having people tell me that this course has changed the way they look at development.

    That is my goal for heading out on the road with this course once a month, to help you potentially change the way you look and tackle development.

    Are you interested in taking your development to the next level? I am typically only delivering the course once a month so I can continue with my regular consulting gig.

    Contact me if you want me to help teach you and your team to start Developing With Passion!!

More Posts