Composite Design Pattern using Java and Database

Compositecomposite Design Pattern helps the developer to abstract a information tree structure in code. The following example shows how to use in a Hierarchical Filter need. This page is in a continuous writing mode, check later for new updates or ask me on my twitter.

The main idea here is to present how to use it, if you want a background on composite patter I recommend Gamma et al. book[1]. The diagram to present the composite is the follow, for this diagram I use OPM (Object Process Methodology)[2] which shows a Hierarchical Flow process containing multiple Filters subprocesses which is invoked by it.

composite-design-pattern-for-hierarchical-flow

Figure 1 – Composite design pattern

The implementation requires two steps the pattern coding, the controller coding for filter and flow loading.

<Next writing topic>

Jumping to controller implementation. The controller will load the composite classes according to database configurations. As first step the configuration of the composite hierarchy is needed, the suggestion here is to keep the configuration inside the database as a entity relationship model. Database tables will provide the model for further view(e.g. JSON) implementation. The following diagram show how use a composite within conjunction with traditional database implementation.

Configuring-and-using-a-composite-class

Figure 2 – Business Controller in conjunction with Composite Pattern

The configuring process can be implemented using database as datasource which will store  all composite information.

References:

[1]Design Patterns: Elements of Reusable Object-Oriented Software

[2]Object-Process Methodology: A Holistic Systems Paradigm

Ultima atualização: 20/Set/2015

The Customer Problem

ProblemProblem, What Problem? Why is it happening? To propose a solution the problem is the key component. Often entrepreneurs, software engineers, designers forget to trace back this valuable asset to guide the development of the design. The problem study is the “missing part” and is what this article is about. As it is a continuous format, come back in other moments for a fresh look.

From math point of view…

The verbal statement of the problem must be understood. [2](Polya 1957).

I found this excellent reference about “how to solve a problem” from George Polya. Polya was Emeritus professor of Stanford and construct studies in mathematics such number theory and mathematical analysis. In these series of work on “how to solve a problem” he developed a framework or guide with four steps which is very interesting for us here.

  1. Understand the problem.
  2. Devising a Plan.
  3. Carrying out the plan.
  4. Looking back.

Poly bring four steps which includes the thoughts regarding the solution (or design). But I will state only the initial part of which is understanding the problem.

drawit-diagram3

Polya proposes that the process of understanding the problem generates questions related to: What is unknown? What is the data and conditions? Is the condition sufficient to understand unknown? Those questions are a good start point to dive into customer problems with a thoughtful approach. I will continue here…

In contrast of math the Startup Management think problem as a pure customer landscape, have a look what I compile.

From the entrepreneurship or VC point of view…

For Blank and Dorf(2012) is their Startup Owner’s Manual[1] mention the problem study as part of the customer segments of their startup framework. For the authors the problems are latent problems, passive problems, active problems and vision problems(or a problem with home-grown solution).

drawit-diagram1

The point of view here is related to the knowledge about the problem which gravitates  in unknown, know and the solution. the difference between passive and active is that passive problems the customer aren’t motivated to take action on it, different from active which the customer are searching for a solution but not found it yet.

Lets discuss software engineering in the next change here…

References:

[1] Startup Owner’s Manual 

[2] Polya, 1957. “How to Solve lt.” Princeton University (1957). But you can find the new version here: Polya, George. How to Solve It: A New Aspect of Mathematical Method: A New Aspect of Mathematical Method. Princeton university press, 2014.