Servoy Magazine latest posts

Home for older / inactive topics

Servoy Magazine latest posts

Postby david » Mon Aug 26, 2013 6:08 pm

Servoy Magazine has been around almost as long as Servoy has. If you haven't noticed in the past couple of years we've added video content covering some decently in-depth content. Applicable to Servoy and coding in general. Recent posts include:

Coding Session #18: Metagaming code, Powerful Stuff
Coding Session #17: Coding is !@#$ Messy
Multiple Instances of Forms (Guest author: Adrian McGilly)
Phone calls from web client with Asterisk (Guest author: Lachlan Dunlop)
Divide and conquer with Servoy headless client plugin

Oldies but Goodies:

Controller vs Foundset vs Dataset
Coding Session #7: Reusable Code Considerations
Coding Session #4: Building a Form

I'll keep this thread updated with new posts.
David Workman, Kabootit

Image
Everything you need to build great apps with Servoy
User avatar
david
 
Posts: 1727
Joined: Thu Apr 24, 2003 4:18 pm
Location: Washington, D.C.

Re: Servoy Magazine latest posts

Postby sbutler » Tue Aug 27, 2013 9:46 pm

david wrote:Multiple Instances of Forms (Guest author: Adrian McGilly)


I have some comments for discussion on this one, so I thought it easiest to post them here than in the comment on Servoy Magazine...

Adrian, thanks for taking the time to put this all together. I do have a few issues with it though...

1. Why are you using the SolutionModel and cloning the form? application.createNewFormInstance is faster, and should have less overhead as it just creates a new runtime instance, whereas using the SolutionModel and cloning the form is touching the blueprint and runtime.

2. Your encapsulation examples aren't using encapsulation. In your examples, the end result is still calling code like forms[formName].methodName(). The only difference is that you are getting the form name dynamically. Instead, if you want to call methods across forms, you should be using an event based registration based model. So if the child form wants to call something in the parent form, then in the onLoad of the parent form, it should register its method with the child form. Then when the child form wants to do a call, it looks to see what methods are registered, and calls them. Servoy's new frameworks they will be coming out with soon will implement these techniques in their framework, so I'd suggest people take a look at those. Generally, if you have code in your solution that does forms.formName.* then there is a problem. I know we all get lazy sometimes and do this, but its really not the right way, and shouldn't be taught. Even if formName is dynamic forms[formName].methodName() is still wrong. If you think of forms like View in the MVC architecture, your having code in one view directly call another view without going through the model, and thats not ideal. Code in a form should only directly call code within itself, in a scope, in an entiy method, or a method object that has been registered via an event base registration model (like using callbacks and listeners). Some pseudo code below about the event registration model with listeners...

Code: Select all
--in parent Invoice form
function onLoad(){
   //an example scope that tracks events by a name, and which methods are listening
   scopes.events.registerListener(myListener, "InvoiceLinePriceUpdated")
}

function myListener(){
   //do something here on parent form, like update a total for amount owed
}

--in the child InvoiceLines form
function price_onDataChange(){
   //an example scope that triggers the event to run, which should execute all the methods that are listening
   scopes.events.fireEvent("InvoiceLinePriceUpdated")
}
Scott Butler
iTech Professionals, Inc.
SAN Partner

Servoy Consulting & Development
Servoy University- Training Videos
Servoy Components- Plugins, Beans, and Web Components
Servoy Guy- Tips & Resources
ServoyForge- Open Source Components
User avatar
sbutler
Servoy Expert
 
Posts: 759
Joined: Sun Jan 08, 2006 7:15 am
Location: Cincinnati, OH

Re: Servoy Magazine latest posts

Postby david » Tue Aug 27, 2013 9:59 pm

goldcougar wrote:Generally, if you have code in your solution that does forms.formName.* then there is a problem.


Agree with this one. We let slide if it is demo or one-off code but in general try to refactor into a best practice pattern if production code. Best practices take time and practice to develop and utilize with ease though.
David Workman, Kabootit

Image
Everything you need to build great apps with Servoy
User avatar
david
 
Posts: 1727
Joined: Thu Apr 24, 2003 4:18 pm
Location: Washington, D.C.

Coding Session #18: Metagaming code

Postby david » Fri Aug 30, 2013 9:25 pm

What does it take to reduce your code by 10x's? Make it significantly faster?

Coding Session #18: Metagaming code: http://www.servoymagazine.com/home/2013 ... stuff.html
David Workman, Kabootit

Image
Everything you need to build great apps with Servoy
User avatar
david
 
Posts: 1727
Joined: Thu Apr 24, 2003 4:18 pm
Location: Washington, D.C.

Re: Servoy Magazine latest posts

Postby bobcusick1332964082 » Thu Sep 05, 2013 8:20 pm

Great stuff, David! Thanks for writing it up!
bobcusick1332964082
 
Posts: 85
Joined: Wed Mar 28, 2012 9:48 pm


Return to Archive

Who is online

Users browsing this forum: No registered users and 2 guests