Programing code - need a "best practice" advice


Closed Thread
Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    891

    Default Programing code - need a "best practice" advice

    Hi,

    When I start a new project, I put on paper what the thing should do and how it should it.

    When it comes to write the code, I read my newly made flow-chart where I see the inputs, conditions and actions and put it in lines just as they appear on the paper.

    But this way of doing doesn't look very "scientific" to me and needs almost always lots of adaptations.

    Is there a way, a method or a system to prepare what the code will be, facilitating so the programing code and structure?

    How is this teached in technical schools?
    Roger

  2. #2
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default Re: Programing code - need a "best practice" advice

    Flow charting is the way to do it as far as I am concerned.

    I have a young guy working for me that asked me to look over his code as it was not working correctly. I looked at what he had and asked him to tell me exactly what he was trying to accomplish where or what was supposed to be happening. He was getting himself confused while trying to communicate the procedure. ( I will have to give him some credit as this is a project that involves several python scripts running on a server collecting data from a PIC and displaying in a web browser, so having trouble is expected).

    I asked him for his flow chart or outline and he did not have one to show me, he was trying to keep it all in his head. I sent him away telling him t make a flow chart or outline, then we can talk about the code.

    Flow charting is also a good method when there are multiple people on the project, task can then be divided out.

    So keep doing the flow chart, it is a tried and true method.
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    891


    Did you find this post helpful? Yes | No

    Default Re: Programing code - need a "best practice" advice

    Thanks Dave, that quite comforts me

    Now about creating code.

    Sometimes, making a kind of "truth table" of the inputs/outputs is helpful - at least, I it so to me.

    But I'm stuck when it comes to "conditions" (like IFs, ORs, etc).

    I don't know how to make this "on the paper", if this is possible at all
    Roger

  4. #4
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default Re: Programing code - need a "best practice" advice

    This page might give you some ideas.
    http://www.logicgenerator.com/AboutL...Flowcharts.htm

    Basically you could do something like this:

    Code:
    Check "A"
        |
    Check "B"
        |
    Does A = B ?
        |
    [if A = B THEN ]---------------|
        |                          |
    Do this                 ELSE----- Do This
    Dave
    Always wear safety glasses while programming.

  5. #5
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    891


    Did you find this post helpful? Yes | No

    Default Re: Programing code - need a "best practice" advice

    Okay, I'll have a look in there

    Thanks for the link.
    Roger

Similar Threads

  1. Replies: 0
    Last Post: - 14th November 2013, 03:32
  2. Replies: 3
    Last Post: - 15th October 2012, 08:06
  3. Replies: 0
    Last Post: - 18th September 2012, 14:34
  4. Need "PIC16F84A" Controler schematic Advice...
    By Kyo_89 in forum Schematics
    Replies: 1
    Last Post: - 27th May 2009, 23:03
  5. convert code "c" lcd graphic to pbp
    By nicolasronan in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 19th June 2006, 15:49

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts