Thursday, May 19, 2011

Cheap Ballroom Shoes Online

Design Patterns Applicability

About design patterns raises a lot of emotion. Some of them are ardent fans, others come up with contempt, claiming that in the real world are useless.

Design Patterns are only a tool, and emotional approach to the "hammer" is simply irrational. Therefore, I propose a slightly different approach - context.

By the way interesting that during the talks more and more I hear from experienced programmers paragraph expression of irritation over bezkontekstowym our business approach to all techniques, practices, methodologies, products, solutions. It is said that we are servo fashion more than Milan or Paris;)
feels a strong marketing fatigue.

In his career programming I had the opportunity to work on systems of different class. I understand the class by the class of problems which were the main challenges. But this job trainer and consultant has given me access to see the spectrum of classes of problems, in an amount that normally collects in the vicinity of the pension.

I am writing this to go to the context of the applicability of design patterns. From my observation is that context is spread on 2-dimensions: the above-mentioned problem, and the class dimension of personality (wipe away about all aspects of the psychology of programmers).


CLASS CONTEXT OF THE PROBLEM

If we are in the context of business applications, and our job is to implement the following requirements, the challenges facing us such as:
- okiełzanie
illogical requirements - modeling tools for business (our application), which works with the nature of process
- creating an intuitive GUI
- fitting into an existing database, which was designed before Mandżulską War III, at a time when no one else really did not understand the domain.

In this context, is often not even need to use OO techniques - albeit with the use of programmed objects (I like how different languages \u200b\u200bin the mainstream?).

with a wide range of design patterns we can use in this context - in some more complex - cases:
- strategy - if we have a variety of the same behavior / business operations. The approach promoted by this pattern has recently become fashionable due to functional languages. To what else is at the level of syntactic transfer object implementing the interface with one method than the ordinary transfer function semantic level?
- Responsibility Chain - a chain starts to pay us when we want to model the decision about which option you want to perform the business logic. It pays to when we expect to modify the number of variants.
- Specification - allows for transparent modeling of complex rules that determine whether a business object should be subject to some processing. It pays when the rules are complicated and there are logical dependencies between them. The complex pattern that occur several times throughout the code.
- Stan - a very complex pattern that may occur once, maybe twice in medium-sized system. Allows you to clear a state machine modeling for business objects that have such different statuses and, depending on the status of a) may or may not pass the other and b) behave differently. It pays when we have a lot of status and convoluted logic control behavior dependent status.
- generic method - a simple pattern, classic polymorphism, allows to model various forms of business algorithms. From the time when the situation becomes complicated cease to pay and the value of refactoring to make the Strategy.
- facade - a trivial pattern that does not deserve to be called a pattern, but it conveniently simplifies what skomplikowaliśmy first;)
- decorator - decorator starts introducing us to pay off when you want! At runtime! (Not during programming or compiling) decide to add new behaviors. Very strong, but rarely the business logic can be modeled so elegant. Skipping

Singleton, who in most cases is antywzorcem killing testable. Besides his business model there is rarely sensible.

While the emergence of in many cases the business application using the Strategy, Methods of templates, Facades Ltd is a normal phenomenon large enough number of chains, decorators and the United states on overengineering and "disease model".

Other patterns from the catalog does not have too much chance for the potential emergence of a business application - just used to solve problems in other classes.

The business applications for a more useful patterns bring a different kind:
- ways of modeling and the strategic model of a set of Domain Driven Design
- archetypes business models
- best practices for Usability



But if we are in the context of software quality: a platform, framework, server, dedicated high-performance portal, specialized software, such as: tools for the design / composition, etc. then we are faced with an entirely different class of problems:
- Openness for expansion while protecting the public api to modify core
- performance, memory savings,
- security,
- flex api,
-
balance constraints - like

viewing the source code this type of application, we can see many instances of patterns or structures like them modified due to some intent. Sometimes they are just named differently because of the ignorance of the author - but it is interesting that came up with some ideas independently, without knowing the pattern before.

addition to the earlier models in this context, cost-effective addition may be:
- Builder - to separate plans for the construction of the final shape of the structure. Cost-effective when we anticipate the emergence of new "products"
- Visitor - api to allow users to enter new behavior by adding its code instead of modifying a library / framework. Double Dispach for the poor, for example, to open the core to expand
- Proxy - to allow the programming model in the style of Aspect Oriented
- Mediator - trash on the chaos of the network of collaborating objects. If you have chaos, it is explicitly limit its scope.
- Bridge - if you have an unstable core, and you want to risk publishing a stable api
- prototype - if you want to fabricate a lot of classes and do not want to create is similar to them, mirroring the hierarchy of factories.
- Flyweight - if you have have a huge number of objects, but some of them can uwspólnić half, because it is not their changing status - saving memory.


Giving examples of both classes of problems I wanted to show that it is simply other developers / designers / architects can live in another world. This is something that is useless for us, does not mean it is useless in general.

Uploading all developers into one bag (preferably a common bag with computer;) causes loss of context and thus blur the required competencies to the task.

It is also worth to consider the classes of problems that intrigue us, and develop appropriate skillset - without an adequate level of competence of certain classes of projects will be closed to us forever.



CONTEXT OF PERSONALITY

think any developer would agree that it depends on the design of the simplest solution. Perhaps this search for simplicity is what attracts people to the program - well, maybe except for clerical workers driven by a desire to ease (hehe naive) earnings.

problem lies in the perception of simplicity.
Some say that an approach is simple if it can rapidly begin in the orient. And never mind that later turns out to be confusing in the details. It is important to quickly begin to "catch" what's going on, and later - it is difficult, the world is confused.
Others say that something is simple, if you give your objective is to thoroughly understand the fundamentals that allow you to imagine mentally the entire solution. It does not matter that it may have to invest at the beginning of time - much time - in the understanding of the principles and the new things that seem superficially the complex. If you later find that it was easy, they say that it is simple.

Which approach is better - as always, it depends on the context. In the context of IT for example, may depend on time constraints, that is, how much time we spend. Another limitation may be the profitability in the long term (sometimes we do business experiment and see how it develops:). Therefore, in each example, the pattern I wrote about this when we can introduce a pay structure.

cognitive strategy that takes our brain approach for simplicity (it must be simple right away, it must be easy to target) is associated strongly with the type of our personality.
- some of us are focused on the perception of similarities, some differences in perception - a meta-model programs.
- some of us are open to new experience, others are more conservative - Big 5 model.
- some of us has his inner world, which shapes the perceived reality, others are inclined to act immediately and almost tangible experience -
MBTI model - some of us live in the future, in some of its model, others live in the here and now time.


MODEL Dreyfus


A competency model Dreyfus Brothers I have written several times . Here you will cite only the level of Competent . By developing a skill at that level naturally begin to look for best practices, standards (nomen omen). So it is natural that developing competence under the title "Programming / Design OO" at some point start to look for patterns.
In subsequent phases of development that power, we will ask questions, to question, to look more broadly. But on the third level (Competent) gives a large catalog of patterns and allows you to kick just to optimize the learning process. He said Jim Copelin with time reject "from his side's bicycle wheel and stop talking about patterns, just intuitively doing what needs to be.


//============================================= =

Sometimes you encounter those who say that design patterns are "too academic". Hmm I think the opposite. Directory patterns do not go hungry solutions that are not discovered and discussed by the community of practitioners. Of course, using a very sophisticated pattern to a very trivial problem, we feel the triumph of form over substance. But the reason is incompetent to use in the wrong context - namely its lack of understanding.

To gain ideas about what it means to "academic" approach to OO refer to this text .

0 comments:

Post a Comment