Building Web Applications with UML Second Edition part1

本书介绍如何使用面向对象技术构建强大的Web应用程序。重点在于建立业务逻辑模型,并探讨了建模、过程及Web架构三个关键主题。通过统一建模语言(UML)扩展,帮助读者理解并实现复杂的Web应用。
Chapter 1. Introduction

What This Book Is About

Simply put, this book is about building model-driven Web applications. It is not a book on how to use a particular tool, a step-by-step recipe, or new methodology. It is simply a guide for the project manager, architect, analyst/designer, and implementer of Web applications梐nyone who wants to build robust, scalable, and feature-rich Web applications using the proven object-oriented techniques that traditional client/server applications have been built with for years now. This book builds on the techniques of object-oriented application development rather than defining its own. I say model-driven because the models are the fundamental driving factor in the evolution of the system's development artifacts.

Most of the ideas expressed in this book are not original, and for good reason. Many of the concepts and methods described in this book have developed and evolved over years of practice in multiple domains. These object-oriented practices have enabled projects to be delivered on time and on budget and, most important, have made them predictable. For the most part, the object-oriented principles described in this book are based on the collective works of Grady Booch, Jim Rumbaugh, and Ivar Jacobson, who are also known as the "three amigos."

The amigos are the principal creators of the Unified Modeling Language (UML), a notation for visually expressing the models of software-intensive systems. For many, UML also represents a method, although technically this is incorrect. UML is just a language but like any language expresses things with certain biases. In particular, UML expresses system models and designs in an object-oriented fashion, even though it is being used to express system types as varied as generic business organizational structures and processes to real-time embedded system designs.

The term UML is included in this book's title because it is at the heart of all the discussions of building Web applications in this book. Most of the original work in this text is in the Web Application Extension for UML (WAE). In it, the UML notation is extended with additional semantics and constraints to permit the modeling of Web-specific architectural elements as a part of the system's model. A major theme in this book is that it is critical to model all of a system's business logic, regardless of where or how it is being implemented in the system. For Web applications, this means that in our UML models, we need to capture the execution of business logic in Web pages, in client-side scripts, and in Web components. By having a single central model of all the business logic in a system, we are better able to understand it and eventually to elaborate on it in future releases of the system.

The first edition of this book was for the most part written before I joined Rational Software Corporation. At the time, I was an independent consultant specializing in Web applications. The ideas expressed in the first edition of the book were not, of course, supported by any vendor's tool. Rational Rose was and is my modeling tool of choice; with its extensibility interface, I managed to get some specialized icons in the tool and even create some scripts that would forward engineer ASP components from class diagrams. I am proud to say that since then, the Rose development team has included round-trip engineering of both ASP and JSP components.

Full support of the WAE specification is not, however, in the current version of the product; nor will it ever be. Some things simply are not appropriate for round-trip engineering. They may not be suitable for automation, but they are still important to model since the real goal of modeling is understanding and comprehension, not automation. This book lays out the entire specification with some recommendations on what is important and what is not. But in the end, it will be up to you and your team to decide how much detail you'll need in your models.

Because this is a book about building model-driven Web applications, it focuses on three key topics. Modeling, process, and Web architectures are discussed in the remainder of this chapter.


Role of Modeling

We model to understand complex things. Software today is more complex than ever. As a result, we model software. Our models describe what we want to build, what we are building, and what we have built. Models are used throughout the development life cycle and are key artifacts. Models often connect different types of artifacts梪se case specifications to database tables梐nd provide a chain of responsibility and traceability.

These models are simplifications of reality. Models exist at various levels of abstraction. A level of abstraction indicates how far removed from the reality a model is. High levels of abstraction represent the most simplified models.[1] Low levels of abstraction have close and near 1:1 correspondence with the things they are modeling. An exact 1:1 correspondence is no longer a model but rather a transformation of something in one form to another.

[1] PowerPoint slides and your favorite clip art represent the highest levels of abstraction a system can have.

The real value of a model is not in what it contains but rather what is hidden. Class diagrams in a UML model, for example, do not include the individual statements of each class operation. These details are hidden in the model and are available only in the source code.[2] Class diagrams further hide things by not exposing all a class's operations, attributes, and associations. The choice of elements to suppress in a diagram is determined by its goal. Each class diagram is created for a reason: to communicate or to explain something. Details that don't help in communicating or explaining don't belong in the diagram. So most diagrams contain classes that have only the relevant details exposed.

[2] I consider source code itself a model, with the choice of variable names and comments the prime source of added value.

Many models are involved in the development process. Each model has its viewpoint. In fact, part of a model's definition[3] is that it is a semantically complete view of a system. Each model is at a different level of abstraction. Because they model the same system, the mappings between the models of the same system are of immense importance. The mappings establish chains of traceability and dependency that help us connect the various and sometimes confusing artifacts of the development process. A user profile screen definition can be traced to the JSP code that implements it, and the state change behavior of a purchase order can be traced to a use case specification that defined it梐ll done through the various UML models of the system.

