Three modules questions

  1. I have identical globals in both the main and the module. When the global in the main is established, the equivalent global in the module should be set as well. Haven't been able to figure out how to establish global parity.

  2. I created a button to jump the user from the main solution to a related record in the module. But I can't figure out how to jump from the module back to a related record in the main solution.

  3. Is there an example solution available which shows modules deployed, something I can pick apart?

Kind regards,

Morley:
1. I have identical globals in both the main and the module. When the global in the main is established, the equivalent global in the module should be set as well. Haven't been able to figure out how to establish global parity.

You CAN'T have identical globals. Globals must be UNIQUE.

Morley:
2. I created a button to jump the user from the main solution to a related record in the module. But I can't figure out how to jump from the module back to a related record in the main solution.

You should include the main solution as a module of the module and build the appropriate method.

Morley:
3. Is there an example solution available which shows modules deployed, something I can pick apart?

No if I remember well but there is a good tutorial from Bob Cusick published by Servoy Magazine at this url:

http://www.servoymagazine.com/home/2005/05/article_servoy_.html

ngervasi:
You CAN'T have identical globals. Globals must be UNIQUE.

Let's say: you shouldn't have identical globals. But if you do have identical globals, there is no way to distinguish them. So in your case

globals.myGlobal = 1

will lead to

globals.myGlobal (module1) = 1
globals.myGlobal (module2) = 1

patrick:

ngervasi:
You CAN'T have identical globals. Globals must be UNIQUE.

Let's say: you shouldn't have identical globals. But if you do have identical globals, there is no way to distinguish them. So in your case

globals.myGlobal = 1

will lead to

globals.myGlobal (module1) = 1
globals.myGlobal (module2) = 1

Hmmm.... this is really nice, you just need to take good care of it and you could cut the number of globals to half. First thing that comes to my mind is globlas.current_user that I use in almost all of my mods ending up with a lot of globals that are practically the same with a waste of memory and a increase of clutter in the solution.
My only doubt is: can things change in the future? I don't want to end up rewriting all my mods when Servoy 4.x ships... :?

Any official comments Servoyans?

As long as the name and the type of the global is the same, I think you are save to use that.

There seems to be some confusion about globals and modules.

If you have the SAME global name and SAME datatype - Servoy only "sees" one global instance.

Morley:
2. I created a button to jump the user from the main solution to a related record in the module. But I can't figure out how to jump from the module back to a related record in the main solution.

This question has an interesting answer. If you know your current module will be included in another solution/module, you can write code in the current module that references methods and objects in the "parent" module. Won't work obviously until the modules are combined.

You can temporarily include the parent module into your current module to make it easier to figure out your coding.

Of course, if you find yourself doing a lot of this "cross module" coding you may want to rethink your module structure!

Hi All

I also would be interested in an answer, because I think this module concept is very weak and I am not sure if I should use it. Shouldn't modules be as much encapsulated as possible? May be with the exception of global variables. If people in a development team have to coordinate each other about every forms name, method name, etc. to be unique - huchhh, no so practical. If they are in the same location, it could be handled (but still not desired), but if they are in different locations, they have to coordinate about every name to be used, before using it!? I would like to see modules really encapsulated. What do others think?

Best regards, Robert

ngervasi:

patrick:

ngervasi:
You CAN'T have identical globals. Globals must be UNIQUE.

Let's say: you shouldn't have identical globals. But if you do have identical globals, there is no way to distinguish them. So in your case

globals.myGlobal = 1

will lead to

globals.myGlobal (module1) = 1
globals.myGlobal (module2) = 1

Hmmm.... this is really nice, you just need to take good care of it and you could cut the number of globals to half. First thing that comes to my mind is globlas.current_user that I use in almost all of my mods ending up with a lot of globals that are practically the same with a waste of memory and a increase of clutter in the solution.
My only doubt is: can things change in the future? I don't want to end up rewriting all my mods when Servoy 4.x ships... :?

Any official comments Servoyans?

Answer to what question, exactly? After all, solution and loaded modules simply act as one big solution. There has to be conflict resolution as far as global variables, methods and relations are concerned. If you define a method with the same name twice, you get a warning. If you define a global or a (global) relation twice, the have to be exactly the same and then they act as if they were defined only once. I don't really see where you have to coordinate several developers that much. If you decide to call a method from your solution in a module, then it is your decision. From Servoy's point of view it will work because Servoy "sees" only one big solution.

Robert Huber:
Hi All

I also would be interested in an answer, because I think this module concept is very weak and I am not sure if I should use it. Shouldn't modules be as much encapsulated as possible? May be with the exception of global variables. If people in a development team have to coordinate each other about every forms name, method name, etc. to be unique - huchhh, no so practical. If they are in the same location, it could be handled (but still not desired), but if they are in different locations, they have to coordinate about every name to be used, before using it!? I would like to see modules really encapsulated. What do others think?

