Thursday, August 05, 2010

First draft of Object storage

The code can be downloaded at: http://www.box.net/shared/9i4g3mbo5m

Note that the code is a draft and while it does compile in VS2010, it has not been tested very much.
Its just to show the direction I am taking with the Component based programming code.
The licence is public domain and Screens is staying that way for the foreseeable future.

I am now working on the component CoreShadow which allows a component to link
to another component instance of a different component without controlling the linked component instance life-cycle but still not having a dangling pointer. The idea is that components only really control their own instances, not instances of other components unless they are maintained by the component instance itself.

This is dynamic association. CoreObject allows to attach different components together to form an object. Components can be attached or detached from objects, or sent dynamically bind messages to them. All written in native C with no macros. Why use component based objects? It allows to add or remove functionality from objects at run-time with data. Most other languages support adding interfaces but not adding data dynamically. Component based programming using the attached files allows to add also an interface and data to any object.

Because the association is done at run-time, components do not need to be created just because the associations are slightly different. Components are like classes in Java/C++ but do not use inheritance but rather association. Whats the difference? "Inheritance = is a relationship" while "Association = use a relationship". Its a subtle but powerful difference. Instead of deriving types, an object is a combination of different types that together form a single concept.

I know that this is not a known programming relationship but I will explain it better as time goes on.
Meanwhile feel free to peak into the code and enjoy.

2 comments:

Alphasmart User said...

Sweet! Anything unknown and new in programming I guess could unlock LOTS of new and interesting stuff!

Congrats on the new object storage! The fact that you found this one worthy of being uploaded is a good sign of things to come!

May you have the best of luck.

Zakai Hamilton said...

Thanks for your support over the years. It took me along time to upload because the design has been constantly changing dramatically. This is the first design that has not been rewritten for the last few months.