hi

For event handling what Ive done is rather then have 5 different
functions change the state of 10 diffferent objects I create a class
attribute that those 10 items depend on and use the handlers to change
the state of the objects. That way when I need to tweak something I
dont have to change it in 5 spots only in 1. Try also to make use of
states, they kick ass !

I try to build a new class if any of the following are true
The size of the class that I am working on exceeds 800 lines
The class retreievs data from more then 1 dataset
Or it is a usefull control that I will use throughout the app.

Usually when the class gets so large it is easy to split up since
(like yours) it will probably be multitabbed and such. So then you
peel off a couple of tabs by reducing the contents to classess, you
can tie the contents together using a local dataset or attributes.

In generally then my files and directory structure are looking like

doa_main.lzx <- my main file menubar and commands includes doa
doa/doa.lzx         <- My "root" object class (name="doa")
doa/doa_preferences.lzx <- preference class (name="doapreferences")
doa/doa_preferencestab1.lzx <- preference class tab 1
(name="doapreferencestab1")
doa/doa_preferencestab2.lzx <- preference class tab 2
(name="doapreferencestab2")
doa/doa_objects.lzx <- general purpose objects
doa/doa_resources.lzx <- resources
doa/library.lzx          <- All lzx files in this folder
doa/images/

Oh ya and test files which invoke sections of your code are of key
importance. These should contain enough information to demonstrate the
functionality of the class you are working on like a static dataset
and a canvas and the instance of the class you are testing.
doa/test-doa_preferences.lzx
doa/test-doa_preferencestab1.lzx
doa/test-doa_preferencestab2.lzx

(doa = dead on arrival ;)

Anyways just my 2 cents...

z


On 9/15/06, James Howe <[EMAIL PROTECTED]> wrote:
> I've been working with OpenLaszlo off and on for a few months.  Overall
> I like it, but I've never been happy with the way my code is organized.
> I'm used to working in Java where I can easily refactor code off into
> classes or break long code up into multiple methods.  My IDE helps me
> find and focus on just the piece of code that I want to work on.  With
> my Laszlo applications, I feel that I'm writing giant blobs of code
> although when I stop and look at it, I'm not sure that breaking it up is
> reasonable.
>
> I think some of this has to do with the verbosity of XML and when you
> mix XML with JavaScript code things can get pretty ugly, particularly
> since IDE support (in my opinion) is a bit week.  I'm also sure that
> some of this also has to do with the fact that I haven't really figured
> out a good way to work with Laszlo code.  I'm wondering if other people
> have felt the same way and have come up with good ways to reorganized
> their code?
>
> For example, I've got a 'dialog' which visually consists of a view
> containing two tabs.  Each tab contains a list (or two) of items derived
> from a dataset.  The list items themselves have several parts (checkbox,
> text, editable text, etc.)  There is also some behavior which is
> associated with these objects.  Things need to happen when items are
> selected, buttons are pushed, etc.  Right now all of this resides in one
> LZX file.  I've looked at breaking things up, creating classes for some
> of the pieces, but for the most part the things I would group together
> are only used once.  What I would end up with is a bunch of files with
> basically the same code I have now and I'm not sure it would be any
> easier to work with.
>
> Anyway I'm just wondering how other people are structuring their code to
> avoid creating overly dense program files.
>
> Thanks!
> --
>   James Howe
>   [EMAIL PROTECTED]
>
>
> _______________________________________________
> Laszlo-user mailing list
> [email protected]
> http://www.openlaszlo.org/mailman/listinfo/laszlo-user
>

_______________________________________________
Laszlo-user mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-user

Reply via email to