KAPSID – Neko's Blog

Form Follows Function

Pure MVC – Framework

If i just waited another week I would have neglected this blog for a whole month. Half way through this period of posting drought there was a puny attempt to write about the basics of isometric graphics. This was aiming to create an ongoing posting chain which was supposed to result in the creation of my own isometric mapping engine. Instead it stranded in the drafts list of this blog.

My current situation requires me to push my interests further down the road of code abstraction. As a newbie in OOP development one quickly feels pretty darn smart reading about programming methods like ‘Factory’ or ‘MVC’.

“Hey, I’m cool. Coz my shit is super abstract, mega dynamic and incredibly maintainable. Who cares if yours rotates in 3D?”

Turns out this is only the tip of the ice berg ( german phrase ). Have a read at PureMVC.org and make sure you have a look at their MVC structure diagram. PureMVC is a pretty successful open source framework which exists for a vast range of programming languages like C#, Java, JavaScript, Python, PHP and of course AS2.0 & AS3.0. It comes in two versions: Single and Multi Core. Which, in a nutshell, means: Make a framework, that has been developed to handle a large project, capable of combining multiple large projects ( multi core ) and make it become humongous. This happens by applying “name spaces” to the modules which are likely to utilize the same naming convention. I have spent the whole day reading through PureMVC’s classes and slowly the nebula starts to thin out.

PureMVC works with another layer of abstraction. In fact it is two. Firstly Model, View, Controller become Singleton classes. They administrate proxies, mediators and commands which once have been multiple models, views or controllers. Mediators and proxies now sit in between Singleton Model, View and individually designed UIs and Data Objects. They are responsible for the uniform execution of processes like registration, notification and so forth, which connect to the frameworks actual functionality. Furthermore does the introduction of these additional elements secure lose coupling and is therefore good OOP practice. The second new thing is another Singleton class called Facade. Facade serves as entry point to the application and as global and ubiquitous reference point to Model, View, Controller and therefore to all proxies, mediators and commands. This way classes only need to reference Facade and don’t have to import other classes from all over the place. Facade is the only class that knows much about the MVC mechanic. All others need to stay as oblivious as possible.

Having played around with MVC a little bit, PureMVC has already answered some of my reoccurring questions. From what I can see so far it appears to be a very powerful tool, which once mastered could add clean structure and efficiency to ones code but also pose a serious overkill to many other, smaller projects.

Subsequently, my initial confusion turns into strong curiosity.

Please feel free to correct me on my quick and rather lose summary of PureMVC.
Cheers

Gabor

Filed under: Design Patterns

Encapsulation & Loose Coupling

A blog post about good OOP practices.

I’m familiar with the core concepts of encapsulation and loose coupling, which find their application in design patterns like State,Strategy and MVC (Model View Controller). I have also successfully implemented them in some of my projects and appreciate their advantages like enhanced code flexibility through interchangeability and object expansion. Nevertheless do articles like this motivate me to repeatedly read about these two OOP principles. I intend to completely absorb the process of applying them into my everyday projects. I am only one step away. Have a look here.

Cheers

Gabor

Filed under: Design Patterns

MVC PATTERN – SUCCESSFUL

Today I’ve successfully transferred my current script into the preplanned MVC pattern, which works great. My application already became way more efficient and is less buggy. The animation is still a bit edgy (code is fixed but camera still runs on 6FPS) and the lens reflection of my projector gives me trouble. TBeta recognizes it as a blob and therefore interferes with my code…bugger. Have to find a way to reduce the reflection as much as possible. Next update tomorrow.

DSC07060

Filed under: Design Patterns, Software

MVC Design Pattern

img006

Filed under: Design Patterns, Visual Diary