code reuse and design reuse

S

sailor.gu

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
 
V

Vladimir S. Oka

Hi all guys,

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.
 
S

sailor.gu

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.
 
H

Hemant Mohan

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
 
I

Ian Collins

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.
 
S

sailor.gu

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.
 
S

sailor.gu

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.
 
V

Vladimir S. Oka

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.
 
C

CBFalconer

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/>
 
J

Jordan Abel

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.
 
K

Keith Thompson

Jordan Abel said:
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.
 
K

Keith Thompson

Jordan Abel said:
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?
 
C

CBFalconer

Keith said:
.... 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/>
 
M

Malcolm

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top