代码重用和设计重用 [英] code reuse and design reuse

查看:130
本文介绍了代码重用和设计重用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


作为一名拥有五年C经验的嵌入式程序员,

我读过许多与设计,编码相关的好书,

测试,调试,算法,编译器,设计,操作系统,下午和其他。


我总是梦想实现精致和可重复使用的设计和

实现。


我对代码重用非常感兴趣。

我研究了c接口和实现,重构, ; gof'的

设计模式"

这些天,我经历了头脑设计模式再次。

但我仍然对代码重用和设计重用感到困惑。


我保证伟大的作品采用了许多经典的设计模式或设计

体验。

但我发现传统的设计模式面向那些OO

语言(如C ++,java等)

在C中应用那些着名的设计模式或经验丰富的原理似乎很难。


有没有人有我的经验,实践或建议

拼图?


换句话说,

我们如何挖掘并采用来自
的经典设计经验
专家?


我知道代码阅读和实践可能是正确的方法。

但似乎增长缓慢。


有没有更好的方法来提高设计能力?


任何评论都表示赞赏和感激。


水手

Hi all guys,

As an embeded programmer with five year C experience,
I did read many great books related with design, coding,
test,debug,algorithms, compiler, design, os, pm and others.

I always dream to achieve a refined and reusable design and
implementation.

I am very interested with code reuse.
I studied "c interfaces and implementations", "refactoring", "gof''s
design pattern"
These days, I go through "head first design pattern" again.
but I am still perplexed with code reuse and design reuse.

I assure great works adopted many classic design pattern or design
experience.
but I found traditional design pattern is face to those OO
language(such as C++, java and etc.)
It seems very difficult to apply those famous design pattern or
experienced princple in C.

Is there any one have the experinece, pratice or suggestion with my
puzzle?

In other word,
How can we dig out and adopt the classic design experience from
experts?

I know code reading and pratice may be a correct way.
but it seems grows slowly.

Is there a better way to improve the design ability?

Any comments is appreciated and thankful.

Sailor

推荐答案

sa ******* @ gmail.com 写道:
大家好,


< snip lots>

换句话说,
我们如何挖掘和采用专家的经典设计经验?

我知道代码阅读和实践可能是一种正确的方式。
但似乎增长缓慢。
Hi all guys,
<snip lots>
In other word,
How can we dig out and adopt the classic design experience from
experts?

I know code reading and pratice may be a correct way.
but it seems grows slowly.




我认为你就是在这里。阅读好的代码和好书,

写下你自己的很多。确实需要时间。

flash中没有出色的技能。如果你期待的话,你会非常失望的。


回到这里,关于C的具体问题也是一个非常好的想法,burking在你做得更好之前一段时间。


航行,水手! ;-)


PS

尽可能多地编写符合标准的C代码,如果可移植性和可重用性,将大大帮助您获得
真正的你的目标。



I think you''re spot on here. Read both good code and good books, and
write lots of your own. It does take time. No great skills come in a
flash. If you were expecting that, you''ll be hugely disappointed.

Coming back here with specific questions about C is also a very good
idea, lurking for a good while before you do it even better.

Sail away, Sailor! ;-)

PS
Writing as much Standard compliant C code as possible will help you
greatly if portability and reusability are truly your aims.


感谢你的直截了当的评论。


但也许你错过了解我的意思。

我绝不期望在没有辛勤工作的情况下获得很棒的杀戮。


关于C的所有具体问题对我来说可能不是一个很好的谜题,

我可以通过我的练习或获得其他gosu的帮助来获得解决方案。


但是我对在C代码中应用设计模式感到困惑。

也许我的帖子应该不在comp.lang.c中,但我认为有很多有经验的用户可以使用



他们中的一些可能对我有好的建议混淆。


我也不满意我的设计作品。甚至我在embeded os中实现了很多

模块,比如web服务器,dhcp服务器,内存池和

很多驱动程序。


任何gosu都能给我一些关于我头痛的建议。

换句话说,如何从高级设计师成长为优秀的

设计师?

也许这是一个太棒的话题,但任何建议也非常感谢



Thanks for your straightforward comments.

But maybe you miss-understand my meanings.
I never expect obtain great kill without a hard work.

All specific questions about C may not be a great puzzle for me,
I can get solution by my practice or by getting help from other gosu.

But I just feel confused to apply design pattern in C code.
Maybe my post should be not be in comp.lang.c, but I think there are
many experienced c user.
Some of them may have good suggestion for my confuse.

Also I am unsatisfied with my designed works. even I implemented many
modules in embeded os, such as web server, dhcp server, memory pool and
many drivers.

Any gosu can give me some suggestion with my headache.
In other word, how to grow from senior designer into excellent
designer?
Maybe it is a too great topic, but any suggestions is also appreciated
very much.


至于我的经验对于嵌入式系统而言,代码重用或设计重用没有直接的方式,因为每个嵌入式系统都有自己独特的要求,而不是

通过重用代码而不会沉溺于额外的开销来满足。普通系统和嵌入式系统之间的主要区别在于,大多数嵌入式系统都是资源紧缺的系统,所以很多时候我们甚至不愿意不写C代码但必须坚持装配。因此重用

至少对于这样的系统是不可能的

As far as my experience in Embedded Systems is concerned, there is no
direct way for code reuse or design reuse, simply because every
embedded system has its own unique requirements which cannot be
satisfied by reuse of code without indulging into extra overheads. The
major difference between normal and embedded systems is that most
embedded systems are resource scarce systems so much so that many time
we even don''t write C code but have to stick to assembly. Hence reuse
is out of question at least for such systems


这篇关于代码重用和设计重用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