[3] See James Rumbaugh, Ivar Jacobson, and Grady Booch, The Unified Modeling Language Reference Manual (Boston, MA: Addison-Wesley, 1998).

In addition to understanding, modeling has other benefits. It is a communication mechanism, allowing one group to communicate to another in a common language. Modeling encourages us to break the problem into manageable pieces. Because of its object-oriented roots, UML modeling in particular encourages us to think of things in terms of objects and to encapsulate properties and behaviors in objectlike concepts. Modeling with computer-aided software engineering (CASE) tools can help us generate source code and components directly from the models.

Before we go on, I need to make one point very clear. The role of modeling is not to produce code through automation or to produce documentation through reverse engineering. These are simply handy by-products of modeling software systems with CASE tools. All too often, we become obsessed with a particular tool's ability to round-trip engineer code and models, and we often miss the whole point of modeling. Automated round-trip engineering will make it easier to connect the abstractions in the model to source code artifacts, but it will not be able to construct a diagram that communicates a point. It won't be able to selectively hide or expose key properties that make understanding easier. Most reverse-engineering tools can reverse engineer only a source code structure. The few tools that attempt to reverse engineer behavioral diagrams usually end up with diagrams so large and complex that they aren't even worth printing.

The real value in models and modeling is the ability to look at a simplification of a system through a particular viewpoint where the system becomes easier to understand. If the models are as complex as what is being modeled, there is little point in modeling.

Role of Process

The process provides a framework and a context to understand things in. Models make it easier to understand complex things, but because multiple models are made for any given system, exactly how and when they are created is just as important as the models themselves.

This book describes in some detail the process of creating Web applications, but it is not meant to be a complete process handbook. The process of developing software is such a large topic that the vast majority of the material in it would have very little Web application杝pecific material. Instead of creating a complete process manual for Web application development, I decided to create a book that introduces the basics of the process, just enough to set the context for the Web application杝pecific discussions.[4] In this way, you can identify and understand the important aspects of Web application development without its being tied too closely to a specific software development process. This separation of Web application development material from the process makes it easier for those with specialized and customized development processes to use the material in this book.

[4] For a book that details the process specifically for J2EE enterprise applications, see Peter Eeles, Kelli Houston, and Wojek Kozaczynski, Building J2EE Applications with the Rational Unified Process (Boston, MA: Addison-Wesley, 2002).


Influences of Architecture

Architecture influences just about everything in the process of developing software. Architecture gives us the rules and regulations by which we must construct the software and, to some degree, how we even think about the problem. In the early days of computing, we thought of our problems in terms of batch processing. The business problem had to be thought of in terms of assembling a lot of information, formatting it appropriately, and then submitting it to the system for processing. Today, we have interactive systems that can prompt us, walk us through the collection of data, and process that data at much greater speeds than ever before.

The Web has given us a new variation on the standard client/server system. With the proliferation of networks and HTML browsers as standard software,[5] it is now possible to deliver and to deploy a system to users almost anywhere. There are limitations, however, to Web architectures. Their fundamental paradigm of interaction is stimulus/response. The server doesn't control the client directly, and as a general rule, all interaction with the system must be initiated by the client. When this is not the desired behavior, additional elements must be added to the architecture, and the result is a more complex, sometimes brittle system.

[5] Even my phone is capable of browsing Web pages over the Internet.

Web architectures are evolving. In the first edition of this book, most of my experience was with applications based on Microsoft's Active Server Pages (ASP) and the first version of JavaServer Pages. Because these technologies were relatively new, the systems they were used in had relatively simple architectures. The mappings between components and Web pages were simple, and the types of functionality found in the pages' scripts were straightforward. There were drawbacks to these simple architectures. They had a tendency to evolve into difficult-to-maintain monsters.

Today, more and more teams are adopting Web-centric architectures. Collectively, the industry is gaining more and more experience with Web systems. More and more technologies are being applied to Web architectures. The use of patterns and common mechanisms is gaining momentum.[6] All these factors are resulting in Web systems with relatively complex architectures as the norm.

[6] In my opinion, patterns and reusable assets are where the future of software development in general is heading.

In the first edition of this book, the Web Application Extension for UML (WAE) profile was introduced and was suitable for the majority of Web architectures in use at the time. When the first version of the Java Pet Store came out, I used it as a tool for understanding J2EE systems. At first, I had a lot of difficulty making the connections between the documentation supplied by the Blueprints book[7] and the source code. At the time, unfortunately it did not come with UML models,[8] which would have bridged the gap between the high-level text and the source. So I set about creating a UML model of the application. Along the way, I discovered a number of new architectural elements that made it difficult to model with the current version of the WAE. What was well suited to modeling the relatively simple applications of many Active Server Page朾ased Web applications was unsuited for the relatively complex architectural elements I found in the Java Pet Store.

[7] Mark Johnson, Inderjeet Singh, and Beth Stearns, Designing Enterprise Applications with the J2EE™Platform, Second Edition (Boston, MA: Addison-Wesley, 2002).

[8] The current release of the Pet Store example does come with a very simple UML model; however, the version I have is little more than a summary of the key Java classes in the application and not a rich model as prescribed by this book.

