Back to list
Views:   11.2K
Replies:  3

What pattern(s) to use for this system ?


I had another look at Design Pattern Framework 3.0 which I own, but without really finding what I need.

Rectangle is a "higher-level" type than Drawable, a user shouldn't need to call its SetData(), it does it for you.
That brings the question whether Rectangle should "have a" Drawable against being one but,
I want the user to be able to create its own Drawable objects and it'll be less work for derived types.

Any ideas ?

Thank you.
public abstract class Drawable
        private VertexBuffer _buffer;

        public abstract void Render();

        public void SetData()
                // Upload data to buffer

public class Rectangle : Drawable
        public Rectangle()
                // Sending an array of 4 colored vertices
                var array = ...

        public int X;
        public int Y;
        public int Width:
        public Height;

        public override void Render()
                // Render the object with OpenGL

Aybe Aybe, Jan 10, 2012
Reply 1
I fixed it, thank you.
Aybe Aybe, Jan 18, 2012
Reply 2
I didn't fully understand your question. But if your question whether Rectangle should "have a" Drawable then the answer will be yes. Drawable is low level and abstract. Like Shape which is low level abstraction of rectangle, triangle and others Drawable is also low level abstraction. 
Yes, user can create is own Drawable object
        Drawable rectangle = new Rectangle(); // Probably there is constructor params

SetData has no parameter in base but you are calling it with parameter from Rectangle. Seriously???
Please let me know the details what is confusing you and what do you want so that I can better help you.

Pradip Shrestha, Jan 17, 2012
Reply 3
I have found a free online barcode generator to make my own barcodesfor products and it is really convenient and useful. KEEPAUTOMATION Free OnlineCode Reader I just want to share it with you, everybody, maybe you can try itsomeday you may have a try someday.
Daisy White, Jan 11, 2012
my problem resolved ,tnx
Jul 29, 2012
Stay Inspired!
Join other developers and designers who have already signed up for our mailing list.
Terms     Privacy     Cookies       Do Not Sell       Licensing      
Made with    in Austin, Texas.  - vsn 44.0.0
© Data & Object Factory, LLC.