Design for Graphic Rendering in Java with Unspecified Update Reasons (Hierarchical) -


  • original question

    i'm working graphic rendering part of program, , got several severe problems previous design.

    so, want ask how design structures of renderers , models. or there specific design pattern handle case?

    currently have hierarchical implementations of

    • renderers (graphics)
    • models (data render, receive updates)

    i accepted hierarchy since rendered contents can classified, , should managed separately.

    there several limiting conditions:

    1. rendering done on rendering loop.
    2. there many types of renderers , models, , design should not aware of them.
    3. there various reasons update models.
      1. update reasons should not specified in design itself, since various reasons can added.
      2. models aware of possible update reasons itself.
    4. renderers have render passes , render helpers.
      1. types of render passes dependent classes(groups) of renderers.
      2. render helpers should provided, , each renderer should able use different version of it.

edit: code explain current situation.

renderer:

public interface irenderer<settings, pass, model, helper> {     public void initialize(settings settings);     public void prerender(settings settings, helper info);     public void renderpass(model model, pass pass, helper info);     public void postrender(settings settings, helper info); } 

model:

public interface imodel<settings, updateinfo> {     public void initialize(settings settings);     public void update(settings settings, updateinfo update); } 

edit2: since update reasons not specified , can contain various information, have problem updating model.

specifically, type of update information varies each update reason, makes hard check types in compile time.

(if helps, update information contain

  • changed settings settings change
  • updated data user interaction
  • spontaneous changes system loop

and on)

how should control update part here? there design pattern solve problem , let code cleaner?


Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -