A little code review by the Group


Closed Thread
Results 1 to 9 of 9
  1. #1
    Join Date
    May 2008
    Location
    Florida
    Posts
    64

    Red face A little code review by the Group

    Be Gentle Please! My first time.

    After spending a better part of the day glued to my computer and LAB-X1 board I have managed to cobble together my first working program.

    Nothing fancy - The progam searches for up to 10 DS18S20 temp probes and then queries each and dispalys the temp. Sounds like a few other postings around here.

    I borrowed parts of the code from a number of different postings and glued it together and then figured out why the heck it didn't work.

    The major flag waving event is that I didn't have to bug anyone to figure out why it wasn't working. DID manage to kill 18 cups of tea in the process.

    Anyway could I get a few of you to talk a look it over and offer some suggestions on how to tighten it up or improve it. It is still a work in progress.

    still need to get me some of them Bs to play with.
    Attached Files Attached Files

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Oh ... I'm probably not going to sound too "gentle" here.

    And before I get to that point, I'd like to congratulate you for successfully integrating other programs for a more "complete" purpose.

    However, in the process of combining the code ... you seem to have lost all the comments from the original authors. Including their Names.

    I can't speak for Jim Morrissey or Tom Estes.
    But if you had done that with one of my programs ....
    It would make me very angry ...
    I start turning green when I get angry.
    <br>
    DT

  3. #3
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by manwolf View Post

    I borrowed parts of the code from a number of different postings
    So do you have every intention of putting the parts back

    Borrowing is to take something, use it and then hand it back. Whilst its often the case that people here will help out by posting code, examples or even full projects, its polite to either include their names in the credits, or mention the authors in the thread you post your merged / modded code in.

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


    Did you find this post helpful? Yes | No

    Default

    When I post an example on a forum or other public place I figure it to be open source. I always figured other people thought the same.

    So I guess if you do not want an example used then stop posting. Look for your ego trip in another place.

    The OP should be congratulated for getting his application to work.
    Dave
    Always wear safety glasses while programming.

  5. #5
    Join Date
    May 2008
    Location
    Florida
    Posts
    64


    Did you find this post helpful? Yes | No

    Default

    If you open the file and look in the comments and OPEN your eyes you will see I did credit those I borrowed code from for the program. I did give back, I posted my code back to the forum for all to see and use.

    As far as my limited memory can recall I don't remember any of the names Darrel mentioned.


    Code:
    ' PROGRAM: Multi_Temp_Sensor.pbp
    '
    ' WRITTEN BY Ted "manwolf" Crafton 2008
    ' WRITTEN FOR PIC16F877A-I/L MICROPROCESSOR
    '   and LAB-X1 with multiple DS18S20s on breadboard
    '   or wired remote.
    '
    ' To DO soon:
    '	Learn how to break the 64 bit rom into bytes
    '	Learn how to read and write the address to EEPROM
    '	Update the Temperature conversion to handle neg as well as Pos
    '	temps and get it a little more accurate.
    '
    '* Notes : 
    '* :  part of the main search program is copied from a thread by Jimbab, 
    ' http://www.picbasic.co.uk/forum/showthread.php?t=3671
    '
    '* :  Part of this code from MeLabs example
    '
    '* :  Part of this code required brain cells

    I dug around and found the code I used for the Search and it turns out I credited the wrong person.

    Code:
     PROGRAM: 1_WIRE_SEARCH.bas
    '
    ' WRITTEN BY DAVID PUROLA 9/18/2003
    ' WRITTEN FOR PIC18F452-I/L MICROPROCESSOR
    '
    Sorry Mr. Purola, I have corrected the oversight.

    I should mention Bruce Rynolds, didn't use any code but did read it to learn how to do what I wanted.
    http://www.rentron.com/PicBasic/one-wire2.htm

    And last but not least my wife for not pulling the plug. Only comment from her was "Oh, you doing that again?"

    I have been writting code for 20 years and have very thick skin and some say a head as hard as rock. The wife insists on the last point.

    Thanks for posting I really did want to hear your comments, needed to learn the lay of land.

    Guess I will need to keep a list of everything I read in the future so no one gets left out.

    So did anyone look at the code itself and have any comments?

    I don't know how to update a file already uploaded. So here is the updated one.

    I always look forward to reviews from fellow coders, kind of like having a root canal without the novicane.
    Attached Files Attached Files

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


    Did you find this post helpful? Yes | No

    Default

    I looked at the code. I did not makes any comments as I am not up on one wire stuff.

    You have been coding for some years. Then you know that if it works then it is OK. I did not notice any thing that is borderline on working.

    I may start using one wire. If I do I may use some of your code.
    Dave
    Always wear safety glasses while programming.

  7. #7
    Join Date
    May 2008
    Location
    Florida
    Posts
    64


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mackrackit View Post
    I may start using one wire. If I do I may use some of your code.
    Please feel free, Dave.

    And after all those years I have found that if I spend more time with it I can make it better.

    I have completed most of the examples provided with both my development boards and felt it was time to go after something that might be useful and more challanging.

    Got a little ahead of myself with the one wire and ended up having to use someone elses code. But it turned into a great learning exercise, I have alot better idea of how one wire works and know I have a lot more learning to go.

    Going from just about unlimited memory to a PIC is a real eye opener!

  8. #8
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mackrackit View Post
    When I post an example on a forum or other public place I figure it to be open source. I always figured other people thought the same.

    So I guess if you do not want an example used then stop posting. Look for your ego trip in another place.
    It's not my ego that's in question, since obviously I didn't write the original code.
    But it is my job to protect the rights of the other users on this forum.

    Take a look at any open source license, and you'll find that you are allowed to use the code in any of your own programs, in any way you wish. Modify it to your hearts content. And you can even sell products that use the code without paying a dime to the person that wrote it.

    You are also allowed to modify and republish the code, as long as you give full disclosure of the original source of the code. And preferably describe the changes you made that Improved it enough to now call it yours.

    The people that write all this free code spend many hours, often hundreds of hours to provide you with these examples. The least you can do is recognize them when you only have to spend a few hours modifying it to get what you want.

    I believe Ted has compensated for the oversight.

    Quote Originally Posted by mackrackit View Post
    The OP should be congratulated for getting his application to work.
    I did!
    DT

  9. #9
    T.Jackson's Avatar
    T.Jackson Guest


    Did you find this post helpful? Yes | No

    Default Plagiarism

    I agree with Darrel, out of respect for the original author(s) you should always acknowledge them whenever you use portions of their work, particularly if you post your compilation on the internet. It's totally unfair to just go around slapping together bits & pieces of other people's work that you find on the internet and then try claiming it as your own.

    If you're seeking to truly be able to call something your own, study other people's code, learn from it, then write your own version.

    Trent Jackson

Similar Threads

  1. Reading in Manchester code
    By brid0030 in forum Code Examples
    Replies: 0
    Last Post: - 10th March 2009, 21:55
  2. How much code space do PBP statements use.
    By Darrel Taylor in forum Code Examples
    Replies: 5
    Last Post: - 13th February 2009, 21:31
  3. Loop with two motor and 2 sensors
    By MrRoboto in forum mel PIC BASIC
    Replies: 4
    Last Post: - 8th December 2008, 23:40
  4. Making Program Code Space your playground...
    By Melanie in forum Code Examples
    Replies: 15
    Last Post: - 19th July 2008, 08:26
  5. Code Review?
    By Tom Gonser in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 29th May 2005, 13:48

Members who have read this thread : 0

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