472,121 Members | 1,504 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,121 software developers and data experts.

code reuse and design reuse

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

Feb 7 '06 #1
16 2135
sa*******@gmail.com wrote:
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.


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.

Feb 7 '06 #2
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.

Feb 8 '06 #3
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

Feb 8 '06 #4
sa*******@gmail.com wrote:

Any gosu can give me some suggestion with my headache.
In other word, how to grow from senior designer into excellent
designer?


Practice, practice and mode practice.

I'd also strongly recommend learning another computer language,
something quite different from C (Ruby, Python, Lisp). Other languages
do things in different ways that can improve your overall knowledge and
skills base.
--
Ian Collins.
Feb 8 '06 #5
Surely, programmer is just a person to solve customer's different
needs.
Many application or module may is just designed for some specific
customer's need.

but we should admit that some of module can be designed more reusable
and more extendable.

Feb 8 '06 #6
strongly agreed with your idea.
and lisp is interesting, I will have a try about lisp, but maybe it is
hard to get some natual case to practice with lisp.

Feb 8 '06 #7
sa*******@gmail.com wrote:
strongly agreed with your idea.
and lisp is interesting, I will have a try about lisp, but maybe it is
hard to get some natual case to practice with lisp.


*Please* quote what and who you're replying to. Have a look at:

http://cfaj.freeshell.org/google/

As for lisp, once you're familiar with it, I'm sure you'll see plenty of
`natural` problems for it. After all, it wasn't created for nothing.
Looking at some newsgroups dedicated to it is likely to help, too.

Here, please confine the questions to C.

--
BR, Vladimir

At the source of every error which is blamed on the computer you will
find at least two human errors, including the error of blaming it on
the computer.

Feb 8 '06 #8
"sa*******@gmail.com" wrote:

strongly agreed with your idea.
and lisp is interesting, I will have a try about lisp, but maybe it is
hard to get some natual case to practice with lisp.


What idea? Whose? You need to include context. Google is not
usenet. Most readers of this (or any other) newsgroup may never
have received, and may never receive, any previous articles. You
must make each article stand by itself. This requires context and
attributions. See below, and READ THE URLs, for means to acheive
this even with the foully broken Google interface.

--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
More details at: <http://cfaj.freeshell.org/google/>
Also see <http://www.safalra.com/special/googlegroupsreply/>
Feb 8 '06 #9
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
More details at: <http://cfaj.freeshell.org/google/>
Also see <http://www.safalra.com/special/googlegroupsreply/>

Thanks for your advise.

Feb 8 '06 #10
"sa*******@gmail.com" <sa*******@gmail.com> writes:
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
More details at: <http://cfaj.freeshell.org/google/>
Also see <http://www.safalra.com/special/googlegroupsreply/>

Thanks for your advise.


And please don't delete the attribution lines (the ones that say
"so-and-so writes:"). It's easier to follow the discussion if we know
who said what.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Feb 8 '06 #11
On 2006-02-08, Keith Thompson <ks***@mib.org> wrote:
"sa*******@gmail.com" <sa*******@gmail.com> writes:
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
More details at: <http://cfaj.freeshell.org/google/>
Also see <http://www.safalra.com/special/googlegroupsreply/>

Thanks for your advise.


And please don't delete the attribution lines (the ones that say
"so-and-so writes:"). It's easier to follow the discussion if we know
who said what.


I'm not sure that an attribution line applies properly to a signature -
since it's inserted automatically.
Feb 8 '06 #12
Jordan Abel <ra*******@gmail.com> writes:
On 2006-02-08, Keith Thompson <ks***@mib.org> wrote:
"sa*******@gmail.com" <sa*******@gmail.com> writes:
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
More details at: <http://cfaj.freeshell.org/google/>
Also see <http://www.safalra.com/special/googlegroupsreply/>
Thanks for your advise.


And please don't delete the attribution lines (the ones that say
"so-and-so writes:"). It's easier to follow the discussion if we know
who said what.


I'm not sure that an attribution line applies properly to a signature -
since it's inserted automatically.


