Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Another newb design question

Status
Not open for further replies.

BluesmanUK

Programmer
Dec 17, 2001
55
GB
Hi all,
Im a Flash developer, just starting to try out OOP actionscript development and like most beginners am more stuck on how to structure and design my program.

My problem is this: my app uses several different xml files as data sources (eg configuration xml, content xml, layout xml etc) Currently i have several classes loading and processing their own xml data, and its beginning to get very messy as xml paths are passed to constructors, and the similar xml loading/processing code is repeated across several classes etc.

I wondered what a better approach would be - I thought of having a separate generic "xml loader" class to do it all, but the problem is that for each xml file, the data needs to be processed and stored differently.

Any ideas would be appreciated!

cheers,
James
 
Very briefly, you can factor out common activities (checking file existence, loading it into the DOM, validating against the schema etc.) into methods in the superclass. Then handle the specifics with abstract methods that are implemented in the subclasses.

For a beginner, this is probably a good place to start. There are some design patterns you could use, but this may just confuse the issue for you at this stage.

Steve

[small]"Every program can be reduced by one instruction, and every program has at least one bug. Therefore, any program can be reduced to one instruction which doesn't work." (Object::perlDesignPatterns)[/small]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top