Follow me on Twitter

Posted on March 2, 2010 23:55 by Aleh Matus

In addition to blogging, I am now using Twitter for quick updates and announcements. Follow me at: http://twitter.com/alehmatus. The updates are also visible on my LinkedIn page.




Michael Feathers
Working Effectively with Legacy Code

To buy this book from Amazon, click here.

Legacy code is defined by Michael Feathers as code that lacks tests. Lack of tests makes the code hard to understand and difficult to change. When the code is changed, new subtle bugs are often inadvertently introduced. When the code breaks, countless hours are spent troubleshooting.

Does it sound familiar? If you are writing software professionally, the chances are you have worked with legacy code many times before. You may be working with legacy code now. If this is the case, you will find Michael Feathers' book invaluable.

  

Michael describes practical strategies and techniques to working effectively with both large and small untested code bases. He explains the mechanics of software change and provides insights into adding tests to and ultimately taking control of legacy code.

I recommend this book to all software developers. Happy reading!




The following five principles are listed in the Harvard Business Review magazine, March 2010, page 24:

  1. Keep people informed
  2. Listen
  3. Set clear objectives
  4. Match the person with the job
  5. Create meaningful work



Online systems increase transaction costs?

Posted on February 24, 2010 15:08 by Aleh Matus

An interesting study was mentioned in the March 2010 issue of the Harvard Business Review magazine. The study suggests that while bank online systems improve customer retention rates, they also increase transaction costs to serve each customer.

The conclusion is rather unexpected, isn't it?




Last time, we continued a discussion around how to organize classes inside your domain model. We defined important domain model elements: Entities, aka Reference Objects, and looked at their relationships. This month, we will review the options for loading Entities into memory.

Potluck Principle of Getting Objects You Want

The Potluck Principle states that if you need to obtain a reference to an Entity in your code, you have the following three options:

  1. You may be able to create the Entity yourself
  2. You may be able to ask another object to give the Entity to you
  3. You may be able to reconstitute the Entity from a previously stored state

Choosing the right option

The option #1 is usually implemented via a constructor or a factory. It works well when you need to create a new entity object, not yet tracked by the application.

As we discussed last month, Entities span through long periods of time and run across multiple systems. Unless you are writing a data entry application, you are going to work with existing Entities a lot more often than with new ones. When you need to create an existing Entity, use the option #2 or the option #3.

Let us take a look at the last month's example: User logs in into the system to check the status of their loan applications. Assuming we have a Person loaded, how shall we obtain their Applications?

Entity Relationship

To enable the option #2, design the Person class with a method or property that returns the Person's Applications. I generally prefer to pass a qualifier, such as loan type or date, that would transform one-to-many relationship between Person and Application into one-to-one with a qualifier, but this is a topic for another conversation. For now, let us assume that the Person class defines the Applications property that returns a list of Applications. This requires you to either get the Applications when the Person object is loaded into memory or implement a lazy load mechanism to defer loading Applications until the Applications property is called.

To enable the option #3, design the ApplicationRepository class with a method that returns a list of Applications for a given Person: "IList FindByPerson(Person person)".

Domain Model Structure

Repositories in the Domain Model

My preference is to place repository interfaces in the model and move repository implementation into a separate Persistence library. Keeping repository interfaces in the model helps clients understand how entities are supposed to be loaded into memory. Having repository implementation separate from the model keeps the model free from infrastructural detail.

Happy coding! To be continued...



The Architect: schedule change

Posted on January 19, 2010 21:59 by Aleh Matus

Starting January 2010, articles in our Architect column will be published once every two months. Happy coding!



Book reviews: 2-year anniversary

Posted on January 17, 2010 20:25 by Aleh Matus

Our monthly column have just celebrated its 2-year anniversary. Altogether, we reviewed 24 books in 2008 and 2009. They are all listed below. We will continue writing reviews in 2010, but we will do that at a less frequent schedule: one book every two months. Happy reading!

