`
isiqi
  • 浏览: 16030304 次
  • 性别: Icon_minigender_1
  • 来自: 济南
社区版块
存档分类
最新评论

OOP 概念的编程基础思想----我的感想

阅读更多

OOP 概念的编程基础思想----我的感想
(The essential of OOP concept Thought)

Actually the philosofy of object oriented programming is very simple. What is an object actually? Do you know? Don't think it to complicated,keep it simple. I think you do know, yet you don't realize it when you are perfroming OO programming job. Or Who know you know.

Like in the nature, object is actual what we call "THING". A car is a thing, a bird is a thing, you are a thing too!!!! Don't forget. Object, the thing, is madeup by its parts/components, just like you have a head,a body, two hands and two legs and your tiny thing to make baby. Ha Ha Ha Ha. To be a thing, one has character/propery, has a mean to perform actions,right? Since you have your character and you can move to do some things right. So I think now you get to realize something I want to tell you.

So just like in the nature,object oriented programming(OOP)is all this about like in the nature. An object instant has its propery and its methods to perform jobs to be done.An object belong to some kind, this is so call CLASS. The class is like a kind of group of things with similar propery and methods.

Like in the nature, object,thing can multiplicate themselves. Like you can make babies with the woman you "love" right. Your baby has something in common with you,yet not quite the same, he/she has its own character/propery and he/she growup to be someone with its own behaviour right. So this come to the essential, the foundation of object oriented programming:

1. Inheritant
2. Incaptulation
3. Polymorphism

This is the beauty of Object Oriented Software Engineering,the simulation of the nature, the world we are living. The simplcity of it, and actually we all know about. But unfortunately many C++ and other OO programmers seem to forget some what it is actually very natural and simple!!!! They think in the terms of technique, the syntax, the construction of loop statement,the selection,the branching of code,the constructor, the destroyer, memories allocation,and all kind of tricks in order to get his/her program done.

This is stupib,wrong attitude to become an object oriented programmers. They simply forget the essential,the thought,the foundation of Object Oriented Engineering!!!! So my advice is, keep it simple yet perform it accordingly with correctness. Think and imagine like in the nature.

Just like thing happen and behave in the nature. Nothing secret,nothing complicated. Think like the way it happen in the nature. If a C++ or OO programmer doing his/her programming the way I tell you as above. It will become much and much easier to create even very advanced sophisticated software based on C++ or other OO programming language. This is the way,I think the proper way to perform ones OO programming job. The simplicity,the nature is the beauty!!!!

Bernardus160 于荷兰 2001-11-12

--------------------------------------------------------------------------------
Bernardus160 回复于:2001-11-15 07:46:45

OOP 概念的编程基础思想----我的感想
(The essential of OOP concept Thought)

事实上,面向对象(物体)编程的哲学是非常简单的。究竟什么是对象(物体)呢?你知道吗?不用(要)把它想的太过复杂,其实它很简单。我想你应该知道的,只是你在从事面向对象(物体)编程的工作还未意识到它,否则,天晓得你知道什么!

同自然界一样,对象(物体)就是那些被我们称为“东西”的东西。汽车是个东西,小鸟是个东西,你也一样是个东西!!!!这一点你可不能忘记哦(雨飞谓: 除非你自己承认自己不是东西。^v^嘿嘿~~)。对象(物体)这个东西,是由它的各个部分(被称为组件)组合而成,就好像你是有头,身体,双手,双腿,和你的那个生小孩的“小东西”(雨飞谓:俗称“”)一样。哈哈哈哈。作为一个对象(物体),当然要有自己的特性(被称为属性),还意味着会有动作的功能,不是吗?就像你有你的独特性格和你会以你的性格去做一些事情一样。我想现在你应该意识到我想对你说些什么了吧。

类比与自然界,面向对象(物体)编程同自然界几是完全相似的。一个对象(物体)实例有它自己的属性和完成他自己工作的方法。一个对象(物体)属于某种类型,它被称为CLASS(类)。类就像是具有相似属性和方法的一组事物(物体)。

形同自然界,对象(物体)具有繁殖与多种表现形式。就像你和你“爱”过的女人生的小贝贝一样,你的小贝贝会有一些和你相同的地方,但是也不完全一样,它还有他自己的个性特征(属性)和他自己的特有行为。所以所有这些才是面向对象(物体)编程的本质和基础:

1、继承(遗传性)
2、封装(涵存)
3、多态(一体多样化)

这就是与我们所生活的自然界非常相似的出色(美丽)的面向对象(物体)软件工程。事实上这个相似点地球人都知道的。但是不幸的是许多从事C++编程和其它面向对象(物体)语言编程的程序员们好像都忘记了这个实际上非常简单而自然的东西!!!!他们所想的是有限的技术,语法,循环、选择、分支结构的代码,构造,析构,内存分配,和各种各样为了他们完成代码的技巧。

作为面向对象(物体)的程序员们这种做法是相当愚蠢和错误的。他们完全忘记了面向对象(物体)软件工程的本质、思想和基础!!!!所以我想忠告大家,保持简单作法思想性的原则且在进行编程时相应地正确行事,以使自己能够从错误中纠正过来。一切以自然为样去思考,想象和行事。

就像自然界中的事物发生与演变一样,没有神秘的事物,也没有复杂的事物。对事物的思考就像它在自然界中发生那样想像演变就可以了。如果一个从事C++或者其他面向对象(物体)语言程序设计的程序员能够像我以上所说的那样去编制他们的程序,那么将会更加容易的去构建基于C++或者其他面向对象(物体)程序设计语言的高水平先进的软件,而且会做得更快更好。这只是一条路,一条我认为对从事面向对象程序设计工作比较合适的路。简单而自然是最好,最美丽的!!!!

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics