How do you code?

For everything that's not in any way related to PureBasic. General chat etc...
User avatar
Blue
Addict
Addict
Posts: 967
Joined: Fri Oct 06, 2006 4:41 am
Location: Canada

Post by Blue »

srod wrote:Only kidding! My code's not as bad as I'm making out, [...]
I believe you. Anybody smart enough to keep reminding us "...I'm not a complete ass! " in his sign-off can't be a bad programmer.

srod wrote:[...] I still can't bring myself to grab a pen and paper and jot down a few algorthims or some psuedo-code etc. Just takes the fun out of it all!
Tsk! Tsk! Tsk! wrong approach. The words get in the way.
You see, there's pain and paper (to be avoided) as well as pen and paper... Carefully avoid confusing one with the other.
So, yes to pen and paper, NOT as in words and sentences (Goto pain:), but as in doodling.

I never start a coding task (not even menial ones) without first grabbing my pad and ballpoint pen, and doodling my way into my own ideas. The circles, arrows, lines and various marks help delimit the idea, and focus the effort. The rough stuff gets out of the way.

Sometimes, the sketch ends up nothing more than just a jumble of lines, arrows, concentric circles and question marks, but more often, it develops all by itself into a basic (as in rudimentary, not as in Pure!), but coherent, outline of the plan ("project" when it graduates into the grandiose).

That exercise, in itself, clarifies the process and really helps maintain the focus and purpose of the coding brain.

Thanks srod, for getting a great topic going. It's enlightening and a real pleasure reading what everybody has to say.

And just remember:
Forget flowcharts and fancy words.
Start Doodling.

it'll help keep your creative juices flowing and organized...
PB Forums : Proof positive that 2 heads (or more...) are better than one :idea:
thamarok
Enthusiast
Enthusiast
Posts: 282
Joined: Wed Sep 06, 2006 1:37 pm

Post by thamarok »

Exaclty what I do before making any project.

First, I design the GUI of the program on a paper, then I'll draw the flowchart also on a paper, after that I will write pseudo-code and finally do the PureBasic coding.
eVAPor8
User
User
Posts: 49
Joined: Tue Aug 14, 2007 10:58 am
Contact:

Post by eVAPor8 »

It depends on what you're programming. I'm a VB6 coder really, so I'm a PureNoob.. but I just love it! Compared to COBOL it's a dream!

For simple, 5-minute jobs (that end up taking hours! ;) ) I'll just dive in, but it's technique... for instance...

Procedure MyLoop()

EndProcedure

Turns into...

Procedure MyLoop()
For MyLoopCounter = 0 to 9

Next MyLoopCounter
EndProcedure

Which in turn becomes...

Procedure MyLoop()
For MyLoopCounter = 0 to 9
x = MyLoopCounter * 10
Debug x
Next MyLoopCounter
EndProcedure

I kind of structure it out, and then "fill in the blanks"

For anything else it's usually a whiteboard+psuedocode or a good old-fashioned pen and paper.

I rarely, if ever use flowcharts or block diags. I basically use the above technique for everything and go from there. It soon becomes apparent if I've made a mistake, and it teaches to "think like a user". The worst thing a coder can do is try to explain something to a user with a block-diagram. You need to learn to say... "It does doesn't work because it's waiting *whatever*..."

It's how they think, and it's them that we are ultimately working for.

So there you go. The ethos of Vappy: "Wanna be a decent programmer? Think like a noob! Or better yet, a complete idiot"
Heathen
Enthusiast
Enthusiast
Posts: 498
Joined: Tue Sep 27, 2005 6:54 pm
Location: At my pc coding..

Post by Heathen »

I program in my head and then I move it from my head to japbe. Sometimes it leads to funny results :P
User avatar
pdwyer
Addict
Addict
Posts: 2813
Joined: Tue May 08, 2007 1:27 pm
Location: Chiba, Japan

Post by pdwyer »

Mantra

New features can wait for the next version!
New features can wait for the next version!
New features can wait for the next version!
New features can wait for the next version!
New features can wait for the next version!
New features can wait for the next version!
New features can wait for the next version!
New features can wait for the next version!
New features can wait for the next version!
New features can wait for the next version!
... ahh bugger it, it's more fun to work on them now! :mrgreen:

Also,

I practice "The art of distractable coding (tm)". Lots of little functions that can be finished quickly so that when things crop up (I'm not a programmer by trade so people don't leave me alone to do it) I can drop it at any time without losing my place by too much. "Atomic Coding" to attempt to use a buzz word 8)
Paul Dwyer

