【笔记】《Expert One on One J2EE Design And Development》笔记

2023-11-23 05:50

本文主要是介绍【笔记】《Expert One on One J2EE Design And Development》笔记,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

《Expert One on One J2EE Design And Development without EJB》笔记(点击查看)

《Expert One on One J2EE Design And Development》笔记(本文)


博主:注意:该书出版时间是2004年。仅需阅读自己关注的部分。


第一章

讨论J2EE的架构,分布式架构下是否必须使用EJB组件。大意是:J2EE是个伟大的平台和技术标准,但是官方却误导了大家。官方(当年,2002年)推荐的书籍和实践是不对的,应该是问题驱动而不是用J2EE驱动开发,致使很多人为了用J2EE而用J2EE,而不是根据项目的实际情况选择合适的技术。

首先,官方推荐的“J2EE开发模式”扭曲了我们熟悉的GoF中的设计模式。其次,J2EE的EJB组件并非是开发分布应用必需的技术,还可以使用SOAP中的WebService技术。

全都是陈年旧事儿,大致看看即可。

1. 三层结构(P27)

作者提到的三层结构与我的认识不同。

1. Enterprise Information System(EIS) Tier

有时也叫 Integration Tier

包括:DBMS,legacy mainframe applications。The EIS tier is outside the control of the J2EE server.

2. Middle Tier

This tier contains the application's business objects, and mediates access to EIS tier resources.

3. User Interface(UI) Tier

In web applications, the UI tier consists of servlets, helper classes used by servlets, and view components such as JSP pages.

 

可以看到,作者认为,EIS层是中间层之外的,不受J2EE控制的外部事物。而UI层则包括 JSP/Servlet,中间层包括业务逻辑和与EIS层交互必不可少的中间件。

 

2.  Non-distributed Architectures(P28)

Web Application with Business Component Interfaces

博主:这莫非就是 service/serviceImple 两层结构的由来?

 

3. MVC(P37)

Model, view, and controller objects map onto J2EE components as follows:
❑ A model is a JavaBean that exposes data. A model object should not know how to retrieve
data from business objects, but instead, should expose bean properties that enable its state to
be initialized by a controller.
Thus, the rendering of a view will never fail because of reasons
such as failure to retrieve data. This greatly simplifies error handling in the presentation tier (it
is also possible to use XML documents as models).
❑ A view is a component that is used to display the data in a model. A view should never
perform business logic or obtain data other than that which is made available to it in a model.
View components in J2EE systems are most often JSP pages. Each view in this architectural
pattern is analogous to one implementation of a simple contract ("display a certain set of
objects"). Thus, each view can be replaced with another view that displays the same model
differently, without altering the application's behavior.
❑ A controller is a Java class that handles incoming requests, interacts with business objects,
builds models, and forwards each request to the appropriate view. A request controller does
not implement business logic (this would impinge on the responsibilities of the middle tier).

 

4. 可移植性(P39)

接口级别(设计级别)的可移植,源代码级别的可移植。作者认可接口级别的可移植,源代码级别的移植代价很高。

We must distinguish between implementation portability ("this code runs without
change on any application server") and design portability ("this application will work
correctly and efficiently on any application server, if a small number of clearly
identified interfaces are re-implemented"). Total implementation portability can be
achieved in J2EE, but may not be a realistic or even a very worthwhile outcome.
Design portability is achievable, and delivers most of the business value of portability.
Even when portability is not a business requirement, design portability should flow
from good OO design practice

 

第二章

可直接略过,信息有些过时。主要讲选择J2EE中间件,组建团队,选择开发工具,识别和防范风险。

 

第三章

测试J2EE应用。

5. 常见测试

很贴心的把常见的测试种类都解释了一遍。

Definitions
o Unit tests
Unit tests test a single unit of functionality. In Java, this is often a single class. Unit tests are the
finest level of granularity in testing, and should test that each method in a class satisfies its
documented contract.


o Test coverage
This refers to the proportion of application code that is tested (usually, by unit tests). For example,
we might aim to check that every line of code is executed by at least one test, or that every logical
branch in the code is tested.


o Black-box testing
This considers only the public interfaces of classes under test. It is not based on knowledge of
implementation details.


o White-box testing
Testing that is aware of the internals of classes under test. In a Java context, white-box testing
considers private and protected data and methods. It doesn't merely test whether the class does
what is required of it; it also tests how it does it. I don't advocate white-box testing (more of this
later). White-box testing is sometimes called "glass-box testing".


o Regression tests
These establish that, following changes or additions, code still does what it did before. Given
adequate coverage, unit tests can serve as regression tests.


o Boundary-value tests
These test unusual or extreme situations that code under test should be able to handle (for example,
unexpected null arguments to a method).


o Acceptance tests (sometimes called Functional tests)
These are tests from a customer's viewpoint. An acceptance test is concerned with how the
application meets business requirements. While unit tests test how each part of an application does
its job, acceptance tests ignore the implementation details and test the ultimate functionality,
using concepts that make sense to a user (or customer, in XP terminology).


o Load tests
These test an application's behavior as load increases (for example, to simulate a greater
population of users). The aim of load testing is to prove that the application can cope with the load
it is expected to encounter in production and to establish the maximum load it can support. Load
tests will often be run over long periods of time, to test stability. Load testing may uncover
concurrency issues. Throughput targets are an important part of an application's non-functional
requirements and should be defined as part of business requirements.

