observe the real world

本文介绍了一种通过观察现实世界中的物体来培养面向对象思维的方法。文章提出了两个关键问题:物体可能的状态及其行为,并通过具体例子进行说明。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Take a minute right now to observe the real-world objects that are in your immediate area. For each object that you see, ask yourself two questions: "What possible states can this object be in?" and "What possible behavior can this object perform?". Make sure to write down your observations.  

sun公司的java指南中在讲到“面向对象”时,用来培养面向对象概念的方法。大家可以观察现在身边的物体(对象),在观察每个物体时问自己两个问题:

1.这个物体可能处于什么样的状态?

2.这个物体大概能表现那些行为?

指南中给出了两个例子:

As you do, you'll notice that real-world objects vary in complexity; your desktop lamp may have only two possible states (on and off) and two possible behaviors (turn on, turn off), but your desktop radio might have additional states (on, off, current volume, current station) and behavior (turn on, turn off, increase volume, decrease volume, seek, scan, and tune)

You may also notice that some objects, in turn, will also contain other objects

你或许也会注意到,有些物体,in turn ,也将包含其他物体

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值