最后一学期决定旁听Software Architectures 这门课。课程老师是“Software Architecture: Foundations, Theory, and Practice”一书的作者之一 - Nenad Medvidovic。课程网站见链接。
What is the Big Idea:
The big idea is that software architecture must be at the very heart of software system design and development.
An architecture-centric approach to software engineering places an emphasis on design - design pervades the engineering activity from the very beginning.
Software Engineering Difficulties:
Software engineers deal with unique set of problems.
Some problems can be eliminated - “accidental difficulties”
Some problems can be lessened, but not eliminated - “essential difficulties”
如:
- Complexity
- Conformity(一致性,便于用于不同的操作系统 )
- Changeability(易于修改的,有延展性的)
- Intangibility(软件是无形的,它不像建筑一样有一定的几何结构以及满足一定的物理规律)
Analogy: Architecture of Buildings
显而易见的共同点:
- Satisfaction of customers’ needs
- Specialization of labor
- Multiple perspectives of the final product
- Intermediate points where plans and progress are reviewed
更进一步的相似点有:
- Architecture is different from, but linked with the product/structure
- Properties of structures are induced by the design of the architecture
- The architect has a distinctive role and character
- Process is not as important as architecture
- Architecture has matured over time into a discipline(架构成为一门学科)
Architectural styles as sets of constraints.
Styles also as wide range of solutions, techniques and palettes(调色盘) of compatible materials, colors and size. 即根据不同的条件和情况选择不同的styles.
不同之处和类比的局限性有:
- We know a lot about buildings, much less about software
- The nature of software is different from that of building architecture
- Software is much more malleable(具有延展性) than physical materials
- The two “construction industries” are very different = =建筑工人和程序员的工作环境差别很大hhh
- Software deployment has no counterpart in building architecture
- Software is a machine; a building is not.
- 我们可以比较容易的看出房屋的架构(比如说在房子里面走走量量就可以画出来这个房子的设计图)而对于一个软件来说,看出其结构是很难的。
举例1: The Architecture of the Web
What is the Web?
In one view, focusing on the user’s perception, the Web is a dynamic set of relationships among collections of information.
In another view, focusing on coarse-grained aspects of the Web’s structure, the Web is a dynamic collection of independently owned and operated machines, located around the world, which interact across computer networks.
In another view, taking the perspective of an application developer, it is a collection of independently written programs that interact with each other according to rules specified in the HTTP, URI, MIME and HTML standards.
下面我们从架构的角度来介绍Web.
- The Web is a collection of resources, each of which has a unique name known as a uniform resource locator, or “URL”.
- Each resource denotes, informally, some information.
- URI’s can be used to determine the identity of a machine on the Internet, known as an origin server, where the value of the resource may be ascertained.
- Communication is initiated by clients, known as user agents, who make requests of servers.
- Web browsers are common instances of user agents.
- Resources can be manipulated through their representations.
- HTML is a very common representation language used on the Web.
- All communication between user agents and origin servers must be performed by a simple, generic protocol (HTTP), which offers the command methods GET, POST, etc.
- All communication between user agents and origin servers must be fully self-contained. (So-called “stateless interactions”)
前面两个角度介绍的实在是太泛泛了,所以我们只与最后一个角度相比较。
按照这个思路来解释上面那个图(developer view那个)就容易很多了。
Documents A to G are resources; machines machine.uci.edu and machine.usc.edu running the Apache Web server are example origin servers. User agents could be personal laptops running a Web browser such as Internet Explorer. Representations include a copy of the HTML of Lewis’s biography, and a JPEG of the current view of The Kilns as imaged by a webcam.
举例2: 从Architecture的角度来看一个Unix Shell应用
|
|
This application creates a sorted list of all the files in the directory named invoices whose names include the character string “August”.
为了理解这个应用, 我们只需要知道filter是什么, 该应用中的每一个filter的作用是什么, 什么是pipe, pipe 是如何连接这几个filter的就可以了。
此外,根据这个例子我们可以总结出一个architectural style - “pipe-and-filter”, 并且运用到更多的情景当中。
举例3: 在产品线和产品系列上的运用
有这样一个情景:
客户可能有这些不同的需求
- a 35-inch HDTV with a built-in DVD player for the North American market.
- a 35-inch HDTV without the DVD player
- a 35-inch HDTV with a built-in DVD player for the European market
这些产品互相不同但是又有相同的组成部分。那为了满足客户的各种需求,制造商就要考虑Reusing structure, behaviors, and component implementation了。
Reusing 好处多多:
- Simplifies the software development task
- Reduces the development time and cost
- Improves the overall system reliability
- Concrete manifestation of the company’s corporate experience, knowledge, and competitive advantage. 结构化的产品往往需要公司的部门也结构化,这样新产品的诞生将不再依赖过度依赖于员工的经验。尤其对于员工流动性大的公司来说是大有益处。