o Stress tests
These go beyond load testing to increase load on the application beyond the projected limits. The aim
is not to simulate expected load, but to cause the application to fail or exhibit unacceptable response
times
, thus demonstrating its weak links from the point of view of throughput and stability. This can
suggest improvements in design or code and establish whether overloading the application can lead to
erroneous behavior such as loss of data or crashing.

都是常见的名词,注意最后2个测试:负载测试和压力测试的区别。

 

本文暂停,已经转看这本中文书了:《Expert One on One J2EE Design And Development without EJB》笔记(点击查看)

这篇关于【笔记】《Expert One on One J2EE Design And Development》笔记的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/415803

相关文章

【学习笔记】 陈强-机器学习-Python-Ch15 人工神经网络(1)sklearn

系列文章目录 监督学习:参数方法 【学习笔记】 陈强-机器学习-Python-Ch4 线性回归 【学习笔记】 陈强-机器学习-Python-Ch5 逻辑回归 【课后题练习】 陈强-机器学习-Python-Ch5 逻辑回归(SAheart.csv) 【学习笔记】 陈强-机器学习-Python-Ch6 多项逻辑回归 【学习笔记 及 课后题练习】 陈强-机器学习-Python-Ch7 判别分析 【学

系统架构师考试学习笔记第三篇——架构设计高级知识(20)通信系统架构设计理论与实践

本章知识考点:         第20课时主要学习通信系统架构设计的理论和工作中的实践。根据新版考试大纲,本课时知识点会涉及案例分析题(25分),而在历年考试中,案例题对该部分内容的考查并不多,虽在综合知识选择题目中经常考查,但分值也不高。本课时内容侧重于对知识点的记忆和理解,按照以往的出题规律,通信系统架构设计基础知识点多来源于教材内的基础网络设备、网络架构和教材外最新时事热点技术。本课时知识

论文阅读笔记: Segment Anything

文章目录 Segment Anything摘要引言任务模型数据引擎数据集负责任的人工智能 Segment Anything Model图像编码器提示编码器mask解码器解决歧义损失和训练 Segment Anything 论文地址: https://arxiv.org/abs/2304.02643 代码地址:https://github.com/facebookresear

数学建模笔记—— 非线性规划

数学建模笔记—— 非线性规划 非线性规划1. 模型原理1.1 非线性规划的标准型1.2 非线性规划求解的Matlab函数 2. 典型例题3. matlab代码求解3.1 例1 一个简单示例3.2 例2 选址问题1. 第一问 线性规划2. 第二问 非线性规划 非线性规划 非线性规划是一种求解目标函数或约束条件中有一个或几个非线性函数的最优化问题的方法。运筹学的一个重要分支。2

【C++学习笔记 20】C++中的智能指针

智能指针的功能 在上一篇笔记提到了在栈和堆上创建变量的区别,使用new关键字创建变量时,需要搭配delete关键字销毁变量。而智能指针的作用就是调用new分配内存时,不必自己去调用delete,甚至不用调用new。 智能指针实际上就是对原始指针的包装。 unique_ptr 最简单的智能指针,是一种作用域指针,意思是当指针超出该作用域时,会自动调用delete。它名为unique的原因是这个

查看提交历史 —— Git 学习笔记 11

查看提交历史 查看提交历史 不带任何选项的git log-p选项--stat 选项--pretty=oneline选项--pretty=format选项git log常用选项列表参考资料 在提交了若干更新,又或者克隆了某个项目之后,你也许想回顾下提交历史。 完成这个任务最简单而又有效的 工具是 git log 命令。 接下来的例子会用一个用于演示的 simplegit

记录每次更新到仓库 —— Git 学习笔记 10

记录每次更新到仓库 文章目录 文件的状态三个区域检查当前文件状态跟踪新文件取消跟踪(un-tracking)文件重新跟踪(re-tracking)文件暂存已修改文件忽略某些文件查看已暂存和未暂存的修改提交更新跳过暂存区删除文件移动文件参考资料 咱们接着很多天以前的 取得Git仓库 这篇文章继续说。 文件的状态 不管是通过哪种方法,现在我们已经有了一个仓库,并从这个仓

忽略某些文件 —— Git 学习笔记 05

忽略某些文件 忽略某些文件 通过.gitignore文件其他规则源如何选择规则源参考资料 对于某些文件,我们不希望把它们纳入 Git 的管理,也不希望它们总出现在未跟踪文件列表。通常它们都是些自动生成的文件,比如日志文件、编译过程中创建的临时文件等。 通过.gitignore文件 假设我们要忽略 lib.a 文件,那我们可以在 lib.a 所在目录下创建一个名为 .gi

取得 Git 仓库 —— Git 学习笔记 04

取得 Git 仓库 —— Git 学习笔记 04 我认为, Git 的学习分为两大块:一是工作区、索引、本地版本库之间的交互;二是本地版本库和远程版本库之间的交互。第一块是基础,第二块是难点。 下面,我们就围绕着第一部分内容来学习,先不考虑远程仓库,只考虑本地仓库。 怎样取得项目的 Git 仓库? 有两种取得 Git 项目仓库的方法。第一种是在本地创建一个新的仓库,第二种是把其他地方的某个

Git 的特点—— Git 学习笔记 02

文章目录 Git 简史Git 的特点直接记录快照,而非差异比较近乎所有操作都是本地执行保证完整性一般只添加数据 参考资料 Git 简史 众所周知,Linux 内核开源项目有着为数众多的参与者。这么多人在世界各地为 Linux 编写代码,那Linux 的代码是如何管理的呢?事实是在 2002 年以前,世界各地的开发者把源代码通过 diff 的方式发给 Linus,然后由 Linus