XDC2014 Open Conversation - Day 2

Paul is killing his session, as you’d expect. His are always must-see.

He’s talking about the importance of source control, but I still don’t get all the emphasis when it’s well-known that it doesn’t work with external items.

Well, to be fair, it does work with external items - it just does not work well.

Paul talks about Dim’ing variables close to where they are used rather than the top of the method. I wish he had stressed this more, but I understand he’s got a lot to say in a short time.

As in optimization?

way back when I was in school (seems like a lifetime ago), it was emphasized to put all the dim’s at the top of the method. once of the reasons (they had many) was readability. you could see the variables upfront and know what they are and what to expect. I neither agree nor disagree with that. I tend to dim things at the top due to habit (at the start of writing the method, I will say I need this integer and this string and oh I will need this boolean…) which puts a lot of mine towards the top.

Kem, what is the reason to dim close to first use over the top?

I hate reading methods where dim’s pop-up like mushrooms. Gives the impression that the programmer was lazy or didn’t think ahead…

I hate reading methods where variables are just used without any context about where they came from (was this passed in? Created locally?) or for how long they are used. I prefer to instantiate my variables close to where they are used, and try not to re-use them further down in a method to cut down on bugs.

Readability. An example I gave in a different thread:

dim ab, cd as integer
dim ef as double
dim aThousandOtherVariables as aHundredDifferentTypes

// one
// million
// lines
// of
// code
// later
ab = 3 * ef // What the ef?!?

In a lot of old languages, you had to declare your variables at the very top or sometimes at the start of a block (like ANSI C). I could never go back to that. I declare my variables as close to their first use as possible, I find it much more readable.

Once upon a time, REALbasic was like that too.

Wasn’t Option Explicit in VBA used for that?

That’s right, I was trying to think if that was the case.

although I have a lot defined at the top, I also dim some inside “blocks” of code so thy will go out of scope once leaving the block. maybe I should work on dim’ng closer to first use. just something else I need to work on to make myself a better programmer.

Thom is talking about threads. Mentions the Task class that comes with the Xojo package, but he has his own too. Access from here:

http://quickstartsoftware.com/xdc

[quote=74644:@Kem Tekinay]Thom is talking about threads. Mentions the Task class that comes with the Xojo package, but he has his own too. Access from here:

http://quickstartsoftware.com/xdc[/quote]
Nice.

“Some people, when confronted with a problem, think, “I know, I’ll use multithreading.” Noth wey hatwve oproblems.”

Can’t find the task class on the above link – We’ll have to get Thom to clarify the link address.

I think you have to sign up for their mailing list and they’ll e-mail a link.

FYI From Pat Delaney:
“You need to sign up for a newsletter (I believe!) then they’ll sort the class later this evening”