




下載本文檔
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
12-2ObjectivesProcess
of
program
developmentIntroduction
to
Java
ProgrammingRelationship
types:
association,
aggregation,strong
inheritance,
and
weak
inheritanceClasses
and
systems
designing12-3Software
Development
ProcessRequirementSpecificationSystemysisSystemDesignTestingImplementationMaintenanceDeploymentIntroduction
to
Java
Programming12-4Requirement
SpecificationRequirementSpecificationSystemysisSystemDesignTestingImplementationMaintenanceDeploymentA
formal
process
that
seeks
tounderstand
the
problem
andin
detail
what
thesoftware
system
needs
to
do.
Thisphase
involves
close
interactionbetween
users
and
designersIntroduction
to
Java
Programming12-5Example:EMall目標(biāo):要構(gòu)建的是一個(gè)會(huì)員制虛擬購(gòu)物中心需求分析:–用戶需要,登錄后方可進(jìn)入本“購(gòu)物中心”。
時(shí)需提供用戶名、、個(gè)人基本信息及賬戶號(hào)碼。用戶注冊(cè)時(shí)可以選擇是否作為店主經(jīng)營(yíng)一家,如不選擇作為店主,即成為普通購(gòu)物者用戶;如選擇作為店主,除須填寫以上信息外,還需填上申請(qǐng)的名、信息,完成后產(chǎn)生一個(gè)新的
。用戶完成后,即可通過登陸進(jìn)入購(gòu)物中心。–用戶在登錄時(shí)使用用戶名和
。購(gòu)物者登錄后即進(jìn)入大廳,大廳類應(yīng)顯示正在經(jīng)營(yíng)的和關(guān)閉狀態(tài)的,購(gòu)物者只能進(jìn)入正在經(jīng)營(yíng)的
。店主登錄時(shí)可選擇是否以店主方式登錄,若以店主方式登錄,則進(jìn)行該店商品的管理工作,而不能進(jìn)行任何購(gòu)物活動(dòng);否則,作為普通購(gòu)物者進(jìn)入大廳。Introduction
to
Java
Programming12-6Example:EMall需求分析(續(xù)):–購(gòu)物者在大廳中選擇進(jìn)入選購(gòu)商品。用戶進(jìn)入后,選定希望的商品,把一定數(shù)量的商品以相應(yīng)的價(jià)格加入購(gòu)物車中,中相應(yīng)商品的數(shù)量(暫時(shí))予以扣除。購(gòu)物者在退出購(gòu)物中心之前,可確認(rèn)并支付購(gòu)買商品。當(dāng)購(gòu)物者確認(rèn)商品后,需通知服務(wù)器,服務(wù)器將對(duì)購(gòu)物者和店主的賬戶余額進(jìn)行調(diào)整,然后將本次的信息記入作為購(gòu)物歷史信息。
之前放棄購(gòu)物車中的任何商品,放棄者可在確認(rèn)將使得店鋪中的相應(yīng)商品數(shù)量恢復(fù)。–
者退出大廳之前,檢查購(gòu)物車,如其中沒有未商品,即退出系統(tǒng)。店主退出系統(tǒng)時(shí),其經(jīng)營(yíng)
即關(guān)閉。Introduction
to
Java
Programming12-7SystemysisRequirementSpecificationSystemysisSystemDesignTestingImplementationMaintenanceDeploymentSeeks
to yze
the
businessprocess
in
terms
of
data
flow,
andto
identify
the
system’s
input
andoutputPart
of
the ysis
entails
modelingthe
system’s
behavior.
The
model
isintended
to
capture
theessentialelements
of
the
system
and
to
defineservices
to
the
systemIntroduction
to
Java
Programming12-8Example:EMall系統(tǒng)分析:–用戶…–【用戶】分析和登錄用戶需要,登錄后方可進(jìn)入本“購(gòu)物中心”。時(shí)需提供:用戶名(用戶名唯一)、
、個(gè)人基本信息以及(虛擬)賬戶號(hào)碼,并可以選擇
為一般購(gòu)物者還是店主,店主除須填寫以上信息外,還需填上申請(qǐng)的
名(唯一),
信息。登錄時(shí)使用用戶名和
登錄。Introduction
to
Java
Programming12-9Example:EMall系統(tǒng)分析:–【用戶】分析(續(xù))用戶分類{店主}:店主在時(shí)需要向服務(wù)器創(chuàng)建
,登錄時(shí)需選擇以一般購(gòu)物者方式還是店主方式登入。若以店主方式登錄,則進(jìn)行該店商品的管理工作,如開門營(yíng)業(yè),打烊,修改自己的商品標(biāo)價(jià),數(shù)量以及增添商品等等,而不能進(jìn)行任何購(gòu)物活動(dòng)。另外店主在退出之前還應(yīng)保留本的信息至本地文件,在下次登錄時(shí)無須和服務(wù)器交互,直接從本地載入。{購(gòu)物者}:購(gòu)物者登錄后即進(jìn)入大廳,并且只能進(jìn)入正在經(jīng)營(yíng)的
。
者選定商品后,加入購(gòu)物車。購(gòu)物者可以操作購(gòu)物車,即放棄或確認(rèn)某次交易。Introduction
to
Java
Programming12-10Example:EMall系統(tǒng)分析:–【用戶】分析(續(xù))商品
流程用戶進(jìn)入
后,選定希望的商品,將一定數(shù)量的商品以相應(yīng)的價(jià)格加入購(gòu)物車中,品的數(shù)量(暫時(shí))予以扣除。(店主與中相應(yīng)商者的交互最好做成客戶端之間直接的通信,以減輕服務(wù)器的負(fù)擔(dān))購(gòu)物者在退出購(gòu)物中心之前,確認(rèn)并支付商品。如果購(gòu)物者在支付之前掉線,購(gòu)物車中的商品即之前放棄購(gòu)中的相應(yīng)商算全部放棄,者亦可在確認(rèn)物車中的任意商品,放棄將使得品數(shù)量恢復(fù)。Introduction
to
Java
Programming12-11System
DesignRequirementSpecificationSystemysisSystemDesignTestingImplementationMaintenanceDeploymentThe
process
of
designing
thesystem’s
components.This
phase
involves
the
use
of
manylevels
of ion
to
posethe
problem
into
manageablecomponents,
identify
classes
andinterfaces,
and
establishrelationships
among
the
classes
andinterfaces.Introduction
to
Java
Programming12-12Example:EMall系統(tǒng)設(shè)計(jì):–【用戶】{用戶基類User}User類作為用戶基類,是客戶端,應(yīng)為類。其中應(yīng)提供用戶
(register)、登錄(login)、注銷(logout)以及查看賬戶余額,賬戶充值,賬戶扣除金額等方法,其子類Customer和Owner類應(yīng)重載這些方法。{購(gòu)物者類Customer}Customer類繼承User類。除重載User類方法外,需提供將商品加入購(gòu)物車(addMerchandise)和從購(gòu)物車中取出(removeMerchandise)方法,以及支付方法(buy)等。Introduction
to
Java
Programming12-13Example:EMall系統(tǒng)設(shè)計(jì):–【用戶】(續(xù)){店主類Owner}Owner類繼承User類。除重載User類方法外,需提供一組用來管理對(duì)應(yīng)
的方法,如修改商品信息(包括數(shù)量,價(jià)格)(modify)方法,添加新的商品(addMerchandise)方法,刪除商品(deleteMerchandise)方法等。用戶在確認(rèn)
后,店主應(yīng)調(diào)整相應(yīng)的商品數(shù)量及賬戶金額。Introduction
to
Java
Programming12-14ImplementationRequirementSpecificationSystemysisSystemDesignImplementationMaintenanceDeploymentThis
phase
requires
the
use
ofaprogramming
language
like
Java.The
implementation
involvescoding,
testing,
and
debuggingTestingThe
process
of
translating
thesystem
design
into
programs.Separate
programsare
written
foreach
component
andput
to
worktogether.Introduction
to
Java
Programming12-15TestingRequirementSpecificationSystemysisSystemDesignTestingImplementationMaintenanceDeploymentEnsures
that
the
code
meets
therequirements
specification
andweeds
out
bugs.An
independent
team
of
softwareengineers
not
involved
in
the
designand
implementation
of
the
projectusually
conducts
suchtestingIntroduction
to
Java
Programming12-16DeploymentRequirementSpecificationSystemysisSystemDesignTestingImplementationMaintenanceDeploymentDeployment
makes
the
projectavailable
foruse.For
a
Java
applet,
this
meansinstalling
it
on
a
Web
server;
foraJava
application,
installing
it
on
theclient's
computer.Introduction
to
Java
Programming12-17MaintenanceRequirementSpecificationSystemysisSystemDesignTestingImplementationMaintenanceDeploymentMaintenance
is
concerned
withchanging
and
improving
theproduct.A
software
product
must
continue
toperform
and
improve
in
a
changingenvironment.
This
requires
periodicupgrades
of
the
product
to
fixnewlydiscovered
bugs
and
incorporatechanges.Introduction
to
Java
Programming12-18Relationships
among
ClassesIntroduction
to
Java
ProgrammingAssociationAggregationCompositionDependenceInheritance12-19AssociationAssociation
represents
a
general
binary
relationship
thatdescribes
an
activity
between
two
classes.Student5..60
TakeCourse0..3
Teach
1FacultyTeacherpublic
class
Student
{/**
Data
fields
*/private
Course[]courseList;/**
Constructors
*//**
Methods
*/}Introduction
to
Java
Programmingpublic
class
Course
{/**
Data
fields
*/private
Student[]classList;private
Faculty
faculty/**
Constructors
*//**
Methods
*/}public
class
Faculty
{/**
Data
fields
*/private
Course[]courseList;/**
Constructors
*//**
Methods
*/}An
association
is
usually
represented
as
a
data
field
or
method
in
the
class.12-20Aggregation
and
CompositionAggregation
is
a
special
form
of
association,
whichrepresents
an
ownership
relationship
between
twoclassesAggregation
models
the
has-a
relationshipIf
an
object
is
exclusively
owned
by
an
aggregatedobject,
the
relationship
between
the
object
and
itsaggregated
object
is
referred
to
as
composition.NameAddressCompositionIntroduction
to
Java
ProgrammingAggregation12-21Representing
Aggregation
in
ClassesAn
aggregation
relationship
is
usually
represented
as
adata
field
in
the
aggregated
class.public
class
Name
{/**
Data
fields
*//**
Constructors
*//**
Methods
*/}public
class
{/**
Data
fields
*/private
Name
name;private
Address
address;/**
Constructors
*//**
Methods
*/}public
class
Address
{/**
Data
fields
*//**
Constructors
*//**
Methods
*/}Introduction
to
Java
Programming12-22Inner
Classes
Translationclass
only,.
ForIf
Name
or
Address
is
used
in
thethey
can
be
declared
as
an
inner
class
inexample:publicclass
{private
Name
name;private
Address
address;...class
Name
{...}class
Address
{...}Introduction
to
Java
Programming}12-23InheritanceInheritance
models
the
is-a
relationship
betweentwo
classes.Introductionto
Java
ProgrammingFacultypublic
class
Student
extends/**
Data
fields
*//**
Constructors
*//**
Methods
*/}(B){(A)12-24Weak
Inheritance
RelationshipA
weak
is-a
relationship
can
be
represented
using
interfacesFor
example,
the
weak
is-a
relationship
“students
arecomparable
based
on
their
grades”
can
be
represented
byimplementing
the
Comparable
interface,
as
follows:public
class
Student
extendsStudentComparableimplements
Comparable
{/**
Data
fields,
Constructors,
and
*//**
Methods
*//**
Implement
the
compareTo
method
*/public
int
compareTo(Object
object)
{//
...}}(A)(B)Introduction
to
Java
Programming12-25Class
DesignIntroductionto
Java
ProgrammingMethodClassionionSteps
of
building
an
object-oriented
system:Identify
classes
for
the
systemDescribe
attributes
and
methods
in
each
classEstablish
relationships
among
classesCreate
classes12-26Class
Design
GuidelinesIntroduction
to
Java
ProgrammingDesigning
a
Single
ClassUsing
Modifiers
public,
protected,
private
and
packageUsing
Inheritance
or
CompositionUsing
Interfaces
or
Classes12-27Designing
aClassIntroduction
to
Java
ProgrammingA
class
should
describe
a
single
entity
or
a
set
ofsimilar
operations.
A
single
entity
with
too
manyresponsibilities
can
be
broken
into
several
classes
toseparate
responsibilitiesClasses
are
usually
designed
for
use
by
manydifferent
customersClasses
are
designed
for
reuseProvide
a
public
no-arg
constructor
and
overridethe
equals
method
and
the
toString
method
definedin
the
Object
class
whenever
possibleFollow
standard
Java
programming
style
andnaming
conventions12-28Using
Visibility
ModifiersEach
class
can
present
two
contracts
–
one
for
theusers
of
the
class
and
one
for
the
extenders
of
theclassMake
the
fields
private
and
accessor
methods
publicif
they
are
intended
for
the
users
of
the
classMake
the
fields
or
method
protected
if
they
areintended
for
extenders
of
the
classThe
extended
class
may
increase
the
visibility
of
aninstance
method
from
protected
to
public,
or
changeits
implementationA
classshould
also
hide
methods
not
intended
forclient
useIntroduction
to
Java
Programming12-29Using
the
static
ModifierIntroduction
to
Java
ProgrammingA
property
that
is
shared
by
all
the
instances
of
theclass
should
be
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025年國(guó)際雙語教學(xué)平臺(tái)中英外教引進(jìn)及本土化師資培養(yǎng)協(xié)議
- 2025年綜合型家政服務(wù)外包合作協(xié)議樣本
- 2025年綠色農(nóng)業(yè)資源保護(hù)租賃協(xié)議書
- 2025年環(huán)保產(chǎn)業(yè)園區(qū)污水處理設(shè)施合作運(yùn)營(yíng)協(xié)議
- 2025年新型農(nóng)業(yè)科技小企業(yè)創(chuàng)業(yè)貸款協(xié)議書
- 二零二五年度離婚協(xié)議起草全程法律支持與風(fēng)險(xiǎn)預(yù)警合同
- 二零二五年度全國(guó)范圍內(nèi)二手車置換服務(wù)合同范本
- 2025年家具租賃合同續(xù)約條款及客戶權(quán)益保障協(xié)議
- 2025年別墅裝修全程質(zhì)量監(jiān)管與長(zhǎng)期保養(yǎng)服務(wù)契約
- 2025年來電網(wǎng)招聘考試題庫(kù)
- 屋面防水改造工程工程施工組織設(shè)計(jì)方案
- 2024-2030年光傳輸行業(yè)市場(chǎng)深度調(diào)研及發(fā)展趨勢(shì)與投資前景研究報(bào)告
- 《河道疏浚砂石綜合利用方案編制導(dǎo)則》
- 2024版公路架橋機(jī)租賃合同范本
- 【淺談中式面點(diǎn)的造型與制作規(guī)范4500字(論文)】
- 文化行業(yè)標(biāo)準(zhǔn) WH-T 96-2022 公共圖書館年度報(bào)告編制指南
- 外科主治醫(yī)師考試-外科學(xué)基礎(chǔ)知識(shí)講義03外科休克
- JT-T-794-2019道路運(yùn)輸車輛衛(wèi)星定位系統(tǒng)車載終端技術(shù)要求
- 進(jìn)出口企業(yè)進(jìn)出口業(yè)務(wù)內(nèi)部審計(jì)制度(AEO認(rèn)證文件)
- 武強(qiáng)縣津成纖維制品有限公司年產(chǎn)400萬平方米玻璃纖維窗紗項(xiàng)目環(huán)評(píng)報(bào)告
- (高清版)TDT 1058-2020 第三次全國(guó)國(guó)土調(diào)查縣級(jí)數(shù)據(jù)庫(kù)建設(shè)技術(shù)規(guī)范
評(píng)論
0/150
提交評(píng)論