June 22, 2009

Simplification of the puzzle prototype

Posted in Web tagged , , , , , , , at 11:36 pm by sagito

As mentioned before, I have been looking for a way of simplifying the puzzle architecture and encapsulate its functionality inside the Piece class. So now, in order to use this architecture, only two things are needed:

  1. Inherit the Piece class
  2. Call the Piece constructor with the Piece name. For example (from within a constructor): public _Default() : base(”Main Page Piece”) {}

Only two steps are required now! The data is automagically filled in by calling the update() function, which searches the whole page for the sections of code, whose name matches the one on the file. For example, if I have an entry “news” in the configuration file and a div called “news” in the .aspx file, then the information will be automatically filled in. The code was largely reduced by using this new technique!