Good development practices

Discussion in 'C Programming' started by Nickolai Leschov, Jan 17, 2008.

  1. Hello,

    I have done some programming, mostly on embedded systems but now I would
    feel like I have to learn good development practices (i.e programmer's
    good manners). Let's say I want to build an application using some
    established open source library or application. Do I just download the
    source and hack away? Or I'd better do it in some controlled manner, i.e
    set up some source control system so that I can always compute the diffs
    from the original code? Or maybe I should try to keep my changes
    separate from the original code base? How do I do it?

    Where do I learn about things like that? I'm sorry for asking this here,
    where we dicuss standard-compliant C/C++ programming, but I really don't
    know any other place now. I do program in C/C++.

    Regards,
    Nickolai Leschov
    Nickolai Leschov, Jan 17, 2008
    #1
    1. Advertising

  2. Nickolai Leschov wrote:
    > [..] I
    > would feel like I have to learn good development practices [..]
    >
    > Where do I learn about things like that? I'm sorry for asking this
    > here, where we dicuss standard-compliant C/C++ programming, but I
    > really don't know any other place now. I do program in C/C++.


    news:comp.sofware-eng.

    V
    --
    Please remove capital 'A's when replying by e-mail
    I do not respond to top-posted replies, please don't ask
    Victor Bazarov, Jan 17, 2008
    #2
    1. Advertising

  3. Nickolai Leschov

    Lew Pitcher Guest

    On Jan 17, 2:03 pm, Nickolai Leschov <> wrote:
    > Hello,


    Hi, Nickolai

    [snip]
    > Where do I learn about things like that? I'm sorry for asking this here,
    > where we dicuss standard-compliant C/C++ programming, but I really don't
    > know any other place now. I do program in C/C++.


    OK, first thing is to recognize that there is no such thing as
    "standard-compliant C/C++ programming", because there is no standard
    that defines something called "C/C++".

    However, there /are/ standards for the C language, and /different/
    standards for the C++ language. You are going to have to choose which
    language you want to learn about wrt "standard-compliant" programming.
    If you are planning to program in /both/ C and C++, you'll have to
    learn both standards, and a bunch of things about inter-language calls
    (which, IIRC, the C++ standard talks about, but the C standard does
    not).

    Having said all that, neither comp.lang.c nor comp.lang.c++ seem to me
    to be the best place to discuss the theory of "standard-compliant
    programming". Both of these newsgroups discuss the practice of
    "standard-compliant programming", and try to leave the theory to other
    groups.

    HTH
    --
    Lew
    Lew Pitcher, Jan 17, 2008
    #3
  4. "Lew Pitcher" <> wrote in message
    >
    > OK, first thing is to recognize that there is no such thing as
    > "standard-compliant C/C++ programming", because there is no standard
    > that defines something called "C/C++".
    >

    Standards-compilant C/C++ would be a language that anyone would call C, or C
    with a few twiddles, but actually conforms to the C++ standard.
    Many thousands of such programs are written.

    --
    Free games and programming goodies.
    http://www.personal.leeds.ac.uk/~bgy1mm
    Malcolm McLean, Jan 17, 2008
    #4
  5. Malcolm McLean wrote:
    >
    > "Lew Pitcher" <> wrote in message
    >>
    >> OK, first thing is to recognize that there is no such thing as
    >> "standard-compliant C/C++ programming", because there is no standard
    >> that defines something called "C/C++".
    >>

    > Standards-compilant C/C++ would be a language that anyone would call C,
    > or C with a few twiddles, but actually conforms to the C++ standard.
    > Many thousands of such programs are written.


    Or a language that anyone would call C++, or C++ with a few twiddles,
    but actually conforms to the C standard. Many thousands of such
    programs are written.

    Your parochialism is showing. The fact is that there is no C/C++
    language, and no standard to conform to. Not to bother with the obvious
    point that the expression 'C/C++' is a violation of the standards of
    either C or C++.
    Martin Ambuhl, Jan 17, 2008
    #5
  6. Nickolai Leschov

    CBFalconer Guest

    Malcolm McLean wrote:
    > "Lew Pitcher" <> wrote in message
    >
    >> OK, first thing is to recognize that there is no such thing as
    >> "standard-compliant C/C++ programming", because there is no
    >> standard that defines something called "C/C++".

    >
    > Standards-compilant C/C++ would be a language that anyone would
    > call C, or C with a few twiddles, but actually conforms to the
    > C++ standard. Many thousands of such programs are written.


    No. Run the following program to get the idea:

    #include <stdio.h>

    int main(void) {
    int C;

    C = rand(void);
    if (C) printf("C / C++ == %d\n", C / C++);
    else printf("C / C++ is undefined\n");
    return 0;
    }

    and I expect the vast majority of results to be the value 1.

    --
    [mail]: Chuck F (cbfalconer at maineline dot net)
    [page]: <http://cbfalconer.home.att.net>
    Try the download section.



    --
    Posted via a free Usenet account from http://www.teranews.com
    CBFalconer, Jan 18, 2008
    #6
  7. Nickolai Leschov a écrit :
    > Hello,
    >
    > I have done some programming, mostly on embedded systems but now I would
    > feel like I have to learn good development practices (i.e programmer's
    > good manners). Let's say I want to build an application using some
    > established open source library or application. Do I just download the
    > source and hack away? Or I'd better do it in some controlled manner, i.e
    > set up some source control system so that I can always compute the diffs
    > from the original code? Or maybe I should try to keep my changes
    > separate from the original code base? How do I do it?
    >
    > Where do I learn about things like that? I'm sorry for asking this here,
    > where we dicuss standard-compliant C/C++ programming, but I really don't
    > know any other place now. I do program in C/C++.


    You can learn some of it from de Herb Sutter and Andrei Alexandrescu:
    http://www.amazon.fr/Coding-Standards-Rules-Guidelines-Practices/dp/0321113586

    Michael
    Michael DOUBEZ, Jan 18, 2008
    #7
  8. Victor Bazarov wrote:

    > news:comp.sofware-eng.



    Thank you. I'm subscribing.
    Nickolai Leschov, Jan 18, 2008
    #8
  9. Lew Pitcher wrote:
    >
    > OK, first thing is to recognize that there is no such thing as
    > "standard-compliant C/C++ programming", because there is no standard
    > that defines something called "C/C++".
    >
    > However, there /are/ standards for the C language, and /different/
    > standards for the C++ language. You are going to have to choose which
    > language you want to learn about wrt "standard-compliant" programming.


    Yes, I know what is C and what is C++, they are different languages, I
    just wrote "C/C++" to save time, not because I think they are the same
    or something like that.
    Please don't be so pedantic. You know what I meant, don't you?

    My question is about good practices applicable to both C and C++,
    (that's why I post this to both newsgroups) with emphasis on "good
    practices", not "C/C++"

    > Having said all that, neither comp.lang.c nor comp.lang.c++ seem to me
    > to be the best place to discuss the theory of "standard-compliant
    > programming".


    This is the term I used to name the topic of discussions in this
    newsgroup is I see it. I mean programming in the language, not specific
    implementation.
    Nickolai Leschov, Jan 18, 2008
    #9
  10. On Jan 18, 11:01 am, Nickolai Leschov <> wrote:
    > Lew Pitcher wrote:
    >
    > > OK, first thing is to recognize that there is no such thing as
    > > "standard-compliant C/C++ programming", because there is no standard
    > > that defines something called "C/C++".

    >
    > > However, there /are/ standards for the C language, and /different/
    > > standards for the C++ language. You are going to have to choose which
    > > language you want to learn about wrt "standard-compliant" programming.

    >
    > Yes, I know what is C and what is C++, they are different languages, I
    > just wrote "C/C++" to save time, not because I think they are the same
    > or something like that.
    > Please don't be so pedantic. You know what I meant, don't you?


    Actually, no we did not know that.
    There are just too many people about who really think that there is a
    language called "C/C++" to assume that a poster knows about the
    distinction between C and C++ when he uses the term C/C++.

    And if you can't stand pedantery, comp.lang.c and comp.lang.c++ will
    not meet your tastes, because they are full of it.

    To answer your original questions:
    - Using source control is always a good idea. Agood source control
    system lets you easily find out when and why certain changes were
    made. This I use often in finding the cause of bugs that I try to
    solve.
    - When writing an application that uses third-party software (open
    source or not), you should regard the third-party software as 'read-
    only'.
    Even if you are allowed to, writing your application intermixed with
    library code is likely to break all sorts of things. In the very
    least, it breaks the principle of modularity.

    Bart v Ingen Schenau
    Bart van Ingen Schenau, Jan 18, 2008
    #10
  11. Nickolai Leschov wrote:
    > Lew Pitcher wrote:
    >> OK, first thing is to recognize that there is no such thing as
    >> "standard-compliant C/C++ programming", because there is no standard
    >> that defines something called "C/C++".
    >>
    >> However, there /are/ standards for the C language, and /different/
    >> standards for the C++ language. You are going to have to choose which
    >> language you want to learn about wrt "standard-compliant" programming.

    >
    > Yes, I know what is C and what is C++, they are different languages, I
    > just wrote "C/C++" to save time, not because I think they are the same
    > or something like that.


    From the clc++ FAQ:
    http://www.parashift.com/c -faq-lite/how-to-post.html#faq-5.4

    'Do not refer to "C/C++." Some people get testy about that, and will
    (unfortunately!) ignore everything else you say just to correct you with
    something like, "There is no such language." It borders on pathetic, but
    you'll probably be okay if you say "C or C++" instead of "C/C++." Sigh.'

    A shame you had to learn this the hard way.
    Philip Potter, Jan 18, 2008
    #11
  12. Nickolai Leschov

    Guest

    Bart van Ingen Schenau wrote:

    > On Jan 18, 11:01 am, Nickolai Leschov <> wrote:
    >> Lew Pitcher wrote:
    >>
    >> > OK, first thing is to recognize that there is no such thing as
    >> > "standard-compliant C/C++ programming", because there is no standard
    >> > that defines something called "C/C++".

    >>
    >> > However, there /are/ standards for the C language, and /different/
    >> > standards for the C++ language. You are going to have to choose which
    >> > language you want to learn about wrt "standard-compliant" programming.

    >>
    >> Yes, I know what is C and what is C++, they are different languages, I
    >> just wrote "C/C++" to save time, not because I think they are the same
    >> or something like that.
    >> Please don't be so pedantic. You know what I meant, don't you?

    >
    > Actually, no we did not know that.
    > There are just too many people about who really think that there is a
    > language called "C/C++" to assume that a poster knows about the
    > distinction between C and C++ when he uses the term C/C++.

    [snip]

    I think your claim is plain false. I never met someone who "really think(s)
    that there is a language called 'C/C++'". Also, I have never encountered
    the case that a poster using "C/C++" reacted with even the slightest amount
    of surprise when informed that there is no language that goes by the
    name "C/C++". I wonder if there are, say, three threads from the archive
    where it actually transpires that a poster thaught there is a language
    called "C/C++". Could you quote even one? (Maybe, there is a difference in
    comp.lang.c and comp.lang.c++. My observation is based upon the C++ group.
    So, it could be possible that the C forum is teeming with posters who
    actually think C/C++ does name a language.)

    All that I have observed is that there are some people who regularly
    _pretend_ that those using the phrase "C/C++" do refer to some language of
    that name. That joke was funny the first time I saw it, but it wears off
    over the years.


    Best

    Kai-Uwe Bux

    ps.: Come to think of it, maybe there is a C/C++ language. I think Comeau
    offers a compiler for that one :)
    , Jan 18, 2008
    #12
  13. Nickolai Leschov

    Flash Gordon Guest

    Bart van Ingen Schenau wrote, On 18/01/08 10:47:
    > On Jan 18, 11:01 am, Nickolai Leschov <> wrote:
    >> Lew Pitcher wrote:
    >>
    >>> OK, first thing is to recognize that there is no such thing as
    >>> "standard-compliant C/C++ programming", because there is no standard
    >>> that defines something called "C/C++".
    >>> However, there /are/ standards for the C language, and /different/
    >>> standards for the C++ language. You are going to have to choose which
    >>> language you want to learn about wrt "standard-compliant" programming.

    >> Yes, I know what is C and what is C++, they are different languages, I
    >> just wrote "C/C++" to save time, not because I think they are the same
    >> or something like that.
    >> Please don't be so pedantic. You know what I meant, don't you?

    >
    > Actually, no we did not know that.
    > There are just too many people about who really think that there is a
    > language called "C/C++" to assume that a poster knows about the
    > distinction between C and C++ when he uses the term C/C++.


    Also please note that in significant area what is good practice in C++
    is not even possible in C. A simple example is using new/delete in C++
    which do not exist in C. I know the OP wanted the non-language stuff,
    but it is the language stuff which is topical here and there are
    significant differences.

    > And if you can't stand pedantery, comp.lang.c and comp.lang.c++ will
    > not meet your tastes, because they are full of it.


    True.

    <snip>

    > - When writing an application that uses third-party software (open
    > source or not), you should regard the third-party software as 'read-
    > only'.


    Apart from submitting bug fixes back to the developers.
    --
    Flash Gordon
    Flash Gordon, Jan 18, 2008
    #13
  14. Nickolai Leschov

    James Kuyper Guest

    Lew Pitcher wrote:
    > On Jan 17, 2:03 pm, Nickolai Leschov <> wrote:
    >> Hello,

    >
    > Hi, Nickolai
    >
    > [snip]
    >> Where do I learn about things like that? I'm sorry for asking this here,
    >> where we dicuss standard-compliant C/C++ programming, but I really don't
    >> know any other place now. I do program in C/C++.

    >
    > OK, first thing is to recognize that there is no such thing as
    > "standard-compliant C/C++ programming", because there is no standard
    > that defines something called "C/C++".


    I've never understood the seriously negative responses that the use of
    the term "C/C++" provokes. I will concede that it's entirely possible
    that someone might use the term in the mistaken belief that it refers to
    a single language, but off-hand I cannot remember ever seeing any
    unambiguous evidence that someone was making that mistake. It seems
    quite clear to me that in most cases, including this one, it is being
    used to simplify a statement that is talking about both languages. It is
    a natural pairing, because the languages are so closely related - it's
    trivial to write code does just about anything you want it to do while
    compiling identically under both languages (except insofar as you need
    to make use of an external library which only has a C++ interface).

    "standard-compliant C/C++ programming" clearly means "standard-compliant
    C programming and standard-compliant C++ programming", and is a very
    reasonable way of expressing that concept in a shorter form. I program
    in C/C++" is an equally reasonable way of saying "I program in C and in
    C++". I don't understand what it is that you find objectionable about
    that usage.
    James Kuyper, Jan 18, 2008
    #14
  15. Nickolai Leschov

    Lionel B Guest

    > Bart van Ingen Schenau wrote, On 18/01/08 10:47:
    >>> - When writing an application that uses third-party software (open

    >> source or not), you should regard the third-party software as 'read-
    >> only'.


    Huh? Why on earth should you not (license permitting) patch/hack/modify
    third-party software to your heart's content and use it in your
    application? The entire open source software world relies on being able
    to do this.

    --
    Lionel B
    Lionel B, Jan 18, 2008
    #15
  16. Nickolai Leschov

    James Kuyper Guest

    Bart van Ingen Schenau wrote:
    ....
    > There are just too many people about who really think that there is a
    > language called "C/C++" to assume that a poster knows about the


    Could you cite an example? I don't doubt that you can, but I'd be
    surprised if you can find one quickly. I've been reading comp.std.c and
    comp.std.c++ for more than a decade, and I've seen "C/C++" used, and
    criticized, many times. Off-hand, I can't remember a single criticism
    that was actually justified, though there were probably one or two cases.
    James Kuyper, Jan 18, 2008
    #16
  17. On Jan 18, 1:52 pm, Lionel B <> wrote:
    > > Bart van Ingen Schenau wrote, On 18/01/08 10:47:
    > >>> - When writing an application that uses third-party software (open
    > >> source or not), you should regard the third-party software as 'read-
    > >> only'.

    >
    > Huh? Why on earth should you not (license permitting) patch/hack/modify
    > third-party software to your heart's content and use it in your
    > application? The entire open source software world relies on being able
    > to do this.


    I am not saying that you should not modify the library at all (licence
    permitting), but that such modifications should not be done as part of
    developing an application.

    If, during the development of an application, you find that a
    modification to a supporting library is needed, I would execute the
    modification as a separate project.
    For a small patch, the distinction between the two projects can be as
    small as the mental hat you are wearing, but I would still regard them
    as logically separate projects.

    >
    > --
    > Lionel B


    Bart v Ingen Schenau
    Bart van Ingen Schenau, Jan 18, 2008
    #17
  18. On Jan 18, 2:01 pm, James Kuyper <> wrote:
    > Bart van Ingen Schenau wrote:
    > ...
    >
    > > There are just too many people about who really think that there is a
    > > language called "C/C++" to assume that a poster knows about the

    >
    > Could you cite an example? I don't doubt that you can, but I'd be
    > surprised if you can find one quickly. I've been reading comp.std.c and
    > comp.std.c++ for more than a decade, and I've seen "C/C++" used, and
    > criticized, many times. Off-hand, I can't remember a single criticism
    > that was actually justified, though there were probably one or two cases.


    My experience is mostly based on what I read in the group
    alt.comp.lang.learn.c-c++.
    Perhaps the situation is better in the groups that deal with only one
    of the languages.
    As you asked for an example, here is one:
    http://groups.google.com/group/alt...._frm/thread/7968e41fe7f5a0c0/bd6ca478ac969048

    Bart v Ingen Schenau
    Bart van Ingen Schenau, Jan 18, 2008
    #18
  19. Nickolai Leschov

    Flash Gordon Guest

    Lionel B wrote, On 18/01/08 12:52:
    >> Bart van Ingen Schenau wrote, On 18/01/08 10:47:
    >>>> - When writing an application that uses third-party software (open
    >>> source or not), you should regard the third-party software as 'read-
    >>> only'.

    >
    > Huh? Why on earth should you not (license permitting) patch/hack/modify
    > third-party software to your heart's content and use it in your
    > application? The entire open source software world relies on being able
    > to do this.


    Because you then cannot easily take the next version of that SW that has
    some new and wonderful features.

    Most of the OSS world works on people submitting patches back to the
    projects rather than taking local copies and hacking it around. That way
    everyone gets the benefits of you changes and you get the benefit of
    being able to use new versions of the libraries.

    However, this is a topic for another group, possibly comp.programming.
    --
    Flash Gordon
    Flash Gordon, Jan 18, 2008
    #19
  20. Nickolai Leschov

    James Kuyper Guest

    Bart van Ingen Schenau wrote:
    > On Jan 18, 2:01 pm, James Kuyper <> wrote:
    >> Bart van Ingen Schenau wrote:
    >> ...
    >>
    >>> There are just too many people about who really think that there is a
    >>> language called "C/C++" to assume that a poster knows about the

    >> Could you cite an example? I don't doubt that you can, but I'd be
    >> surprised if you can find one quickly. I've been reading comp.std.c and
    >> comp.std.c++ for more than a decade, and I've seen "C/C++" used, and
    >> criticized, many times. Off-hand, I can't remember a single criticism
    >> that was actually justified, though there were probably one or two cases.

    >
    > My experience is mostly based on what I read in the group
    > alt.comp.lang.learn.c-c++.
    > Perhaps the situation is better in the groups that deal with only one
    > of the languages.
    > As you asked for an example, here is one:
    > http://groups.google.com/group/alt...._frm/thread/7968e41fe7f5a0c0/bd6ca478ac969048
    >
    > Bart v Ingen Schenau


    The relevant statement from that thread was:
    > I am attempting to move to C/C++ from a Java background.


    I saw nothing to indicate that he meant anything other than

    "I am attempting to move to C and C++ from a Java background."

    Can you cite one statement he made that is inconsistent with this
    interpretation?
    James Kuyper, Jan 18, 2008
    #20
    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. Kevin Spencer
    Replies:
    2
    Views:
    430
    John Saunders
    Aug 6, 2003
  2. Amelyan
    Replies:
    2
    Views:
    464
    Steve C. Orr [MVP, MCSD]
    Apr 30, 2005
  3. Kevin Frey

    Best Practices for Web App Development ?

    Kevin Frey, Feb 3, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    480
    Raymond
    Feb 3, 2006
  4. Replies:
    220
    Views:
    3,248
    Ed Leafe
    Aug 16, 2005
  5. Nickolai Leschov

    Good development practices

    Nickolai Leschov, Jan 17, 2008, in forum: C++
    Replies:
    30
    Views:
    827
    Jerry Coffin
    Jan 20, 2008
Loading...

Share This Page