It wasn't as though the Java Pet Store introduced anything new that couldn't be done with any other Web development platform.[9] It's just that this application used so much of the J2EE API (application programming interface) set and created a well thought-out and robust architecture that it exposed many limitations of the first version of the WAE. The results of that effort have in part contributed to the WAE's evolution into this second version (WAE2-UML).

[9] I'm sure that the marketing folk at Sun Microsystems would argue this point, however.

As a companion resource to this book, I have created a WAE-UML portal on the Internet at www.wae-uml.org. It's my intention to maintain this portal as a resource to those interested in the details of Web modeling and who are looking for additional examples or discussions related to the topic. For the time being, this Web site is hosted by a spare computer I keep in my closet. If for any reason the traffic and activity increase significantly, I'll find a suitable host.

This book, the Web site, reference applications, and models are all intended to help development teams understand the issues involved in building Web-centric applications. The information in this book is presented at varying levels of detail. It is not expected that every reader will use or be interested in every chapter; rather, the entirety of this text is intended for the team as a whole. This book is meant to be a companion to other fine application development books, that address specific aspects of the development process or technology. The reference applications and models are the most detailed source of information applied to a specific example and a great resource for those of us who learn best by example. The Web site is an attempt to keep this information as current as possible, to actively engage practitioners, and to elicit real-world experiences so that the entire community of Web application developers, especially modelers, will be successful in developing applications that work well.

内容概要:本文档系统整合了基于MATLAB/Simulink的风力涡轮机雷达信号仿真、电力系统优化、新能源调控及多领域智能算法应用资源,涵盖风电功率平抑、混合储能协同调频、综合能源系统调度、无人机三维路径规划、电动汽车参与调度、电氢氨耦合系统优化等前沿科研方向。资源包提供大量可复现的Matlab代码、Simulink仿真模型、数据集及配套论文,涉及GWO、PSO、WOA、HHO等多种智能优化算法,以及LSTM、CNN、GRU等深度学习模型在负荷预测、故障诊断、信号处理中的应用,尤其聚焦于风电与雷达信号交互、储能功率分配、虚拟电厂运行、微电网多时间尺度优化等关键技术的仿真实现。; 适合人群:具备一定MATLAB编程基础,从事电力系统、新能源、智能优化、信号处理、雷达仿真、综合能源管理等相关领域的科研人员及研究生;工作1-3年相关方向的工程师。; 使用场景及目标:①开展风力发电系统与雷达信号交互仿真研究;②复现高水平期刊论文中的优化调度、故障诊断、功率预测模型;③进行无人机路径规划、储能系统设计、综合能源系统优化等课题研究与论文撰写;④借助成熟的代码框架快速搭建仿真模型,提升科研效率与工程实践能力。; 阅读建议:建议按主题分类浏览资源列表,优先选择标注“复现”“顶刊”“EI”等高价值项目,结合提供的网盘链接下载完整代码与数据,配合Simulink仿真模型与说明文档进行调试与二次开发,注重算法实现与实际工程问题的深度融合。
日常处理文本内容时,你是否也常常被这些琐碎又烦人的操作消耗大量时间:从网页复制来的文章满是空行和多余空格,要一段段手动清理;从不同渠道收集的文档繁简混杂,格式五花八门,想统一规范却只能逐篇调整;面对数千行的数据,想按行排序、去重、添加行号,却找不到一个趁手的小工具;更别提Base64编解码、URL转义这些开发中高频使用的操作,每次都得打开在线网站反复折腾——这些看似零散的文本处理需求,单独去搜工具费时费力,用Word又杀鸡用牛刀,始终缺少一款能把这些功能聚合在一起、打开即用的桌面工具。而 大飞哥软件自习室——文本批量整理工具 v2.0正是为整合这些高频文本处理需求而生的专业效率工具,它集文件管理、文本清洗、格式转换、查找替换、批量插入、排序打乱、编码解码、实时统计等近三十项实用功能于一身,采用多标签页设计支持同时编辑多个文档,所有操作均支持撤销与重做,让你在写代码、整理素材、编辑文案时再也不用东拼西凑找工具,一个软件搞定全部文本处理需求。 软件的核心功能模块围绕文本处理的完整工作流展开,覆盖了从“粗加工”到“精处理”的各个环节。文本清洗模块提供了行首尾去空格、清除所有空格、删除空行、合并多余空格、去除重复行、清除HTML标签等六项功能,一键将脏乱差的原始文本快速规整为干净可用的素材。文本转换模块则涵盖了繁简互转、标点中英文互转、全半角互转、全部大写/小写/首字母大写等选项,尤其适合需要批量处理多语言或不同格式规范的文本内容。查找替换模块不仅支持普通文本替换,更提供了正则表达式和区分大小写选项,查找、替换、全部替换、选区替换四种模式灵活应对不同场景。批量插入文本模块更是独树一帜——用户可预设两组插入内容,选择插入到当前段首/段尾或所有段首/段尾,四个单选按钮搭配两个输入框,实现八种插入组合,为批量处理结构化文本提供了极大的便利。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值