disturbing ....White Eagle wrote:Naked
How do you code?
-
dracflamloc
- Addict

- Posts: 1648
- Joined: Mon Sep 20, 2004 3:52 pm
- Contact:
Hello everyone. I'm basically new and over here from the Blitz website.
I code by using a diagram first which includes a rough sketch of what all the user screens will look like.
Then I sit down and write the code that will function as the front end of the screens that I created and then I write the back end of the software last.
I code by using a diagram first which includes a rough sketch of what all the user screens will look like.
Then I sit down and write the code that will function as the front end of the screens that I created and then I write the back end of the software last.
welllll... my code... is somewhat like the "john wayne" style you described... but not completely. here's a quick idea of how i do things when starting anything that is going to end up large and/or complicated:
- Start with a few files in the beginning, usually Init, Procedures, and Main.
- Build a basic framework in which i can easily navigate. generally i do not have much code in the main loop, usually i have everything in there just do a few small checks (if needed) and call a procedure that deals with it.
- Rewrite everything 5 times. Yeah, pretty much that's what i do. I go through my code, and as i add more things to it... i realize how i did other things wrong.. or... not the best way at least. Then I go back to optimize them. usually i optimize for the least amount of code to do the job. unfortunately, it's not always the fastest code.. but honestly with anything i've made thus far in PB, speed has never been an issue.
If i need to find something, i'll usually start by looking in the main event loop, then i can find the procedure that deals with *whatever* and then move to the procedures file and easily navigate to it. I try to keep my procedures somewhat small.. so if it's something very complex, i split it up between a few, simply for my sake when coding.
- Start with a few files in the beginning, usually Init, Procedures, and Main.
- Build a basic framework in which i can easily navigate. generally i do not have much code in the main loop, usually i have everything in there just do a few small checks (if needed) and call a procedure that deals with it.
- Rewrite everything 5 times. Yeah, pretty much that's what i do. I go through my code, and as i add more things to it... i realize how i did other things wrong.. or... not the best way at least. Then I go back to optimize them. usually i optimize for the least amount of code to do the job. unfortunately, it's not always the fastest code.. but honestly with anything i've made thus far in PB, speed has never been an issue.
If i need to find something, i'll usually start by looking in the main event loop, then i can find the procedure that deals with *whatever* and then move to the procedures file and easily navigate to it. I try to keep my procedures somewhat small.. so if it's something very complex, i split it up between a few, simply for my sake when coding.
--Aszid--
Making crazy people sane, starting tomorrow.
Making crazy people sane, starting tomorrow.
- Joakim Christiansen
- Addict

- Posts: 2452
- Joined: Wed Dec 22, 2004 4:12 pm
- Location: Norway
- Contact:
I'd like to emphasize the "should". At the moment I've got one procedure that 377 lines long. But it's the exception to the rule.Trond wrote:I follow that rule as well. And with my large font I can only fit 30 lines on the screen at once.remi_meier wrote:Also: no procedure should be larger than the screen height.
> no procedure should be larger than the screen height
I disagree. Procedures can be fully self-contained routines whose length
depends on what task they perform. Such tasks may not be simple little
lines of code. And it depends on your screen resolution, too.
I disagree. Procedures can be fully self-contained routines whose length
depends on what task they perform. Such tasks may not be simple little
lines of code. And it depends on your screen resolution, too.
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
"PureBasic won't be object oriented, period" - Fred.
-
dracflamloc
- Addict

- Posts: 1648
- Joined: Mon Sep 20, 2004 3:52 pm
- Contact:
A good example is my SendKeys procedure:
http://www.purebasic.fr/english/viewtopic.php?p=12777
Bit hard to fit that into less than a screen height!
http://www.purebasic.fr/english/viewtopic.php?p=12777
Bit hard to fit that into less than a screen height!
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
"PureBasic won't be object oriented, period" - Fred.
-
remi_meier
- Enthusiast

- Posts: 468
- Joined: Sat Dec 20, 2003 6:19 pm
- Location: Switzerland
You could / (should) put the Select-EndSelect stuff into a procedure
named GetVKOfString() or something like that
And after my statement earlier in this thread, I explained why I handle
it like this, I won't write it twice
You guys heard of divide and conquer?
named GetVKOfString() or something like that
And after my statement earlier in this thread, I explained why I handle
it like this, I won't write it twice
You guys heard of divide and conquer?
Athlon64 3700+, 1024MB Ram, Radeon X1600



