当前位置: 首页 > 图文教程 > 网络编程 > JSP > Form Your Own Design Pattern Study Group

JSP
java设计模式之Memento
java设计模式之Facade(外观)
JSP如何与EJB SessionBean通讯
通用上载组件的原理及实现
最佳实践:有状态会话 bean运行结束时应及时被显式删除
jsp预编译工具
利用javabean轻松实现对数据库的连接、查询以及增删改--使用范例
利用javabean轻松实现对数据库的连接、查询以及增删改
Redhat下安装Tomcat
用VisualAge for Java开发企业级bean
WebLogic初步研究
一个实现排列和组合的JavaBean
汉字问题深入谈-- 关于JAVA的中文问题
什么是 Enterprise JavaBeans 组件?(三)
Java的内存泄漏
JSP中SQL数据库编程技术
JSP中的字符替换函数 str_replace()实现
JSP开发工具的选择
Jsp分页实例代码
JSP标签快速检索

JSP 中的 Form Your Own Design Pattern Study Group


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-03   浏览: 41 ::
收藏到网摘: n/a

Chapter 7: Adapter and Facade Patterns

  • Discuss the Brain Power on page 244.
  • Stage a fireside chat between Adapter and Proxy. Discuss the similarities and differences in Adapter and Proxy. When would you use one vs. another? Under what conditions would Adapter look like Proxy?
  • Think of a complex system you have to use every day that you would like a facade for. How would you simplify the interface in the facade?
  • Discuss the Principle of Least Knowledge on page 265. Take a small chunk of code you've written, and go through each line to see if it violates the Principle of Least Knowledge. Are there any cases in which you think you should change your code? If so, why?

Chapter 8: Template Method Pattern

  • Take a design that has a lot of lower- and higher-level components (see page 298). Now apply the Hollywood principle and clean up the design as a group.
  • Lead a group discussion on the first Brain Power on page 305. Pick apart the implementation of Sun's sort(), which uses static methods instead of inheritance. Did they do the right thing? Split into smaller groups if you like, and then come back together to discuss or debate as a large group.

Chapter 9: Iterator and Composite Patterns

  • Discuss the Brain Power on page 337.
  • How does the Single Responsibility principle relate to the other patterns you know?
  • Make sure the group understands the differences and relationships between components, composites, trees, and so on.

Chapter 10: State Pattern

  • Continue the State versus Strategy discussion on page 411. Both patterns have exactly the same class diagrams, but they differ in their intent. Try picking a representative for each pattern, and have them debate who they are and how they differ. Then open up the discussion to the entire group. Also see page 418.

Chapter 11: Proxy Pattern

  • Discuss the different types of proxy: remote proxy, virtual proxy, and protection proxy. Make sure everyone in the group understands each type of proxy, and come up with examples of each.
  • Discuss the second Brain Power on page 435.
  • Discuss the proxy zoo on page 488. Come up with at least one example habitat for each type of proxy--in other words, examples of when and where you might want to use that type of proxy.

Chapter 12: Compound Patterns

  • Implement a new type of Duck Factory for the Duck Simulator, ducks that eat. Add a new method to the Quackable, eat(), and a new method to Goose, chew(). How would you have to change the Adapter implementation to accommodate Goose? What if the Quackologists wanted to be notified every time a duck ate something--how would you change the Observer implementation to support this?
  • Discuss the graph of the Model View Controller pattern on page 530. Stage a skit representing a graphical user interface: one person is the view (a button and a display); one person is the controller; and one person is the model. When a user comes along and presses the button, what happens? How does the display get updated based on the button press? Review which patterns are involved and how they work in your skit.
  • Now do the same skit for the web: one person is the client (user and web browser); one person is the servlet; one person is the JSP/view, one person is the bean; and one person is the model. Act out in detail what would happen if a user were adding something to a shopping cart.

Chapter 13: Better Living with Patterns

  • Discuss with the group some solutions that you may have used commonly. Do any of these solutions fit an existing pattern that you've studied in the group? If not, could your solution qualify as a potential pattern (page 579)? Why or why not?
  • Find a catalog description of a pattern not covered in the main part of the book (one of the patterns in the index). You can use the GoF's design patterns book, or find one on the Web. Review the pattern with the group and see if you can understand it; then come up with at least one example of when and how to apply this pattern that is not described in the catalog or the Head First Design Patterns index.

Now It's Your Turn

Well, that should be enough to get your started; all it takes is a few people with the interest, our book, some time, and a meeting place. We look forward to hearing how your studies go!