Case Study

Learn about the 4+1 architectural model and how to solve the problem using the k-NN approach.

Our case study will span many of the chapters of this course. We’ll be examining a single problem closely from a variety of perspectives. It’s very important to look at alternative designs and design patterns; more than once, we’ll point out that there’s no single right answer: there are a number of good answers. Our intent here is to provide a realistic example that involves realistic depth and complications and leads to difficult trade-off decisions. Our goal is to help the reader apply object-oriented programming and design concepts. This means choosing among the technical alternatives to create something useful.

This first part of the case study is an overview of the problem and why we’re tackling it. This background will cover a number of aspects of the problem to set up the design and construction of solutions in later chapters. Part of this overview will include some UML diagrams to capture elements of the problem to be solved. These will evolve in later chapters as we dive into the consequences of design choices and make changes to those design choices.

Classification

Our users want to automate a job often called classification. This is the underpinning idea behind product recommendations: last time, a customer bought product X, so perhaps they’d be interested in a similar product, Y. We’ve classified their desires and can locate other items in that class of products. This problem can involve complex data organization issues.

It helps to start with something smaller and more manageable. The users eventually want to tackle complex consumer products but recognize that solving a difficult problem is not a good way to learn how to build this kind of application. It’s better to start with something of a manageable level of complexity and then refine and expand it until it does everything they need. In this case study, therefore, we’ll be building a classifier for the iris species. This is a classic problem, and there’s a great deal written about approaches to classifying iris flowers.

A training set of data is required, which the classifier uses as examples of correctly classified irises. We will discuss what ...