2009

  1. Corey Ladas, Scrumban: Essays on Kanban Systems for Lean Software Development
  2. Ingrid Bens, Facilitating with Ease! Core Skills for Facilitators, Team Leaders and Members, Managers, Consultants, and Trainers.
  3. John Shook, Managing to Learn. Using the A3 management process to solve problems, gain agreement, mentor, and lead.
  4. Jean Tabaka, Collaboration Explained. Facilitation Skills for Software Project Leaders.
  5. Esther Derby, Diana Larsen, Agile Retrospectives. Making Good Teams Great.
  6. Durward K. Sobek II and Art Smalley, Understanding A3 Thinking. A Critical Component of Toyota's PDCA Management Process.
  7. Patrick Lencioni, The Five Dysfunctions of a Team.
  8. Martin Fowler, Patterns of Enterprise Application Architecture.
  9. Mihaly Csikszentmihalyi, Flow: The Psychology of Optimal Experience
  10. Steve Resnick, Richard Crane, Chris Bowen, Essential Windows Communication Foundation. For .NET Framework 3.5.
  11. Mike Rother, John Shook, Learning to See: Value-Stream Mapping to Create Value and Eliminate MUDA.
  12. Neil Davidson, Don't Just Roll the Dice: A usefully short guide to software pricing.

2008

  1. Tom DeMarco, Tim Lister, Waltzing with Bears: Managing Risk on Software Projects.
  2. Eric Evans, Domain Driven Design.
  3. Robert C. Martin and Micah Martin, Agile Principles, Patterns, and Practices in C#.
  4. Norman L. Kerth, Project Retrospectives. A handbook for team reviews.
  5. Michael N. Kennedy, Product Development for the Lean Enterprise: Why Toyota's system is four times more productive and how you can implement it.
  6. Gerald M. Weinberg, The Secrets of Consulting: A guide to giving and getting advice successfully.
  7. Mike Cohn, Agile Estimating and Planning.
  8. Jeffrey Liker, David Meier, Toyota Talent: Developing Your People The Toyota Way.
  9. Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides, Design Patterns: Elements of Reusable Object-Oriented Software.
  10. Michael Kennedy, Kent Harmon, Ed Minnock, Ready, Set, Dominate: Implement Toyota's set-based learning for developing products and nobody can catch you.
  11. Cliff Atkinson, Beyond Bullet Points: Using Microsoft® Office PowerPoint® 2007 to Create Presentations That Inform, Motivate, and Inspire.
  12. Eliyahu M. Goldratt, The Goal: A Process of Ongoing Improvement.




Neil Davidson
Don't Just Roll the Dice: A usefully short guide to software pricing

To buy this book from Amazon, click here.

To download a free eBook, click here.

For the month of December, I picked a short fun-to-read book filled with refreshing yet practical ideas on software pricing. The book is very informative, thought-provoking, and engaging. Will it become something you enjoy reading over the upcoming holidays?

Neil Davidson, the author of the Don't Just Roll the Dice, is a co-founder of the Red Gate Software that provides database tools for developers and administrators. Neil investigates how to make an informed guess at what your product is worth on the market. In the attempt to answer this question, he describes many first-hand real-world experiences demonstrating how a pricing strategy can work to your advantage over your competition.

  

The book is organized around a series of questions. I listed a few of them below:

  • What is your product?
  • Who are your customers?
  • What is your product's objective and perceived value to your customers?
  • How do people generate their perceived value of your product and how could you increase it?
  • How could you create product versions and bundle your software to increase revenue?

Happy reading!



Silverlight 4 at TCSLUG on Tue, Dec 15, 2009

Posted on December 10, 2009 01:46 by Aleh Matus

Who: Shannon Braun
What: Silverlight 4 – A First Look
When: Tuesday, December 15, 2009
12:00 - 1:30 PM
Where: Twin Cities Silverlight User Group
Cost: Free

Registration is required. See more information at TCSLUG.




Last month, we started a discussion around how to organize classes inside your domain model in a clear, easy-to-understand, and easy-to-maintain way. We reviewed our objectives and discussed why they are important. This month, we will start revealing a story of a business domain for the purposes of developing a software application. We will look into what is being managed in the domain day to day: Entities.

