Click here to register.
      
Bazaar


     Update of UsersOnline Macro for WebGUI 7.4 > Re: Update of UsersOnline Macro for WebGUI 7.4

Update of UsersOnline Macro for WebGUI 7.4

User bernd
Date 8/10/2008 3:03 am
Views 872
Rating 0    Rate [
|
]
Previous · Next
User Message
bernd

I just posted an update of the UsersOnline macro to the "Get Add Ons" section. It can be used for displaying users that are online.

Maybe some of you are willing to test. Since I am a perl newbie and this is my first macro I would be particularly interested in comments on the code. But suggestions for further improvements and bug repors are also welcome.

Eventually, I will try to get this into the core. However, I need to check guide lines for submission first.

Bernd

--
Administrator of a non-profit community portal for free-climbers around Magdeburg/Germany. Check out http://www.klettern-md.de.



Back to Top
Rate [
|
]
 
 
knowmad

Hi Bernd,

Thanks for updating the macro. Although I haven't used it, it's nice to know it's available and up-to-date. I have not tested it, but looking at the code, it looks solid. There are a few places were you could refactor it for readability but overall I don't see glaring issues.

The one deficiency I do see is automated tests for it. I've recently written an Activity with testing which required breaking out the operations into separate subroutines. This actually made the code not just more testable, but also far more readable than when I had stuffed all my logic and operations into one long method call. I'd be glad to share my test or you can just look in WebGUI/t for lots of examples.

 

Cheers,
William

----
Knowmad Technologies
http://www.knowmad.com



Back to Top
Rate [
|
]
 
 
bernd

Hi William,

thanks for your comments. By "refactor it for readibility" do you mean that I should break the code down into several subroutines? If that is the case I will do it for the next release.

Concerning tests, I have read in that they are mandatory for inclusion into the core. I am going to have a closer look at testing functions soon. Should not be a problem either. I further plan to provide a help module for documentation of template variables.

Is there anything else that needs to be done? JT?

--
Administrator of a non-profit community portal for free-climbers around Magdeburg/Germany. Check out http://www.klettern-md.de.



Back to Top
Rate [
|
]
 
 
knowmad

Hi Bernd,

Breaking your code into subroutines is partly what I meant, but let me give you some examples of refactoring for readability. Instead of writing

    $minutes = 5 if ($minutes eq "");
    $maxMembers = 10 if ($maxMembers eq "");

use

    $minutes ||= 5;
    $maxMembers ||= 10;

These are Perlism's that make your code easier for Perl programmers to read*. Another example is when you iterate through the rows. Instead of using a counter that is never needed other than for the loop, use a while loop such as:

while (my %row = $result->hash) {

That eliminates code and makes it very clear what you are doing.

 

Keep up the efforts,
William

* There are some caveats to this technique which have been addressed by the new defined-or (//=) operator in Perl 5.10. This should not affect your code as it stands (and should not be used with WebGUI as it must be compatible with 5.8.x).

----
Knowmad Technologies
http://www.knowmad.com



Back to Top
Rate [
|
]
 
 
JT
> Is there anything else that needs to be done? JT?
>

If the code works, adheres to our best practices (including i18n,  
templates, help, and tests), then I don't see why we can't include it  
into the core for 7.6. However, we are asking that all outside  
contributions be supported by the contributor for one year after the  
submission, just to make sure the kinks are worked out. Can you commit  
to that?



JT Smith
ph: 703-286-2525 x810
fx: 312-264-5382

Create like a god. Command like a king. Work like a slave.



Back to Top
Rate [
|
]
 
 
bernd

Hi William,

I have have changed the code according to your recommendations. In addition, there is a help module now. I have posted an update in the "Get Add Ons" section. Next, I am going to work on testing.

Bernd

--
Administrator of a non-profit community portal for free-climbers around Magdeburg/Germany. Check out http://www.klettern-md.de.



Back to Top
Rate [
|
]
 
 
knowmad

Next, I am going to work on testing.

++

----
Knowmad Technologies
http://www.knowmad.com



Back to Top
Rate [
|
]
 
 

Recent Discussions Color Key

Design:

Development:

Et Cetera:

Install/Upgrade:  

Smoketest:

Template Group:


Re: Site paid for by advertizing by Klaus - Fri @ 02:27am

Smoke Test for WebGUI (Stable) (2008-11-21) by botaction - Fri @ 12:37am

Re: Site paid for by advertizing by pwrightson - Thu @ 10:59am

Re: Site paid for by advertizing by JT - Thu @ 08:58am

Re: Regelmäßiger Termin für Usertreffen in der Rhein-Neckar-Region by Klaus - Thu @ 06:11am

Smoke Test for WebGUI (Stable) (2008-11-20) by botaction - Thu @ 12:00am

Smoke Test for SVN (2008-11-20) by botaction - Thu @ 12:00am

Re: Improving page layouts by fdillon - Wed @ 08:38pm

Re: Improving page layouts by knowmad - Wed @ 08:25pm

Re: Site paid for by advertizing by knowmad - Wed @ 08:07pm

Re: SSL Configuration? by knowmad - Wed @ 07:51pm

Re: The Death of the Collaboration System by preaction - Wed @ 07:39pm