PDA

View Full Version : Ways to make code easily reviewable and extendable



Ted's
- 21st August 2008, 02:43
I sometimes lose the thread within my code.

This is mainly because of pbp's missing opportunity of using real functions. Speaking of which: That is what I like about visual basic. To structure my code in pbp

- I use colons to put multiple orders in one line
- I use semi-colons to comment my code
- I use indents
- I use variables like
- I print the code 4 pages/a4 page

Which additional ways do you know to make the code easily reviewable and extendable?

rmteo
- 21st August 2008, 04:24
I have 3 dialects of BASIC (mikroE, Swordfish and Oshonsoft) for PIC's and have been considering adding PBP to the list. Interesting to note that functions are not supported. Thanks for the heads up.

mackrackit
- 21st August 2008, 05:24
Consider this
http://www.picbasic.co.uk/forum/showpost.php?p=8458&postcount=4

And look at how Darrel has for example Instant Interrupts and LCD Any Pin.

Not quite the same as in other languages, but when you get right down to it it is.
This is the nice thing about PBP, with a little learning you can make it do whatever you want.

rmteo
- 21st August 2008, 05:55
Mack, I think I understand LCD Any Pin, the 3 compilers mentioned above allow connecting an LCD to any port/pin combination - also for graphic LCD's. Correct?

What is the purpose of instant interrupts? Thanks.

mackrackit
- 21st August 2008, 06:24
I do not use the other compilers. Can not comment on their abilities. I was referring to VB, C whatever and the like.

Instant Interrupts are basically as the name implies. Look at all of the features.
http://www.picbasic.co.uk/forum/showthread.php?t=3251

The point I am trying to make, it seems like any language you use, there is always some thing that would be nice to have but does not. When the language is learned and the hardware or machine is understood, then you can always find a work around. Maybe this thinking comes from the time when a Hacker was still considered a good think to be called. (now days it seems the world is full of "crackers") . The ability to take a language, pieces of hardware, do a little tweaking, and do something new is all the fun.

The longevity of PBP and the things that can be done with it is what keeps me using it. I gave up on the point and click VB and VB like stuff years ago. To constrained. Sure, a simple function to pass a couple of variables is nice, but that also seems to make more overhead.

Give PBP a try, I think there is still a demo available. You will be suprised with what it can do.

rmteo
- 21st August 2008, 06:57
Thanks, Dave. Will take a closer look at PBP.

Ted's
- 21st August 2008, 18:27
Nice excursion mackrackit, now move back to topic.

Melanie
- 21st August 2008, 19:19
I sometimes lose the thread within my code.

I find that folks with early-onset Alzheimer's generally find programming a challenge...

Assuming you don't fall into that category...

1. Comment what you're doing
2. Comment what your program is doing
3. Comment revisions and alterations
4. Comment section headings

Am I getting thru with this 'comment' business?...

5. Put your subroutines in one place
6. Comment your subroutines as to what they do
7. Give Subroutines a meaningful name

8. Put interrupt handlers in one place
9. Comment Interrupt Handlers as to what they do
10. Give Interrupt Handlers a meaningful name

11. Assign meaningful names to aliases and variables
12. Put your Hardware Defines all in one place
13. Put your Hardware aliases all in one place
14. Put your software defines all in one place
15. Put EEPROM defines all in one place

It's not that difficult to write neat and tidy code that can be logically followed.

People wrote good logical code long before Visual Basic ever came on the scene!

Ever thought of flow-charting your program first as an aid to your writing it? Rarely done because folks are just plain lazy, but it can be an aid if you're having difficulties as can donepezil hydrochloride.

mackrackit
- 21st August 2008, 21:28
Nice excursion mackrackit, now move back to topic.

I was on topic, you mentioned functions and I addressed that.
My apologies if you could not follow the subject.
By the way, do you know trent? I bet he could help you.

Ted's
- 21st August 2008, 22:59
Ever thought of flow-charting your program first as an aid to your writing it?
Yes and that is a good point. Do you know a flow-chart program which converts to pbp or is at least able to be customized to do so? I thought about this but my search was unsuccessful.

Bruce
- 21st August 2008, 23:13
donepezil hydrochloride wuld bi muy ferst option if onli i culd remenbe how to spel it...;o}

Normnet
- 21st August 2008, 23:26
See IDE FineLine Viewer (http://www.picbasic.co.uk/forum/showthread.php?t=7119)

Norm

rhino
- 22nd August 2008, 00:07
Yes and that is a good point. Do you know a flow-chart program which converts to pbp or is at least able to be customized to do so? I thought about this but my search was unsuccessful.
http://www.imagesco.com/microcontroller/flowcode-compiler.html
It doesn't convert flowcharts to PBP code as you requested in THIS THREAD (http://www.picbasic.co.uk/forum/showthread.php?p=61154#post61154) , but I believe this is somewhat what you're looking for.

O/T -
Bruce - You might want someone to spellcheck that book you're working on ;)

Bruce
- 22nd August 2008, 00:13
Bruce - You might want someone to spellcheck that book you're working on
I'm good now. I found my donepezil hydrochloride prescription so I can remember most of it
now...;o}

Ted's
- 23rd August 2008, 00:10
It doesn't convert flowcharts to PBP code as you requested in THIS THREAD (http://www.picbasic.co.uk/forum/showthread.php?p=61154#post61154) , but I believe this is somewhat what you're looking for.
Thank you. This looks interesting.