Design mode in Hello World

xiaoxiao2021-03-06  47

Hello World in the pattern

Do you think about "Hello World" is reached each time? This is the most fundamental wasting opportunity! Below is a story about design patterns ... Crazy Application Design mode is not a new thing about abuse or excessive design mode. I have an example here. I implemented a "Hello World" command line script, using approximately 160 lines of PHP 5 code. This principle has no reason to join the design mode. It does more than a simple print "Hello World". It will print in two optional ways and display other text you entered. The equal script will have only 4, 5 lines. Maybe he needs an example of example? This program uses a variety of design patterns, including MVC (model, view, controller), Observer, Strategy, Decorator, Factory Method (factory method) and Facade (facade) mode). It will focus on trying to use all the actual patterns of GOF, and I will determine it to add it to 1000 lines, but I won't do this because I have other things to do. Some precautions in my writing code: 1, how to make no value of code look into an impressive. 2, how to make this unused mechanism run. 3. How to make more opportunities to increase the useless design mode when the complexity of the program is increased. From a bigger perspective, this observation information is bored. This example looks supports the concept of design patterns, but it is more likely to cause problems and is difficult to diagnose and resolve. If this code is written, it is more important and meaningless part, and maybe it is more difficult to be reconstructed. He is like a maze. This rotten odor from the designed pattern from death is not his unique. But this program works. He has died, it still executes and has a result. You may say that this is like the legs of frogs twitching through the current. Comparing it and a typical Hacker product, it may not be a good place to visit, but this has an emergency exit. Simply put, good rejuvenation work is to change the code directly related to the code. (Although you really want to block the reconstruction, the global variables of single letters will be very effective.) / * Code is slightly, please refer to the original * / challenge: HelloWorldFormatter class only supports the use of command line formatting "Hello World". This example needs to increase HTML support, as if "Hello World
" is formatted. If you want to support HTML, consider XHTML, you must support the format of "Hello World
". Start picking your mode ... Original and code: http://phppatterns.com/index.php/Article/ArticleView/103/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1/1

转载请注明原文地址:https://www.9cbs.com/read-80935.html

New Post(0)