code reuse and design reuse

Discussion in 'C Programming' started by sailor.gu@gmail.com, Feb 7, 2006.

  1. Guest

    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, 2006
    #1
    1. Advertising

  2. 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.
    Vladimir S. Oka, Feb 7, 2006
    #2
    1. Advertising

  3. Guest

    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, 2006
    #3
  4. Hemant Mohan Guest

    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
    Hemant Mohan, Feb 8, 2006
    #4
  5. Ian Collins Guest

    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.
    Ian Collins, Feb 8, 2006
    #5
  6. Guest

    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, 2006
    #6
  7. Guest

    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, 2006
    #7
  8. 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.
    Vladimir S. Oka, Feb 8, 2006
    #8
  9. CBFalconer Guest

    "" 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/>
    CBFalconer, Feb 8, 2006
    #9
  10. Guest


    > "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, 2006
    #10
  11. "" <> 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) <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.
    Keith Thompson, Feb 8, 2006
    #11
  12. Jordan Abel Guest

    On 2006-02-08, Keith Thompson <> wrote:
    > "" <> 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.
    Jordan Abel, Feb 8, 2006
    #12
  13. Jordan Abel <> writes:
    > On 2006-02-08, Keith Thompson <> wrote:
    >> "" <> 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) <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.
    Keith Thompson, Feb 8, 2006
    #13
  14. Jordan Abel Guest

    On 2006-02-08, Keith Thompson <> wrote:
    > Jordan Abel <> writes:
    >> On 2006-02-08, Keith Thompson <> wrote:
    >>> "" <> 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?
    Jordan Abel, Feb 9, 2006
    #14
  15. Jordan Abel <> writes:
    > On 2006-02-08, Keith Thompson <> wrote:
    >> Jordan Abel <> writes:
    >>> On 2006-02-08, Keith Thompson <> wrote:
    >>>> "" <> 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) <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.
    Keith Thompson, Feb 9, 2006
    #15
  16. CBFalconer Guest

    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/>
    CBFalconer, Feb 9, 2006
    #16
  17. Malcolm Guest

    <> 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.
    Malcolm, Feb 12, 2006
    #17
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. tshad
    Replies:
    5
    Views:
    510
    Steve C. Orr [MVP, MCSD]
    May 17, 2005
  2. Randall Parker
    Replies:
    2
    Views:
    476
    intrader
    Nov 1, 2005
  3. Hylander

    To reuse or not to reuse....

    Hylander, Feb 26, 2004, in forum: Java
    Replies:
    0
    Views:
    407
    Hylander
    Feb 26, 2004
  4. Chris Smith

    Reuse and software design

    Chris Smith, Jul 13, 2006, in forum: Java
    Replies:
    3
    Views:
    372
    Chris Uppal
    Jul 17, 2006
  5. jacob navia

    To reuse or not to reuse

    jacob navia, Nov 5, 2006, in forum: C Programming
    Replies:
    19
    Views:
    506
    Dave Thompson
    Dec 18, 2006
Loading...

Share This Page