Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

Decorator logic

 
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)
 
Thread Tools Search this Thread
  #1  
Old 11-13-2019, 12:46 PM
  vasilis's Avatar 
vasilis vasilis is offline
 

X-Adept
  
Join Date: Feb 2009
Posts: 758
 

Default Decorator logic

I have been reading about the Decorator logic in the old LiteCommerce software, in this page where there is the following text:

Quote:
Decorator's primary purpose is to support the extensibility of the functionality through class inheritance. In particular, solving the problem described in the previous chapter. It renames classes in the inheritance chains so that the application begins to use the extending class too. Suffix “Abstract” is appended to the base class name, and an empty dummy class with the original base class name is inherited from the custom class. Example:

Core code: SomeCoreClass (base class) -> SomeCustomClass extends SomeCoreClass (custom class)

Generated cache: SomeCoreClassAbstract (renamed base class) -> SomeCustomClass extends SomeCoreClassAbstract (custom class) -> SomeCoreClass extends SomeCustomClass (blank dummy class)

Thus, the functionality of the custom class gets into the base (modifyable) class.

Does the same logic exist for X-Cart 5 as well, or has it changed ?
Reply With Quote
  #2  
Old 11-13-2019, 04:40 PM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,190
 

Default Re: Decorator logic

Forget about this LiteCommerce code there. This is what XC started at first and based all XC5 on it. That's why XC5 code is full with 'LC' references.

However in general yes this also applies to XC5.

I'd suggest to start here - https://en.wikipedia.org/wiki/Decorator_pattern - and similar articles. Also examine the code under classes and same under var/run/classes to see how it is done.
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote
  #3  
Old 11-13-2019, 10:49 PM
  vasilis's Avatar 
vasilis vasilis is offline
 

X-Adept
  
Join Date: Feb 2009
Posts: 758
 

Default Re: Decorator logic

Steve, I have actually read quiet a few stuff about PHP patterns and especially Decorator, Singleton, Factory patterns from a couple of books and various articles. (To anyone seeking to delve into PHP patterns, I would highly recommend the 'PHP Objects, Patterns, and Practice', Apress 3rd Edition by Matt Zandstra and the 'Learning_PHP_Design_Patterns' by William Sanders, O'Reilly editions). Also the specific wikipedia article that you suggested, has a nice schematic on the decorator pattern and a comprehensive definition.
Quote:
However in general yes this also applies to XC5.
so this logic applies to XC5 in general. Actually, I reckon that these LiteCommerce developer articles in GitHub are good articles for someone to start delving into the programming logic of XC5 and then go on to the developers's - unfortunately fragmentary - knowledgebase articles, in x-cart's site. These articles are characterized by more or less recipe-type of presentation, rather than presenting the full logic in a structured way, in contrast to the developer's knowledgebase presentation of other popular eCommerce platforms.

Quote:
Also examine the code under classes and same under var/run/classes to see how it is done.
One thing I noticed is that the cached code has various view classes for example of it's modules renamed, with the suffix 'Abstract' added to their name, as described in the LiteCommerce dev. articles. I will search for any other differences between the two codes, if this is what you mean.
Reply With Quote
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 02:11 AM.

   

 
X-Cart forums © 2001-2020