Discovering Entities

There are a number of technical definitions of an Entity that are popular in the industry. For example, here is a definition from Eric Evans' book Domain Driven Design, p. 89: An object that is not fundamentally defined by its attributes, but rather by a thread of continuity and identity.

The way I prefer to think about Entities is what we manage in our domain day after day. Entities span through long periods of time and run across multiple systems. They often have lives well beyond the applications we are writing and they must be effectively tracked. As a general rule, assume that mistakes in Entity identification and tracking are expensive to notice and repair.

To discover Entities in your domain, talk to your functional people and your end users. Ask them to walk you through the main scenarios they would like the new system to implement. How are they going to use the system? What is important to them and why? What do they really care about? What is important to your company and how does it need to be reported? The chances are you will be talking about what needs to be tracked and how, thus you will be talking about Entities.

Examples: Person, Account, Loan, Application, Payment.

Entity Relationships

What are the relationships between the Entities? Before getting into technical details, create a simple analysis diagram that shows the Entities you have discovered and their relationships. Lets consider a simple example:

Scenario 1: User logs in into the system to check the status of their applications and loans.

Scenario 2: User calls a Customer Service Representative (CSR) to reset their password.

Entity Relationship

Your research and conversations about the domain model revealed 4 Entities: Account, Person, Application, and Loan. Let us walk through the first scenario:

  1. User logs in into the system. The system needs to retrieve the user's security Account and verify their username, password, and any additional validation factors.
  2. Upon successful login, the system retrieves a previously stored Person record based on Account information. Thus, you see an arrow from Account to Person. You learned that each Account has a corresponding Person record, but not all People have created an online Account. That explains the numerical values on the diagram.
  3. Based on Person, the system retrieves their Application and Loan information. Thus, the arrows are shown from Person to Application and Loan. Person is created on the system with their first Application, but not all Applications are approved to become a Loan. Notice that there is no arrow between Application and Loan - we cannot determine its direction based on our current scenarios.
Now, let us take a look at the second scenario:
  1. User cannot verify the security information during login and calls CSR to reset their password. CSR asks them a series of Personal questions and retrieves their Person record.
  2. CSR retrieves the user's Account record for additional verification and resetting the password. Thus, you see an arrow from Person to Account.
Do not worry about having a circular dependency between Account and Person on the Analysis diagram. In one of our next articles, we will show several implementation options for the relationships. We will not have a circular dependency in the final implementation.

Domain Model Structure

Account, Person, Application, and Loan are our first classes in the Domain Model. For now, place them together in a sub-folder under the Domain Model root. We name this folder "Operation":

Domain Model Structure - Operation folder

Summary and Additional Tips

  1. Entity is an object that is not fundamentally defined by its attributes, but rather by a thread of continuity and identity.
  2. Entities span through time and space and are being tracked and managed in the day-to-day operations.
  3. Discover Entities by talking to your functional and end users. Create simple Analysis diagrams as a result of these conversations.
  4. Entity's primary responsibility is to maintain its continuity. Keep it simple by leaving complex behaviors out of its class definition.
  5. Managing life-cycle of Entities is a complex and risky job. Try to keep the number of Entities in the system down. Too many Entities will defuse your model and create no value.
  6. Compare Entities of the same type by their identity regardless of their form and history. Make identity type a Value Object.
  7. If you are interested in creating a simple base Entity class, you can start with the one listed below:

    ///<summary>Base Entity Class </summary>
    public class Entity <T>
    {
        public T ID { get; protected set ; }
        public static T NewID { get { return default (T); } }

        ///<summary>Returns true if the object has not being stored in the system. </summary>
        public bool IsNew { get { returnEquals(NewID, ID); } }
        public Entity(T id) { ID = id; }
    }

Happy coding! To be continued...



Welcome to ModelBlog

Thank you for visiting ModelBlog. We hope the time you spend with us will be both entertaining and worth your while. Have fun!

Search

Tags