I don't understand; there was no mention of signatures.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Feb 9 '06 #13
On 2006-02-08, Keith Thompson <ks***@mib.org> wrote:
Jordan Abel <ra*******@gmail.com> writes:
On 2006-02-08, Keith Thompson <ks***@mib.org> wrote:
"sa*******@gmail.com" <sa*******@gmail.com> writes:
> "If you want to post a followup via groups.google.com, don't use
> the broken "Reply" link at the bottom of the article. Click on
> "show options" at the top of the article, then click on the
> "Reply" at the bottom of the article headers." - Keith Thompson
> More details at: <http://cfaj.freeshell.org/google/>
> Also see <http://www.safalra.com/special/googlegroupsreply/>
Thanks for your advise.

And please don't delete the attribution lines (the ones that say
"so-and-so writes:"). It's easier to follow the discussion if we know
who said what.
I'm not sure that an attribution line applies properly to a signature -
since it's inserted automatically.


I don't understand; there was no mention of signatures.


The line snipped immediately before the quoted text:
--


see?
Feb 9 '06 #14
Jordan Abel <ra*******@gmail.com> writes:
On 2006-02-08, Keith Thompson <ks***@mib.org> wrote:
Jordan Abel <ra*******@gmail.com> writes:
On 2006-02-08, Keith Thompson <ks***@mib.org> wrote:
"sa*******@gmail.com" <sa*******@gmail.com> writes:
>> "If you want to post a followup via groups.google.com, don't use
>> the broken "Reply" link at the bottom of the article. Click on
>> "show options" at the top of the article, then click on the
>> "Reply" at the bottom of the article headers." - Keith Thompson
>> More details at: <http://cfaj.freeshell.org/google/>
>> Also see <http://www.safalra.com/special/googlegroupsreply/>
> Thanks for your advise.

And please don't delete the attribution lines (the ones that say
"so-and-so writes:"). It's easier to follow the discussion if we know
who said what.

I'm not sure that an attribution line applies properly to a signature -
since it's inserted automatically.


I don't understand; there was no mention of signatures.


The line snipped immediately before the quoted text:
--


see?


Yes, I see that sailor.gu was quoting CBFalconer's signature; I hadn't
noticed because sailor.gu didn't quote the "-- ".

But I don't see any reason to snip an attribution line even if you're
commenting on a signature. Do you?

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Feb 9 '06 #15
Keith Thompson wrote:
.... snip ...
Yes, I see that sailor.gu was quoting CBFalconer's signature; I
hadn't noticed because sailor.gu didn't quote the "-- ".


However it appears that sailor.gu has caught on, and may well
become an intelligent contributor, despite using google. This is
the important point. After that we can worry about attribution,
snipping, tabs, long lines, and top-posting. Sigh - an evangelists
work is never done.

--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
More details at: <http://cfaj.freeshell.org/google/>
Also see <http://www.safalra.com/special/googlegroupsreply/>
Feb 9 '06 #16
<sa*******@gmail.com> wrote

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?

Generally a module is reusable if it has few dependencies, and clean
interfaces.

For instance, it is very difficult to write a reusable line-drawing routine,
because the way the caller wants to represent a raster varies from place to
place. Normally the differences are pretty trivial - width and height passed
in separately or part of a structure, pixels 24-bit or 32 bit, but it is
enough to wreck reusability.

On the other hand, it is not too hard to write a reusable JPEG codec. This
suffers from the same problem, but the difference is that, if the caller is
saving a file, he doesn't mind too much reformatting his raster data to call
such an elaborate function.

Feb 12 '06 #17

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

242 posts views Thread by James Cameron | last post: by
3 posts views Thread by DPfan | last post: by
6 posts views Thread by Mario T. Lanza | last post: by
45 posts views Thread by Steven T. Hatton | last post: by
3 posts views Thread by Simon | last post: by
171 posts views Thread by tshad | last post: by
4 posts views Thread by Simon | last post: by
1 post views Thread by Christopher | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.