Software Design

本文探讨了创建良好的面向对象设计的重要性,特别是在提高代码的可复用性方面。文章解释了为什么代码复用是使用面向对象编程语言的一个主要优势,并讨论了实现这一目标时可能遇到的实际挑战。

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

Understanding the mechanics of creating C++ or Java code is relatively easy, but creating a good
object-oriented design is much more complex. In this context, good means that the code
works correctly and is reasonably easy to understand, maintain, extend, and reuse.

Reusability is an important goal and is one of the primary advantages of using objectoriented
programming languages. Creating reusable code saves time and effort by avoiding
the duplication that occurs when software must be created that’s similar or identical to something
that was written previously.


Although creating reusable code should always be your goal, the reality is that it’s sometimes
impossible or impractical to make code reusable. Some classes are good candidates for
reuse while others aren’t, and creating reusable software usually requires more work in the
short term than creating “throwaway” code. However, as you become more experienced in
creating good object-oriented designs, you’ll learn to recognize good candidates for reuse and
become better at creating classes, interfaces, and packages that aren’t tied too closely to a single
application.

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值