Sign in to follow this  
Followers 0
CWorks

Q. about good programming practice

6 posts in this topic

just wondering because i try and put as much as i can in it's own func

I don't know if i'm just lazy or just don't like to think too much

and just work on a function first and then add them one at a time to my program fixing as i go

Koda make it so much easier


Share this post


Link to post
Share on other sites



just wondering because i try and put as much as i can in it's own func

I don't know if i'm just lazy or just don't like to think too much

and just work on a function first and then add them one at a time to my program fixing as i go

Koda make it so much easier

Hi,

is there a question? :P

So long,

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

I think hes asking if its good programming to use functions for the majority of your script.

This is true to a point. You dont want to make EVERYTHING into a function, just the stuff that you use more than once. It makes it easier to debug when you can isolate a block of code(the function) to fix. If you want to bypass that part, you only have to comment out one line. Functions should be used in all scripts IMO.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

just wondering because i try and put as much as i can in it's own func

I don't know if i'm just lazy or just don't like to think too much

and just work on a function first and then add them one at a time to my program fixing as i go

Koda make it so much easier

Functions are about reusing code. In a short, one time, script that just goes through a linear series of steps, they're not necesary. But anything you type more than once should be a function. Outside the single script, any function you use in multiple scripts, even if only once per script, should be put in a good general function that can be copy/pasted in where required. My install scripts have evolved over last few months, and functions (plus groups of functions in UDF files for #include) have made my scripts quicker to write and more reliable, as my standard functions are well understood and thoroughly debugged already (at least for me).

P.S. I'm not a professional programmer, but I did sleep on a bench at Holiday Inn Express last night... :P

Edited by PsaltyDS

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

P.S. I'm not a professional programmer, but I did sleep on a bench at Holiday Inn Express last night... :P

Hah! Nice.

Share this post


Link to post
Share on other sites

well at least i know now i'm doing it right then

after browsing the pages here i've seen enough udf's to last a lifetime so i guess all the functions kinda stuck with me

I also find some things run a lot smoother by putting stuff in a function

at least it's a lot easier for me to follow if everything is in it's place and just put some msg boxes where i think there may be a problem so i can catch the values

now i just need to figure out how to do arrays :P

and i am so sic of those damn stupid comercials :nuke:


Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0