|Page 1 of 1||[ 3 posts ]|
I am trying to develop my programming style to write my YUI code in a much more modular/re-usable design as YUI promotes, although I keep finding myself unsure of where / how to do this properly!!
for example, my latest project:
I am developing an admin tool to manage the artists / art in an art gallery (and later I will also be writing code which may reuse some of this code to extract the gallery for the front end of the web site)
So on a particular page I envisage having some boxes representing artists. Each artists 'box' will list the different catalogue's of work that the artist has created, each catalogue having a body of art pieces.
Now I could code all this stuff, the DOM manipulation the AJAX calls etc. using YUI no problem. But I really want to focus on my design principles and get this done ELEGANTLY which is where I am struggling. Anyway so I am thinking to use Y.Model, Y.ModelList and Y.View, then maybe I could re-use the models and create a different Y.View for the front end of the web site.
So, the pieces of art will be built using Y.Model.
If I group pieces of art together can I then create a Catalogue as a ModelList? Would they need to be a Model too, can they be both? Since catalogues will have titles, descriptions, owners (artist) etc..
So carrying on somewhat...
The Catalogues will be a ModelList for Y.artPiece
The Artists will be ModelLists for the Catalogues
Then I will have a ModelList for the Artists.
Now I am wondering, how to load and sync the data, and if I should do this in one AJAX call and build the Model Lists from the nested JSON, or what? Should I map different dataSchemas onto the same nested data and build each Model, ModelList separately, or should I build the Models / ModelLists of each other?
Also each Model requires a sync function which will hook into the database, how could I write a re-usable class that I can then add as an extension on each of the models I create, otherwise I am writing a whole heap of similar code?
I will want to create a datatable of of the data view too. Looking forward to 3.5 I am thinking I could render this of the Models.
I know this should be a simple problem and I am somewhat confused! so if anyone could help me on how to tackle this from a design / architectural point of view I would be very grateful.
Hope its not too big an ask to be pointed in the right direction.
Still awaiting any advise on how to design / model elegant YUI code !! but meanwhile I have stumbled on Model Relate in the Gallery which looks like its perfect for this job. Any one looking to use models with to many or to one relationships between each other should check this out.
Also, with regards to abstracting the DB communications for the models, I have also stumbled on this forum topic:
So I guess between my latest 2 finds I may be able to set my self straight here...Hopefully these few self-answered posts may benefit others!!
|Page 1 of 1||[ 3 posts ]|
|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