patterns.html 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><!--[if IE]><meta http-equiv="X-UA-Compatible" content="IE=edge"><![endif]--><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="Asciidoctor 1.5.4"><title>patterns</title><link rel="stylesheet" href="./asciidoctor.css">
  2. <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.5.0/css/font-awesome.min.css">
  3. <link rel="stylesheet" href="./coderay-asciidoctor.css"></head><body class="article toc2 toc-left"><div id="header"><h1>patterns</h1><div class="details"><span class="author" id="author"></span><br><span id="revnumber">version ,</span> <span id="revdate">2016/03/17 20:48</span></div><div id="toc" class="toc2"><div id="toolbar"><a href="https://github.com/jMonkeyEngine/wiki/edit/master/src/docs/asciidoc/jme3/advanced/atom_framework/design/patterns.adoc"><i class="fa fa-pencil-square" aria-hidden="true"></i></a><a href="https://github.com/jMonkeyEngine/wiki/new/master/src/docs/asciidoc/jme3/advanced/atom_framework/design/"><i class="fa fa-plus-square" aria-hidden="true"></i></a></div><div id="toctitle">Table of Contents</div><ul class="sectlevel1"><li><a href="#focus-in-design-patterns-and-paradigms">[Focus in] Design patterns and paradigms</a><ul class="sectlevel2"><li><a href="#programming-paradigms">Programming paradigms</a></li><li><a href="#game-programming-paradigms">Game Programming paradigms</a></li><li><a href="#design-patterns">Design patterns</a></li><li><a href="#design-patterns-in-game-developing">Design patterns in game developing</a></li></ul></li><li><a href="#design-patterns-in-jme3">Design patterns in JME3</a><ul class="sectlevel3"><li><a href="#push-or-pull">Push or pull ?</a></li></ul></li><li><a href="#design-patterns-in-atom">Design patterns in Atom</a></li></ul></div></div><div id="content"><div class="sect2"><h3 id="focus-in-design-patterns-and-paradigms">[Focus in] Design patterns and paradigms</h3><div class="paragraph"><p>This page is about design patterns, programming paradigms in game developing and those supported in AtomCore.</p></div>
  4. <div class="admonitionblock warning"><table><tr><td class="icon"><i class="fa icon-warning" title="Warning"></i></td><td class="content"><div class="paragraph"><p>This is <strong>NOT</strong> 1st Computer science class!! Understanding programming paradigms and patterns are very important to who want to do game programming, espeacially in Atom framework; which require <strong>very good</strong> knowledge of paradigms and patterns!</p></div></td></tr></table></div>
  5. <div class="sect2"><h3 id="programming-paradigms">Programming paradigms</h3><div class="paragraph"><p>Programming generally and programming languages usually designed toward a paradigm, but some of them are multi-paradigm also.</p></div>
  6. <div class="paragraph"><p><a href="http://en.wikipedia.org/wiki/Programming_paradigm">http://en.wikipedia.org/wiki/Programming_paradigm</a></p></div>
  7. <div class="paragraph"><p><a href="http://en.wikipedia.org/wiki/Comparison_of_programming_paradigms">http://en.wikipedia.org/wiki/Comparison_of_programming_paradigms</a></p></div>
  8. <div class="sect3"><h4 id="java-programming-language">Java programming language</h4><div style="text-align: left;" class="imageblock"><div class="content"><img src="http://upload.wikimedia.org/wikipedia/commons/thumb/a/a4/Java_logo_and_wordmark.svg/150px-Java_logo_and_wordmark.svg.png" alt="200" height=""></div></div>
  9. <div class="literalblock"><div class="content"><pre>*Java* is a computer programming language that is concurrent, class-based, object-oriented, (mostly) imperative, structured (also referred as strictly typed)</pre></div></div>
  10. <div class="paragraph"><p>emoji:sunglasses Suppose that when you read this wiki you already know what Java is (partly)</p></div>
  11. <div class="paragraph"><p><strong>Groovy</strong>…</p></div>
  12. <div style="text-align: right;" class="imageblock"><div class="content"><img src="../../../../wiki/groovy-logo.png" alt="200" height=""></div></div>
  13. <div class="paragraph"><p>is an agile and dynamic language for the Java Virtual Machine
  14. builds upon the strengths of Java but has additional power features inspired by languages like Python, Ruby and Smalltalk</p></div>
  15. <div class="paragraph"><p><a href="http://groovy.codehaus.org/">http://groovy.codehaus.org/</a></p></div>
  16. <div class="admonitionblock tip"><table><tr><td class="icon"><i class="fa icon-tip" title="Tip"></i></td><td class="content"><div class="paragraph"><p>Learn groovy: <a href="http://hub.jmonkeyengine.org/wiki/doku.php/jme3:scripting">http://hub.jmonkeyengine.org/wiki/doku.php/jme3:scripting</a></p></div></td></tr></table></div></div></div>
  17. <div class="sect2"><h3 id="game-programming-paradigms">Game Programming paradigms</h3><div class="paragraph"><p>Game framework or game engines also be comparasion (along with its programming language) into some category (not include graphics capacity):</p></div>
  18. <div class="sect3"><h4 id="by">By</h4><div class="paragraph"><p>Entity System</p></div></div>
  19. <div class="sect3"><h4 id="by-concurrent-capicity">By concurrent capicity</h4><div class="paragraph"><p>Active</p></div>
  20. <div class="paragraph"><p>Reactive</p></div>
  21. <div class="paragraph"><p>Interactive</p></div></div></div>
  22. <div class="sect2"><h3 id="design-patterns">Design patterns</h3><div class="paragraph"><p><a href="http://en.wikipedia.org/wiki/Software_design_pattern">http://en.wikipedia.org/wiki/Software_design_pattern</a></p></div>
  23. <div class="paragraph"><p><a href="http://sourcemaking.com/">http://sourcemaking.com/</a></p></div>
  24. <div class="paragraph"><p><a href="http://wiki.apidesign.org/wiki/Main_Page">http://wiki.apidesign.org/wiki/Main_Page</a></p></div></div>
  25. <div class="sect2"><h3 id="design-patterns-in-game-developing">Design patterns in game developing</h3><div class="paragraph"><p><a href="http://gameprogrammingpatterns.com/">http://gameprogrammingpatterns.com/</a></p></div>
  26. <div class="sect3"><h4 id="singleton-central-law-of-detemer">Singleton . Central . Law of detemer</h4></div>
  27. <div class="sect3"><h4 id="lightweight-decorator">Lightweight &amp; Decorator</h4></div>
  28. <div class="sect3"><h4 id="inversion-of-control">Inversion of Control</h4></div>
  29. <div class="sect3"><h4 id="factory">Factory</h4></div>
  30. <div class="sect3"><h4 id="mvc-mvc">MVC &amp; MVC?</h4><div class="paragraph"><p>MPV: Model View Presenter is the two way of
  31. MVC Model View Controller; where Presenter is the middle-man, the mediator between Model and View know and get notificated by both Model and View.</p></div>
  32. <div class="paragraph"><p>Talk about MVC first: Assume you know about web</p></div>
  33. <div class="paragraph"><p>from Wikipedia <a href="http://en.wikipedia.org/wiki/Web_application_framework#Push-based_vs._pull-based">http://en.wikipedia.org/wiki/Web_application_framework#Push-based_vs._pull-based</a></p></div>
  34. <div class="paragraph"><p><strong>Push-based vs. pull-based</strong></p></div>
  35. <div class="literalblock"><div class="content"><pre>Most MVC frameworks follow a push-based architecture also called “action-based”. These frameworks use actions that do the required processing, and then “push” the data to the view layer to render the results.[5] Struts, Django, Ruby on Rails, Symfony, Yii, Spring MVC, Stripes, Play, CodeIgniter, and Struts2[6] are good examples of this architecture. An alternative to this is pull-based architecture, sometimes also called “component-based”. These frameworks start with the view layer, which can then “pull” results from multiple controllers as needed. In this architecture, multiple controllers can be involved with a single view. Lift, Tapestry, JBoss Seam, JavaServer Faces, and Wicket are examples of pull-based architectures.</pre></div></div>
  36. <div class="paragraph"><p>MVC Push was born in the world of “none frequent” and not suite well for kind of application almost done update every-frame. So there is some kind of Event,Action embed on it.</p></div>
  37. <div class="paragraph"><p>MVC Pull in another hand, suite better for “frequent update” and assume that View is the one trigger the update call.</p></div>
  38. <div class="paragraph"><p>Back to real-time game, if you not making a chess game, almost you “are doing” a pull based MVC, or apply this pattern privately.</p></div></div></div></div>
  39. <div class="sect3"><h4 id="design-patterns-in-jme3">Design patterns in JME3</h4><div class="paragraph"><p>Here some analysing about patterns in JME3 world so Atom bypass or inherit them.</p></div>
  40. <div class="sect3"><h4 id="push-or-pull">Push or pull ?</h4><div class="paragraph"><p>worth to note:
  41. even some part of JME3 assemble MPV, it’s not the whole!
  42. also for a game, apply MPV is quite annoying and also tricky!</p></div>
  43. <div class="admonitionblock tip"><table><tr><td class="icon"><i class="fa icon-tip" title="Tip"></i></td><td class="content"><div class="paragraph"><p>Here is the twist: Actually in JME3, you are doing both, that’s why it look like MVP!</p></div></td></tr></table></div>
  44. <div class="paragraph"><p>because of this cycle</p></div></div></div>
  45. <div class="sect1"><h2 id="design-patterns-in-atom">Design patterns in Atom</h2><div class="sectionbody"></div></div></div><div id="footer"><div id="footer-text">Version <br>Last updated 2016-07-06 19:47:04 UTC</div></div></body></html>