面向对象的建模与面向对象的编程不同吗?

时间:2020-03-06 14:21:38  来源:igfitidea点击:

面向对象的建模和面向对象的编程之间有什么区别?今天早上,我在地铁上听到了一次谈话,看来这些事情是不同的。不是吗

解决方案

我要说的是,建模是在进行编程之前将编程排除在外的,而建模是物理设计。

http://zh.wikipedia.org/wiki/面向对象的建模

http://zh.wikipedia.org/wiki/面向对象的编程

面向对象的建模是指我们设计代码外观的过程。我们将使用诸如UML之类的建模语言来进行面向对象的建模。面向对象的编程是指使用对象的编程范例。这些对象已在设计阶段使用面向对象的建模技术进行了设计,并在构造(编程阶段)期间使用支持面向对象的编程的语言并基于模型来实现。

我刚刚发现了这一点:

Object-oriented modeling is a formal
  way of representing something in the
  real world. It draws from traditional
  set theory and classification theory.
  object-oriented modeling is not
  limited to computer-related elements.
  One may use object-oriented modeling
  to represent many different types of
  things, from organizational
  structures, to organic materials, to
  physical buildings.

面向对象的建模通常用于在没有任何实际代码的情况下定义类,方法和变量。有很多工具可以进行建模。 Netbeans就是这样一种软件包。 Netbeans可以建模代码,甚至可以在创建类图之后尝试入门。

我发现此摘录来自DTMF网站上有关面向对象建模的关键概念的信息。

Abstraction: DENotes the essential
  characteristics of an object that
  distinguish it from all other kinds of
  objects and thus provide crisply
  defined conceptual boundaries.

  Example: A Cheesburger - is good to
  eat and fun to cook.  
  
  Modularity: Decomposition of
  abstractions into discrete units.

  Example: The various "layers" of a
  cheesburger - the bun, the lettuce,
  the ketchup, the mayonnaise, the
  burger, the cheese, onions, pickels,
  etc.    
  
  Encapsulation: Process of
  compartmentalizing the elements of an
  abstraction that constitute its
  structure and behavior; encapsulation
  serves to separate the interface of an
  abstraction and its implementation.

  Example:   ? To cook the cheeseburger:
  - Is the stove available? Are the burners working? Are the ingredients
  available?   ? To eat the
  cheeseburger: - Is it made correctly?
  Is my plate clean or disgusting?
  
  Hierarchy: A ranking or ordering of
  abstractions.   Example: A
  cheeseburger is really a subclass of a
  hamburger with cheese added which is a
  sub class of sandwich which is a
  subclass of the Hierarchal superclass
  food.
  
  Key Elements:  Classes – A collection
  of definitions of state, behavior,
  and/or identity   ? Properties   ?
  Methods  
  
  Objects: Instances of a class  
  
  Associations: Relationships   ?
  Dependency   ? Identity   ?
  Aggregation   ? Composition   ? And
  others

建模正在创建问题的抽象,而编程就是这种抽象的实现。

建模可以通过多种方式完成:文本,公式,图表... UML是对面向对象的概念进行建模的一种标准。

根据工具,语言等的不同,编程也可以以不同的方式进行。有一些方法可以直接从建模工具(通常是从UML模型)生成程序。这更进一步,可以直接"执行" UML模型。

关于"面向对象程序设计"的其他常见困惑也从"它是拖动和点击"开始,到混合第三代概念(我称之为"处理对象")到实际模式,并以纯OOP结尾。

好吧,假设代码是一种交流的手段,那么面向对象编程语言中的面向对象编程就是建模的一种形式。

但是,人们可以使用表达力较低但对于其他目的可能更有用的建模语言,在更抽象的级别上进行建模。出于开发软件的目的,建模与程序之间的联系并不紧密,主要是针对某些特定类别的人的练习,他们认为这非常重要,并且应该像实际那样付费,但并非如此。