Benefiting Java must see. (Good book recommended!)

zhaozj2021-02-16  41

Powered by http://www.wufuheng.com/

Telling Oo, people who have learned for a few years will say, oo, I will. Java is born is OO, I have been using Java, I naturally oo. When OO is simple, there are several Class. But when complicated, one person wrote several CLASS to complete a project, and another person also wrote a few Class, but Reusability, Flexibility is out of stock. To make a simple example, you have to make a Window, there is button, scroll bar, status bar, etc., this Window is supported in different forms, such as Bitmap_Window, these button, scroll bar, status bar can be drawn on Load Good picture, better look. For example, Plain_Window is all ordinary Button, Scroll Bar, Status Bar. How will you design? Very simple. base class: buttonderived class: bitmap_button, plain_button etc. base class: scroll_barderived classbitmap_scroll_bar, plain_scroll_bar this design looks really good, you want to create a window, so you can window mainwin = new bitmap_windowbutton button1 = new bitmap_buttonbutton button2 = new bitmap_buttonmainwin.add ( Button1) mainwin.add (button2) scroll_bar sbar = new bitmap_scroll_barmainwin.add (sbar) You may say that this is not very good, but if I want to turn the entire window into plain? Turn the entire window into other forms? Search and Replace, replace all Bitmap to Plain. Window mainwin = new plain_windowbutton button1 = new plain_button, etc. Maybe you don't have any trouble, but if it is a big project, Button and so on must be created everywhere, and it is very troublesome to modify it. It is easy to make mistakes. This is involved in Flexibility.

Is there a good solution? Have! The design patterns abstract factory.abstract class BaseFactory {abstract public window createWindow (); abstract public button createButton (); abstract public scroll_bar createScrollBar (); // etc etc} class BitmapFactory: BaseFactory {public window createWindow {return new bitmap_window;} public button createButton {return new bitmap_button;} public scroll_bar createScrollbar {return new bitmap_s_bar;}} class PlainFactory: BaseFactory {public window createWindow {return new plain_window;} public button createButton {return new plain_button;} public scroll_bar createScrollbar {return new plain_s_bar; }} You may ask, what is the use of these things? Have! BaseFactory factory = new BitmapFactory; window mainWin = factory.createWindow (); button button1 = factory.createButton (); button button2 = factory.createButton (); window.add (button1); window.add (button2); if you want to Change to Plain, only the basefactory factory = new placefactory is OK! The benefits of doing this are obvious. First, users don't need to care about BitmapWindow, PlainWindow, or what Window, Object Creation, and concrete Code are completely separated, which greatly reduces Dependcent. Second, this enforce is Bitmap_Button only can be added to Bitmap_window. There is also a range of benefits. I will not repeat. Interested friends, please see this book. Design Patterns (1995 Addison-Wesley). What is this book? I am not good, I don't say much, please see the book review of others. The most important software development book "Design mode" ● "Design mode" "Design mode" in the "Design Patterns: Elements Of Reusable Object-Oriented Software", this book The name of the book has been published in 1995. The book has four authors Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides, all Ph.D., one is not small. The book is called a classic name for object-oriented, has been ranking Amazon sales list, and Amazon's readers have achieved a full five stars. Expert scholars have also praised "design patterns". It has been praised: "This book is one of the best, the best, the best, and the book is not a general, but a combination of examples, in the best way. The legal status of the model is established.

"- Stan Lippman, C Report" This public looks forward to achieving full effects. The book gathers the available design of time test. From the years of object-oriented design experience, the author selected 23 models, which constitutes the essence of the book, and every excellent programmer must have this "design mode". "--Larry O'Brien, Software Development" is especially useful in a practical environment, because it is classified for a set of design, expressible object-oriented software design patterns. The entire design pattern is still very new. The four authors of this book may have occupied half of the deepest experts in this field, so they define the model of the model can be used as an example of the later person. If you want to know how to properly define and describe design patterns, we should be able to get inspired "- Steve Billow, Journal of Object-Oriented Programming", which expresses a very valuable thing. There is a unique contribution to the field of software design because it captures valuable experience in object-oriented design and expresses it in a simple and reused form. It will become a book I am looking for often reading the object-oriented design idea: This is the true meaning of multiplexing, isn't it? "- Sanjiv Gossain, Journal of Object-Oriented Program, although it was published five years ago, the content of software engineering is that the important concept of software engineering is reused, and the development of object-oriented technology has made people an idea to inventive. "Software IC" to meet the needs of software development, but this idea seems to be too unreachable, and "model" in recent years gives "software can be reused" beautiful solution Program. The word pattern origin is from urban building, "each model describes a problem that has been repeated around us and the core of the solution. In this way, you can use this scheme multiple times without having to repeat labor. "This idea is applied to the object-oriented design area, refers to summarizing the various problems encountered in software design, and proposes a design solution. Experienced designers know that it is not to solve any problems. This The purpose of the book is to record the design experience of object-oriented software as a design pattern, and each design mode system naming interpretation and evaluates an important and repetitive design in object-oriented systems. This book provides 23 design patterns It seems to be less than the number of "The Pattern Almanac 2000" in 2000, known as more than 700 models, but the number of patterns is not much, the key is to understand the idea of ​​design model, learn to use. One of the author John Vlissides once held a speech, he asked how many people in the audience have seen "design model", almost everyone raised their hands, he asked who can explain how to achieve combination mode (one of 23 modes), raise hands There are very few people. These 23 models condense the author's experience and heart, when you start thinking about how to apply models in the design, how to make the design is simpler, more flexible, multiplexing, your strength is Informing a level, "design mode" is a must-have book for each software designer, but I want to explain that this book is not a book that is easy to read, some experts even say a developer. It takes a year to understand the essentials of this book. The learning model requires repeated practice to experience it, which can be applied. This is a bit of the style of learning, Go is a summary of the short-term in the middle of the year, but not simply Application, to see the case to select the appropriate set of styles, and press the chess party to do so.

This book is not reading the high school. Only if there is a considerable basic reader to benefit from this book, readers must first become familiar with object-oriented design languages ​​such as C or Java, and it is best to develop and maintain object-oriented software. Only some of the design experiences can fully understand the design model. Although the publication of this book is late for nearly five years than in the English version, it always has a huge progress. According to reliable news, there are several publishers in China to introduce foreign technical names. It keeps tracking abroad to track foreign technology in technology publishing. This is the best in the overall level of domestic software industry, and the latest software. Technology and development comes from abroad, I hope that the future technical name is no longer the difference in these five years, and I hope that my country's software industry will go overseas. -------------------------------------------------- ---------------

http://www.wufuheng.com/

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

New Post(0)