
{"id":1386,"date":"2014-12-17T22:16:13","date_gmt":"2014-12-17T22:16:13","guid":{"rendered":"http:\/\/www.codergears.com\/Blog\/?p=1386"},"modified":"2015-01-19T21:14:26","modified_gmt":"2015-01-19T21:14:26","slug":"lesson-to-learn-at-the-25th-anniversary-of-prince-of-persia","status":"publish","type":"post","link":"https:\/\/codergears.com\/Blog\/?p=1386","title":{"rendered":"Lesson to learn in the 25th anniversary of &#8220;Prince of Persia&#8221;"},"content":{"rendered":"<p>Prince of Persia is a fantasy platform game, originally developed by Jordan Mechner and released in 1989 for the Apple II, that represented a great leap forward in the quality of animation seen in video games.\u00a0On Apr 17, 2012 Jordan Mechner\u00a0<a href=\"https:\/\/github.com\/jmechner\/Prince-of-Persia-Apple-II\">released the source code<\/a>\u00a0of Prince of Persia.<\/p>\n<p>Many gamers remember this amazing game, and maybe some of you played with it for many months.<!--more--><\/p>\n<p><a href=\"http:\/\/www.codergears.com\/Blog\/wp-content\/uploads\/pp0.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1394\" src=\"http:\/\/www.codergears.com\/Blog\/wp-content\/uploads\/pp0.jpg\" alt=\"pp0\" width=\"256\" height=\"160\" \/><\/a><\/p>\n<p>The\u00a0developers\u00a0of\u00a0\u00a0these days\u00a0r<span style=\"color: #5b5b5b;\">emember\u00a0there was a time when a typical personal computer might have an 8 Mhz processor, 1 megabyte of memory, a 20 megabyte hard disk, and a floppy disk drive. It was a big challenge to develop a game like Prince of Persia.<\/span><\/p>\n<p>Moreover in those days, Google was not there to help developers resolve their technical issues quickly; some technical problems could take the developers many days to fix them. And the cherry on the cake was developed using 6502 assembly language.<\/p>\n<p>However, with all these constraints, the source code is well implemented:<\/p>\n<ul>\n<li>It&#8217;s \u00a0modularized using directories and files:<\/li>\n<\/ul>\n<p>Modularity is a software design technique that increases the extent to which software is composed from separate parts, you can manage and maintain modular code easily.<br \/>\nPrince of Persia was modularized \u00a0using directories and files, this modularity is provided by the operating system and can be applied to any language.<\/p>\n<p>The code is splitted into many files, here&#8217;s a list of some of them:<br \/>\n<a href=\"http:\/\/www.codergears.com\/Blog\/wp-content\/uploads\/pp6.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1401\" src=\"http:\/\/www.codergears.com\/Blog\/wp-content\/uploads\/pp6.png\" alt=\"pp6\" width=\"641\" height=\"524\" \/><\/a><\/p>\n<ul>\n<li>The naming is\u00a0easy to understand<\/li>\n<\/ul>\n<p>When exploring the source code, you don&#8217;t find variable names such as\u00a0a, b or x, like many recent developed projects. The names are well chosen and no need to comments to explain why we need them.<\/p>\n<p><a href=\"http:\/\/www.codergears.com\/Blog\/wp-content\/uploads\/pp2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1390\" src=\"http:\/\/www.codergears.com\/Blog\/wp-content\/uploads\/pp2.png\" alt=\"pp2\" width=\"540\" height=\"313\" \/><\/a><\/p>\n<ul>\n<li>\u00a0The code is splited into many small subroutines<\/li>\n<\/ul>\n<p>The\u00a06502 assembly language is very low level, and to make the code easier to understand and maintain, the &#8220;Divide and Conquer&#8221; principle is applied. Indeed the code is splitted into many small subroutines, what makes them easy to read and maintain. Here&#8217;s an\u00a0example of a small subroutine defined in its source code:<\/p>\n<p><a href=\"http:\/\/www.codergears.com\/Blog\/wp-content\/uploads\/pp3.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1391\" src=\"http:\/\/www.codergears.com\/Blog\/wp-content\/uploads\/pp3.png\" alt=\"pp3\" width=\"560\" height=\"306\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>Even If \u00a0in 1989 many\u00a0constraints complicated the task for developers,\u00a0the code is very well implemented. So why in 2014 with \u00a0powerful computers, powerful languages, Many thousands of libraries and Google, some\u00a0projects are bad implemented ?<\/p>\n<p>Languages and frameworks are just tools to build applications, but the main actor is the developer. You can use the best language, the best frameworks and produce a bad code.<\/p>\n<p>Many practices to make the code clean \u00a0are not language dependent. A good developer must have\u00a0the\u00a0good\u00a0sense and make its code clean and easy to understand whatever the language used.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Prince of Persia is a fantasy platform game, originally developed by Jordan Mechner and released in 1989 for the Apple II, that represented a great leap forward in the quality of animation seen in video games.\u00a0On Apr 17, 2012 Jordan Mechner\u00a0released the source code\u00a0of Prince of Persia. Many gamers remember this amazing game, and maybe &hellip; <a href=\"https:\/\/codergears.com\/Blog\/?p=1386\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Lesson to learn in the 25th anniversary of &#8220;Prince of Persia&#8221;&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-1386","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/codergears.com\/Blog\/index.php?rest_route=\/wp\/v2\/posts\/1386","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/codergears.com\/Blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codergears.com\/Blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codergears.com\/Blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codergears.com\/Blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1386"}],"version-history":[{"count":19,"href":"https:\/\/codergears.com\/Blog\/index.php?rest_route=\/wp\/v2\/posts\/1386\/revisions"}],"predecessor-version":[{"id":1406,"href":"https:\/\/codergears.com\/Blog\/index.php?rest_route=\/wp\/v2\/posts\/1386\/revisions\/1406"}],"wp:attachment":[{"href":"https:\/\/codergears.com\/Blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1386"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codergears.com\/Blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1386"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codergears.com\/Blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1386"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}