Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Thu Apr 19, 2018 12:26 pm
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: Rb Curriculum. Need help
PostPosted: Wed Nov 21, 2012 3:13 pm 
Offline

Joined: Sat Feb 04, 2012 1:26 pm
Posts: 86
Location: Italy
Hi,
I have already create some programs but I do not feel confortable at coding yet. So began to study the Rb Curriculum lessons.
I am, currently, reading lesson no. 5, dealing with modules, methods and recursion. I refer to the program that repeat a string some number of times. Now I don't exactly understand why, in the exemple, the problem is solved by creating the repeatstring method inside the project, the update method inside the windows and referring to the earlier method, and then, the Update method call inside the valuechanged slider event. Wouldn't had it be easier and quicker to put all the code inside the valuechanged event slider ?
Thanks for helping.


Top
 Profile  
Reply with quote  
 Post subject: Re: Rb Curriculum. Need help
PostPosted: Wed Nov 21, 2012 6:24 pm 
Offline
User avatar

Joined: Mon Apr 02, 2007 2:08 am
Posts: 1225
Location: San Francisco, CA, USA
Yes, you certainly could put all of your code in the ValueChanged event and it will work as expected.

Many of the examples in the curriculum are designed more to demonstrate the concept being discussed rather than serve as example of production code. In the case of the example you mention, the concept is the use of Methods to break problems down into easier sub-units, how to use scoping to understand and control where REALstudio decides to look for a method or variable, and using recursive methods to solve certain types of problems.

_________________
Boredom Software


Top
 Profile  
Reply with quote  
 Post subject: Re: Rb Curriculum. Need help
PostPosted: Thu Nov 22, 2012 12:10 pm 
Offline
User avatar

Joined: Fri Sep 30, 2005 11:48 am
Posts: 3554
Location: Lenexa, KS
If you want additional help learning Real Studio and coding techniques, I have 36 hours of Real Studio training available to subscribers. I have about 6 hours of free video (registration required). I've had experienced Real Studio developers tell me they've learned some new things by watching the videos. Direct link to the Training Area (written in Web Edition) http://www.bkeeney.com/RealStudioTraining/realstudiotraining.cgi

_________________
Bob K.

A blog about being a Real Studio/Xojo developer at http://www.bkeeneybriefs.com


Top
 Profile  
Reply with quote  
 Post subject: Re: Rb Curriculum. Need help
PostPosted: Thu Nov 22, 2012 1:06 pm 
Offline

Joined: Sat Feb 04, 2012 1:26 pm
Posts: 86
Location: Italy
thanks for helping.
I am going to whatch the videos.
Anyway, are there any situations where it is better to write code inside separated methods instead of writing everyting inside the control event?


Top
 Profile  
Reply with quote  
 Post subject: Re: Rb Curriculum. Need help
PostPosted: Thu Nov 22, 2012 1:26 pm 
Offline
Real Software Engineer

Joined: Sat Dec 24, 2005 8:18 pm
Posts: 7858
Location: Canada, Alberta, Near Red Deer
most times it's better since it makes it easier to reuse your code

_________________
Norman Palardy (Real Software)


Top
 Profile  
Reply with quote  
 Post subject: Re: Rb Curriculum. Need help
PostPosted: Thu Nov 22, 2012 1:30 pm 
Offline
User avatar

Joined: Fri Sep 30, 2005 11:48 am
Posts: 3554
Location: Lenexa, KS
Having it in the control event is fine until you need to call it from multiple places in your code. Say you had a Menu Item for Save and pushbutton for Save you only want to call it once. So perhaps you create a method called "Handle_Save" and you put it in the pushbutton and the menu handler events.

_________________
Bob K.

A blog about being a Real Studio/Xojo developer at http://www.bkeeneybriefs.com


Top
 Profile  
Reply with quote  
 Post subject: Re: Rb Curriculum. Need help
PostPosted: Thu Nov 22, 2012 1:47 pm 
Offline

Joined: Sat Feb 04, 2012 1:26 pm
Posts: 86
Location: Italy
Bob, I thimk the conept is becoming clearer to me now.
Just before reading your post I wrote another topic, maybe dealing with the same matter.
viewtopic.php?f=3&t=46021
Is that the case i might write a portion of code just once?


Top
 Profile  
Reply with quote  
 Post subject: Re: Rb Curriculum. Need help
PostPosted: Sat Nov 24, 2012 3:45 am 
Offline
User avatar

Joined: Sun Jul 15, 2007 3:12 am
Posts: 119
Location: Denmark, Europe
Also take a look at this thread, that has some great ressources for learning.

I can especially vouch for the VTC course Paul Lefebre has done, it's the best teaching tool I've ever tried. It cleared up so many concepts for me, that half way through I could create a complete app with modules, classes, preference files and other cool stuff I never thought I'd learn :)

_________________
REAL Studio 2012 Pro (Release 1.2) on a 17" MacBook Pro running Mac OS X Mountain Lion.
ATTENTION Danish RS Devs - make sure you join our Facebook group at http://www.facebook.com/groups/danske.realstudio.udviklere/


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group