473,385 Members | 1,707 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 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 2287
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

242
by: James Cameron | last post by:
Hi I'm developing a program and the client is worried about future reuse of the code. Say 5, 10, 15 years down the road. This will be a major factor in selecting the development language. Any...
3
by: DPfan | last post by:
What's exactly the meaning of "code reuse" in C++? Why such kind of reuse have more advantages over the counterpart in other language like in C? How is "code reuse" realized in C++? By...
6
by: Mario T. Lanza | last post by:
Greetings, I don't know about you guys but on many occasions I've asked myself whether or not someone else has solved a particular programming issue -- whether or not they developed a clever...
45
by: Steven T. Hatton | last post by:
This is a purely *hypothetical* question. That means, it's /pretend/, CP. ;-) If you were forced at gunpoint to put all your code in classes, rather than in namespace scope (obviously classes...
3
by: Simon | last post by:
Hi all, I'm hoping that some of you clever chaps could offer me some advice on code reuse. You see, whenever I make applications, I typically only find very limited
171
by: tshad | last post by:
I am just trying to decide whether to split my code and uses code behind. I did it with one of my pages and found it was quite a bit of trouble. I know that most people (and books and articles)...
15
by: CR | last post by:
I've noticed that the trend these days is to declare variables in the middle of code instead of at the top. What is the advantage of this? It seems like it makes it hard to reuse variables. Here...
4
by: Simon | last post by:
Hi all, I'm hoping that some of you clever chaps could offer me some advice on code reuse. You see, whenever I make applications, I typically only find very limited
1
by: Christopher | last post by:
On May 6, 10:22 am, dizzy <di...@roedu.netwrote: Coding standards per project. i.e All code in this project will use exceptions for error handling. All text parameters will be in the form of...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.