“In nature, it’s not the strongest nor the most intelligent who survives. It’s the most adaptable to change” - Charles Darwin
“If you can't explain it to a six-year old you really don't understand it yourself.” - Albert Einstein
User avatar
Rook Zimbabwe
Addict
Addict
Posts: 4322
Joined: Tue Jan 02, 2007 8:16 pm
Location: Cypress TX
Contact:

Post by Rook Zimbabwe »

I have been learning to use the new EVENT LOOP in PB4.1... it has forced me to organize my code better...

As far as the interface I usually have a good idea for that before I begin in my head... Not that I don't rip that apart at will if need be...

I note my variables and attempt not to reuse variable names for cleaner code unless it fits... no crossover name problems on reuse! :D

I flowchart at times... it is how I was taught way back when... but not always...

When I find myself "thinking" in PB... then i know I am in the zone... and if I am OUT OF ZONE...

I post a thread for help with code... 8)
Binarily speaking... it takes 10 to Tango!!!

Image
http://www.bluemesapc.com/
Flaming Amoeba

Post by Flaming Amoeba »

How do you code?
Naked!
Matt
Enthusiast
Enthusiast
Posts: 447
Joined: Sat May 21, 2005 1:08 am
Location: USA

Post by Matt »

Flaming Amoeba wrote:
How do you code?
Naked!
and I thought I was the only one :shock:
User avatar
pdwyer
Addict
Addict
Posts: 2813
Joined: Tue May 08, 2007 1:27 pm
Location: Chiba, Japan

Post by pdwyer »

Matt wrote:
Flaming Amoeba wrote:
How do you code?
Naked!
and I thought I was the only one :shock:
One less thing to do if you get distracted by internet porn! :lol:
Paul Dwyer

“In nature, it’s not the strongest nor the most intelligent who survives. It’s the most adaptable to change” - Charles Darwin
“If you can't explain it to a six-year old you really don't understand it yourself.” - Albert Einstein
Foz
Addict
Addict
Posts: 1359
Joined: Tue Nov 13, 2007 12:42 pm
Location: Manchester, UK

Post by Foz »

I code by writing a complete and working mess while I get my head around the concepts/problems, and then I rewrite it 2-4 times, each time it gets cleaner and more efficient as my understanding becomes clearer.

The downside is that it takes me a while to produce something beautiful. Which for business they don't care, so they get my first stab and then work from there.
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post by PB »

> I rewrite it 2-4 times, each time it gets cleaner and more efficient

That is so true. If I've written an app (a small one I mean) and then I delete
it (by mistake or on purpose) and decide to rewrite it, the new version is so
much cleaner and better. It always amazes me, but I guess it's because it's
been done once so you know what to do right and what to avoid.

But it's not just coding either. When I was a little boy (way back in the day!),
and I'd build a fort or something with Lego, then if it got destroyed (dropped)
and I rebuilt it, the rebuilt version was always much better too.
eVAPor8
User
User
Posts: 49
Joined: Tue Aug 14, 2007 10:58 am
Contact:

Post by eVAPor8 »

PB wrote:> I rewrite it 2-4 times, each time it gets cleaner and more efficient

That is so true. If I've written an app (a small one I mean) and then I delete
it (by mistake or on purpose) and decide to rewrite it, the new version is so
much cleaner and better. It always amazes me, but I guess it's because it's
been done once so you know what to do right and what to avoid.

But it's not just coding either. When I was a little boy (way back in the day!),
and I'd build a fort or something with Lego, then if it got destroyed (dropped)
and I rebuilt it
, the rebuilt version was always much better too.
:shock:

I thought that was just me...
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post by PB »

:lol:
User avatar
GedB
Addict
Addict
Posts: 1313
Joined: Fri May 16, 2003 3:47 pm
Location: England
Contact:

Post by GedB »

I write test first, but using story tests rather than the usual unit tests.

First I write a story. Somebody does this, then that, they get these results. Then the do the other.

Write up the story as an executable test, and write the code that will cause that test to pass.

http://industrialxp.org/storyTdd.html

I do this now because I'm doing a lot of non-GUI work. When you're writing something with a GUI I do that a feature at a time, running the code constantly to make sure it's still working.

With stuff that is non-interactive I use the story test approach so that I can keep that constant feedback about the state of my code.
Post Reply