PDA

View Full Version : A little code review by the Group



manwolf
- 29th June 2008, 04:43
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. :p

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.

Darrel Taylor
- 29th June 2008, 06:50
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>

malc-c
- 29th June 2008, 15:16
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.

mackrackit
- 29th June 2008, 15:45
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.

manwolf
- 29th June 2008, 17:30
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.




' 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.



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. :o

mackrackit
- 29th June 2008, 18:05
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. :D

manwolf
- 29th June 2008, 20:16
I may start using one wire. If I do I may use some of your code. :D

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! :p

Darrel Taylor
- 29th June 2008, 22:43
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.


The OP should be congratulated for getting his application to work.
I did!

T.Jackson
- 30th June 2008, 01:14
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