Best regards, Robert

I use a lot of modules in my development even when working with another developer on the same solution, they're not perfect but the reusability of the code you write is definitly not to throw away. For the naming issue if you prepend the module name to all global variables and methods and to all forms names it's not so difficult to cohordinate 2+ developers). My naming scheme goes like this:

Module name: sintpro_images_mod
global var: sintpro_images_currentUser
global method: sintpro_images_startupMethod
form: sintpro_images_main

Using this scheme I am sure that:

1) the name of my company is the first word so my module can be used by other delevlopers without the risk of name duplication;
2) the module name is the second word so I can use my module in any solution without issues;
3) When I look at the forms list of a big solution I can determine at first glance to what module a form belongs;

Obviously any improvement from Servoy team is welcome but for the time being I'm quite happy with modules development.

  1. Add in that value list names need to be unique as well.

  2. Dealing with UI graphics in modules is quite problematic currently. I can give a whole litany on this if someone wants to listen.

In spite of the not-so-great current module implementation, we find them quite useful for the above stated reasons as well.

Servoy has mentioned in the past that they are working on a completely different way for multiple developers to collaborate on a single solution (much improved over modules apparently). Not sure where they are at in the process.

david:
1. Add in that value list names need to be unique as well.

  1. Dealing with UI graphics in modules is quite problematic currently. I can give a whole litany on this if someone wants to listen.

In spite of the not-so-great current module implementation, we find them quite useful for the above stated reasons as well.

Servoy has mentioned in the past that they are working on a completely different way for multiple developers to collaborate on a single solution (much improved over modules apparently). Not sure where they are at in the process.

Yep, I forgot value lists, and yes UI can lead to problems.
Let's wait and see what kind of bunny the dev team will throw out of their hat...

Hi,

each of my modules have a three-letter name such as acc, lmr, fmi, rep etc. Everything visible outside the module; forms, globals, global methods, value-lists, tables etc have names beginning with this prefix. This seems to work fine.

I do this for forms: modl_tbl_function1_function2if neccessary.
e.g., rcpt_cam_list is a list in the receipts module based on the campaigns table.

Since a module may have any number of tables, I have found it helpful to organize this way. So, for example, contacts and communications are visually separated in the Window menu- though they are in the same module.

Jim

I'm still feeling my way with the creation of my first module. So far, so good.

One of the side benefits to modules is simplification of lists of global variables, relationships, value lists, calculations, etc. Less clutter, more focus in a complex solution with many parts, as mine already is. Much easier and faster to program within.

I'm using a three letter convention to all my tables, both main solution and modules -- com for company, inv for invoice, etc. Within modules I'm adding "mod" to the end of form names, virtual list names, etc. That approach alone has prevented unique name clashes.

I've also discovered if you forget and actually do call something in the module by a name in current use in the main solution, Servoy will tell you the next time you launch the main solution. So in a practical every-day sense, the imperative for unique naming isn't so onerous.

However I do have one major beef about modules. It's been more than a year since they were introduced and we still don't have an example solution available for learning from. Something simple, demonstrating best practices with considerable commenting within. As a learning tool that's long overdue.

By the way, by experience I can report if you have a global variable in both the main solution and the module, the same value will appear in both. Most likely because there's only one global variable in memory.

I've also been able to navigate back from the module to the main simply by calling on a method located in the main solution which includes a "show form" function.

All this stuff must seem really obvious and junior to Servoy's developers but without an example solution it's hard to build up an understanding of the underlying architecture.

In practical terms, working with modules isn't that difficult -- so far. :D

Hi David

What can be done to avoid problems with UI graphics in modules. Could you give some more information to this aera, what to avoid or what to do when starting with modules.

Thanks, Robert

david:
1. Add in that value list names need to be unique as well.

  1. Dealing with UI graphics in modules is quite problematic currently. I can give a whole litany on this if someone wants to listen.

In spite of the not-so-great current module implementation, we find them quite useful for the above stated reasons as well.

Servoy has mentioned in the past that they are working on a completely different way for multiple developers to collaborate on a single solution (much improved over modules apparently). Not sure where they are at in the process.

In the TMI category:

http://www.servoymagazine.com/home/2006 ... nagin.html

Sebastiaan posted a comment to the above article and it contains the most thorough road map to date of what they are working on for us regarding modules. Good stuff! (It's not every day that you hear from Sebastiaan....)

http://www.servoymagazine.com/home/2006 ... #c14826395

david:
Sebastiaan posted a comment to the above article and it contains the most thorough road map to date of what they are working on for us regarding modules. Good stuff! (It's not every day that you hear from Sebastiaan....)

http://www.servoymagazine.com/home/2006 ... #c14826395

Sebastiaan, those are encouraging notes on the future. It's excellent to be kept informed about what's coming over the horizon. You're taking good care of us.