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

Jean-Paul S. Boodhoo

Develop With Passion

September 2007 - Posts

  • VMWare Fusion - Toggle Input to the active window

    I was just reading a comment that someone who was using Fusion had an issue with the fact that you had to use the mouse when you switch input back to the VM.

    This post is for you. When you bring up expose (F9) to switch between windows and you switch focus back to the windows VM (I am assuming you are not using Unity at this point), all you have to do is hit Command - G to force input back to the virtual machine.

    This way you don’t have to reach for the mouse!!

    Posted Sep 28 2007, 02:25 PM by bitwisejp with 1 comment(s)
    Filed under:
  • Screen Bound DTO Update (Getting the terminology right)

    I am going to be posting a small sample that demonstrates what I was talking about in my post describing using Screen Bound DTO’s Presentation Model.

    In chatting with a couple of people, they correctly fixed my terminology to use lingo that most people have already got a cursory knowledge of. So with that said, the technique that I described with regards to objects that are designed specific to the screens that they are servicing is the concept of a Presentation Model. DTO’s are still in the picture with respect to the messaging that can occur between presenter and service (and vice versa). The presentation model is their to satisfy the needs of the UI, be if for databinding or other UI needs (such as coloring for rows in a grid, highlighting customers with bad credit etc).

    Ok, now we are all on the same page.

     

  • QuickSilver is to OSX what ReSharper is to Studio

    As cool as I think OSX is, now that I have been exposed to QuickSilver, I find myself facing the same situation that I do when I am facing a VS installation without ReSharper. I can’t use it without it!!

    I think that only people who have actually coded with ReSharper can appreciate what I mean by this comment!!

    Posted Sep 27 2007, 02:31 PM by bitwisejp with 3 comment(s)
    Filed under:
  • Where did my ALT key go!!

    I am currently loving working on a Mac, but the one nagging thing that I miss is the fact that I can’t hit the ALT key and have all of the menu accessors enabled so that I can traverse the menu by hitting ALT – Followed by series of keystrokes. I much prefer ALT based navigation to having to memorize different shortcuts CTRL + Key or now Command + Key.

    Am I missing something or is there no equivalent in OSX?

    Posted Sep 27 2007, 02:28 PM by bitwisejp with 9 comment(s)
    Filed under:
  • Screen Bound DTO's (Presentation Model)

    Currently, in a lot of the projects that I work on I tend to take a top down approach to development. Which means that I will start at test that focus on the presentation layer of the application.

    Some people are curious as to this approach. My answer for this is simple. From the customers perspective, the first and simplest entry point to the application is the UI of the application itself. The UI also happens to be the place where developers spend a lot of their time, as that is often the place of most contention because of user expectations for how the UI should behave. By focusing on presenters and their accompanying view implementations, I can focus on stubbing out the behavior of the required service layer pieces as well as the accompanying Screen Bound DTOS that are required to present data to the particular user interface.

    The concept of Screen Bound DTOS is probably not a new one, but one that I have been able to use with lots of success. Most people who look at my code are probably aware that I favour the use of DTOS with regards to use in the presenter to service layer communication as well as for displaying data in the UI. This is because you can build DTOS specific to the screens that they are going to service. They are completely separate from the underlying domain layer that will ultimately handle the business logic, and therefore are completely unaffected when a change to the domain model actually occurs. When a domain object or set of domain objects that ultimately map to a DTO change, the only thing that needs to change is the mapping from domain to the DTO. This ultimately allows my domain to evolve completely independently of the needs of the user interface.

    Also keep in mind that a given screen may have the concept of more than one type of DTO for the different behaviours that can occur. For example, when I am displaying a list of products to purchase in an online store, I may have the need for a DTO that consists of the name, description, and price, as well as the SKU number for the product. When it comes time to add an item to my cart, what are the pieces of information that are really relevant to pass to the service layer? Only the SKU and the number that I want to add. I can encapsulate this information in an AddItemToCartDTO that contains the sku of the product and the quantity to be added. This DTO is free of all of the extra noise that existed in the previous DTO that is not necessary for the add to cart behavior

    With regards to the presenter to service layer communication, these DTOs become essentially stripped down commands without the behaviour necessary to complete the task.

    Using this technique and Top Down Development, I can completely finish off a screen, hand it off to the user to verify that it works the way that they want. I can do this by stubbing out service layer implementations to return fake data.

    Once I get sign off from the user that the screen is up to par, I can now switch down to another layer and repeat the process of Top Down Development, from a different layer in the application.

     

  • Hello Mac OSX

    Well, I finally dished out and purchased a brand new MacBook Pro. And I am amazed at the simplicity of the OSX OS. Initially I was a little worried at the lack of keyboard support. This ended up being a relearning for me as I have been heavily reliant on the ALT key coming from the Windows world.

    I am running both of my work and development windows VM’s inside the Mac using VMWare Fusion. This is a truly surreal experience that blurs the line between where the Mac ends and Windows begins.

    I installed QuickSilver a couple of days ago, and I finally see what all of the fuss was about. QuickSilver is an amazing utility that is an absolute must have for a keyboard junkie like myself. Each of my VM’s has a copy of launchy and slickrun installed. One of the things that I found out was that once I had launched a program once in a VM, it was accessible using QuickSilver!! This means that I can now reboot my Mac, use QuickSilver to launch my VM’s and then furthermore use QuickSilver to launch apps within those VM’s. I will have to do a screencast soon to demonstrate some of this stuff!!

    All in all, my first couple of days running on a Mac have been thoroughly impressive, and I look forward to the learning that I will have to go through in the next little while.

    FYI: My vm’s seem to run much faster in Fusion on the Mac, than they did on either XP or Vista. I am guessing at the fact that the OS overhead is much less with OSX vs. Vista or XP.

    Posted Sep 25 2007, 02:51 PM by bitwisejp with 7 comment(s)
    Filed under:
  • Design vs. Coding - How Much Is Too Much?

    A while ago I got asked the following question:

    I've been wondering something about
    OOD that perhaps many developers think about, and that is the
    relationship between the amount of time used for design (eg. drawing
    UML) and actual coding.
     
    What's your take on this? Do you like to design everything from the
    high-level till the ground-level with UML? What UML diagrams you find
    most usefull? Or do you think that using pure TDD makes UML somewhat
    obsolete?

    Since I got introduced to agile methods, I was also introduced very early to the concept of “code” as a design tool. To be more specific, this is the concept that everyone has come to know formally as Test Driven Development. When practicing TDD/BDD the goal is to write the test before the code that you are wanting to create actually exists. Don’t forget what we are doing here, we are writing “code” for “code” that does not yet exist. This gives us a completely blank slate to work with. This allows us to code the object with the exact “behaviors” that we would want it to exhibit and the API through which we interact with it. After you have been doing TDD for a while the “explicit thought” of “I should write a test” becomes a habit, so you write the test first without even thinking about it. This is great. When you have been doing TDD for a while.

    The problem lies for the people who are fresh into TDD and they are still in that uncomfortable period where it does not yet feel natural to write the test first. As much as TDD is about design it is also about “moving ahead”. When you find yourself staring at a screen and lost for which direction to drive out a test the answer is simple “Get Up In Front Of A WhiteBoard and Draw!!!” (I am making the assumption here that you have already tried talking with your team and you are all collectively at a loss for where to begin). If you are feeling stuck and unable to move ahead one of the following diagrams :

    • UML Class Diagram
    • UML Sequence Diagram

    may help to generate some ideas in your head that can serve as a starting point for helping you to drive out the test. Of all of the UML diagrams, the only ones I find myself using anymore are:

    • UML Class Diagram
    • UML Sequence Diagram
    • UML State Diagram

    Even on teams of experienced agile practitioners, it can often be beneficial to whiteboard an high level idea that you are having to quickly share information with the team and solicit feedback. These should be quick sanity check sessions where you are just brainstorming. It is not a 2 hour session where you are drawing out a complicated class/sequence diagram that will almost definitely not correlate to the resulting code that is produced. 

    One of the most effective tools that a developer has in their arsenal to convey design ideas quickly (aside from unit tests) is a whiteboard and marker. So even though you may currently feel stuck with respects to which direction to take test; the act of getting up and trying to draw down a quick UML sketch can get the creative juices flowing and provide you with the ammo and direction with which to get back to the computer and start writing the test. Which is ultimately the design exercise you want to move to, as it is a “specification” that is able to adapt to the code that it is targeting (unlike a static UML diagram).

    People starting out in TDD get very uncomfortable when they are often faced with the realization that the design skills they thought they had are actually not really that proficient. TDD brings this to the forefront because design is something that is being done constantly. Most developers that I know who are familiar with UML are able get in front of a whiteboard and come up with a quick sketch of a proposed object model they are thinking about. Put the majority of those developers in front of studio with an test fixture and they often flounder.

    It is time that people started developing a different set of design skills. The skill of designing an application by “coding in reverse”. One of the best ways I try to describe TDD when I am pairing with someone is to “code it like it’s there and it has the exact API that you want to use”. Once people can take that phrase and literally apply it to a test they are writing for an object; they have crossed , IMHO , the largest learning gap on the road to effective TDD.

    Do I think that design is dead? Absolutely not. TDD is first and foremost about design, not testing. It is a practice that requires discipline on the part of all the members of a development team. One of the startling revelations that people who are skeptical about TDD encounter when introduced into a team practicing it, is that the emphasis on solid design is actually much higher than other teams they have been a part of. Why? Because design is something that is happening almost every minute of every iteration. Developers working on stories are driving out the design of components one test at a time. They are driving out the communication between disparate layers in the system one test at a time. All of these “design” artifacts brought together with the accompanying implementation code, over the course of (x) iterations result in a piece of software that has been actively designed and developed over the entire lifecycle.

    At the end of the day, I no longer see any value in BDUF. Let me stress this point, “this does not mean you turn a blind eye to changes that are coming in future iteration that may (most likely will) require change”. More importantly you build the system with tests as a design tool that enable you to keep your objects following:

    • Single Responsibility Principle
    • HollyWood Principle
    • Dependency Inversion principle
    • …….

    This will ensure that when change comes (and it will) the effort required to  accomodate the change will not be a negative one. And will you be able to drive out the “design” and implementation of the change by following a set of repeatable practices that eventually will become second nature for you, if you stick with it.

  • Macro to aid BDD test naming style

    During the DevTeach seminar that occured in Montreal in May I got an awesome opportunity to pair deliver a TDD workshop with Scott Bellware. One of the things he got me hooked on was using natural sentences as a test naming convention. So instead of this:

    ShouldBeAbleToTransferFundsBetweenAccounts

    You write it out like this:

    Should be able to transfer funds between accounts.

    Of course, only one of these is legitimate from a compilation perspective. So Scott had written a macro that would replace all of the spaces in the test name with underscore. You invoked it by highlighting the name of the test and hitting a key combination that was bound to the macro. Which would convert the natural sentence to the following:

    Should_be_able_to_transfer_funds_between_accounts.

    During the last course, Terry Hughes improved upon the macro so that now all I have to do is type out the name of the test and hit ALT + _ (that is what I have the macro bound to). I don’t need to select the name of the test.

    It is a subtle change, but one that allows me to just write out the name of my test without worrying about camel casing or underscores.

    Here is the macro:

     

    Imports System Imports EnvDTE Imports EnvDTE80 Imports System.Diagnostics Public Module CodeEditor Sub ReplaceSpacesInTestNameWithUnderscores() If DTE.ActiveDocument Is Nothing Then Return Dim selection As TextSelection = CType(DTE.ActiveDocument.Selection(), EnvDTE.TextSelection) selection.SelectLine() If selection.Text = "" Then Return Dim prefix As String = "public void " Dim index As Integer = selection.Text.IndexOf(prefix) prefix = selection.Text.Substring(0, index) + prefix Dim description As String = selection.Text.Replace(prefix, String.Empty) selection.Text = prefix + description.Replace(" ", "_").Replace("'", "_") selection.LineDown() selection.EndOfLine() End Sub End Module

    This video shows the macro in action.

     

    Enjoy

  • Nothin But .Net (Help The Homeless) - Calgary, Alberta (November 5th - 9th)

    You are probably looking at the title of this course and wondering ‘What is he talking about’? Many readers of this blog are aware of the fact that I am a born again Christian. To this end one of my core values and beliefs has been a simple phrase : “Blessed to bless”. One of the thoughts that has been running through my head ever since I started teaching the Nothin But .Net courses is a way that I can make a difference not just in the lives of developers that I come in contact with, but also the community in general.

    This is where Nothin But .Net – Help The Homeless edition comes into play. Every year in Calgary at winter time; the temperature drops from anywhere between -15 to -40 celcius. This is also a time of year where homeless shelters and drop in centers in and around Calgary get flooded with scores of people who would not be able to survive the night on the streets. As you can imagine, the resources that it takes to coordinate the shelter and food for these people is a big task. There are several shelters in Calgary that try to make this time of year a blessed occasion for those less fortunate, and I want to do my part to help them do their job and spread a little of God’s love and warmth during the Christmas season.

    Ok JP, what does this course have to do with any of this? Here it is. All proceeds for this course (100%) will go to a number of the shelters in the Calgary area. I will be working with a friend who works with the homeless in and around Calgary, and he will be making the decision as to which shelters will require the resources most. The reason for the November timing, is so that funds can be made available to the shelters as close to Christmas as possible.

    When I say 100% this means that any fees that I incur for hosting the course such as :

    • Venue
    • Books
    • Licenses
    • Meals

    Will all be paid for by my company. I am trusting in God to help me take care of what I need to take care of thus allowing all of the proceeds to go to those who really need it. I am also going to be talking with local (and remote) companies to see if they are willing to make pledges based off the total amount of money raised by the course. For example, since Calgary is made up of a lot of oil and gas companies, I am hoping to approach a couple of them and see if they would be interested in some form of money matching. It does not have to be dollar for dollar, but any little bit will help ensure that we can give as much back to the community as possible.

    So spread the word about this course, I am hoping that it will help make the lives of many homeless Calgarians this Christmas much brighter. Here are the details for the course:

    The course runs for the week of November 5th – 9th, 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 $2500/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
    • $70 Amazon book allowance
    • 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:

     

    Posted Sep 03 2007, 12:01 AM by bitwisejp with no comments
    Filed under:
  • And now we return you to your regularly scheduled program....almost

    As most people have probably seen, I have been extremely quiet on the blogging front for the most of this year. The posts that I have disseminated have been to inform people about upcoming courses and presentations that I have been giving.

    This is about to change, aside from one more public course that I am hosting this year (that I will post an advertisement for), I will no longer be placing any advertisements for courses here at CodeBetter.com, as I am finalizing a full training portal that will become active in the next couple of weeks.

    I consider it an honour and a privilege to be able to share a writing spot with some very talented people in this business, so I want to ensure that I am adding value as a writer of the CodeBetter team. To that end, I am going to be getting back to a more regular posting schedule. Due to my current commitments :

    • Family
    • Clients
    • Training

    I am going to make a commitment to make at least one good post a week. I will start by answering (in a blog post each) all of the questions that people posed to me over the course of the year. This will give me an opportunity to dish out more code for public viewing/review, but also provide the people who originally asked the question with a possible alternative implementation to what they must have already come up with!!

    This post serves as my public commitment to get back to what I was so passionate about last year, sharing as much as I can with the masses.

    Thanks for your patience.

    Develop With Passion!!

    Posted Sep 02 2007, 10:47 PM by bitwisejp with 2 comment(s)
    Filed under:
More Posts