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

JSP
无需调优的内存优化
JAVA EXCEL API
新手指南之如何搜索你的问题的答案
Java 101:如果我不懂Java该怎么办?
jsp由浅入深
把本页内容导出成word文件或excel文件(原创)
在BEA WebLogic中使用Java消息服务
Form Your Own Design Pattern Study Group
从Coding Fan到真正的技术专家
我的Mysql5.0中文乱码解决方案
结合JAVASCRIPT将HTML导入Excel形成简单Web报表
Struts 的汉字显示问题终结解决方案
j2me网络实战指南
Java Page Flow开发:从JDBC数据源中检索并显示数据
人生、梦想、Java,又一个梦想者上路!
用Struts开发基于MVC的Web应用
Apache plug-in配置代理请求实战
一个简单的Timer Service
Tomcat 服务器下 JSP 页面中文问题及解决方法总结
Java Servlet 编程及应用(一)

JSP 中的 Form Your Own Design Pattern Study Group


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-03   浏览: 38 ::
收藏到网摘: 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!