{"id":216,"date":"2012-12-04T03:44:01","date_gmt":"2012-12-04T03:44:01","guid":{"rendered":"https:\/\/www.cores2.com\/blog\/?p=216"},"modified":"2012-12-04T03:44:01","modified_gmt":"2012-12-04T03:44:01","slug":"developing-a-windows-8-album-app","status":"publish","type":"post","link":"https:\/\/www.cores2.com\/blog\/?p=216","title":{"rendered":"Developing a Windows 8 Album App"},"content":{"rendered":"<p>I&#8217;ve recently written a little application for Windows 8&#8217;s Metro-App platform: let&#8217;s call it Win8 Apps platform for the sake of brevity. Metro isn&#8217;t new (Windows Phone came out a few years ago), but it&#8217;s now\u00c2\u00a0part of Windows 8,\u00c2\u00a0thus going to be widely adopted as the de-facto desktop interface. My application is a simple slide-to-navigate image album: it allows portrait and landscape images (without zooming &#8211; more on that later), and allows\u00c2\u00a0embedded\u00c2\u00a0videos. Touching video-images once plays a video, and touching it again pushes you back to the regular image album view. <a href=\"https:\/\/github.com\/nint22\/Win8AlbumApp\">Checkout the source code here at GitHub<\/a>, or just fork it and have fun making your own changes!<\/p>\n<p>After programming on Android and iOS for a few years, I can modestly judge that Microsoft is finally going in the right direction with their new Windows 8 App platform <strong>from the developer&#8217;s perspective<\/strong>. I can&#8217;t stress enough that my perspective written here is purely from a developer&#8217;s point-of-view, and not from a business or user&#8217;s view. I&#8217;ll go as far as saying that Metro isn&#8217;t the right GUI solution that the average user needs, though clearly computer interfaces and\u00c2\u00a0experiences\u00c2\u00a0absolutely need to be simplified, so in a sense Metro is a move in the right direction. Regardless, you can still flip to a classic desktop, so users aren&#8217;t forced to commit to anything. I wont go deeper into this subject, but solutions like <a href=\"http:\/\/www.google.com\/intl\/en\/chrome\/devices\/\">Google&#8217;s Chromebook<\/a>\u00c2\u00a0are the best approach for the average consumer (though enterprise solutions are still a Windows winner). The average computer user really just needs a browser, which has only become increasingly powerful as business apps (Office, Image editing, etc.) are\u00c2\u00a0popping\u00c2\u00a0all over the web.<\/p>\n<p>Now down to the core discussion: how is it to program in the new Win8 App\u00c2\u00a0environment?<\/p>\n<p>The Win8 App platform\u00c2\u00a0succeeds\u00c2\u00a0by implementing a\u00c2\u00a0clean platform and tool-suite: its\u00c2\u00a0new run-time environment, libraries, methodologies, and interfaces are all\u00c2\u00a0independent\u00c2\u00a0of\u00c2\u00a0one another and well modulated. All the classic .net languages (C#, VB, and VC++) are ready-to-go for app\u00c2\u00a0development\u00c2\u00a0 with the added new language Javascript! What&#8217;s particularly nice is each language embraces their respective strengths, but also doesn&#8217;t stray too far away from a general standard that the .net library provides. I felt that Javascript in particular overly embraced lambda-functions, but the end-result is always the same. The library namespaces make sense, though Microsoft (and this is a common fault with their past .net versions) has overly embraced object-oriented\u00c2\u00a0programing (OOP).<\/p>\n<p>There is almost an over-modularization of components and classes, an\u00c2\u00a0annoying\u00c2\u00a0fault also found in the Java SDK libraries. Something as trivial as setting how long an animation lasts should take a native type (float, for seconds). Instead, the type required is &#8220;Duration&#8221;, which can only be constructed with a &#8220;TimeSpan&#8221; object. Alternatively, you can construct &#8220;Duration&#8221; with a &#8220;TimeSpan&#8221; static function that converts seconds direction to a TimeSpan. Clearly these classes are needed in a variety of other applications, but not\u00c2\u00a0necessary\u00c2\u00a0for a simple argument like an animation&#8217;s time. This is only the tip of the iceberg; there are many, many other abuses like this, which I call &#8220;object-oriented verbosity&#8221;. Another frustration would be that over-abstraction of clases: the UIElement class (the base type for renderable \/ interactive screen elements) does not directly provide position or size, but instead provides a matrix which may or may not be a pointer to a specially-derived matrix with the properties you want. What this means is that if your UIElement is rotated and translated, but you have yet to define a size, the matrix object owned by UIElement will strictly only have the rotation and size properties. It is critically important for any GUI library to be as up-front and\u00c2\u00a0accessible\u00c2\u00a0as possible, regardless of backend or platform.<\/p>\n<p>Though the language-model\/library interface is a bit weak, at least the XML-language forms make up for crazy-easy development. Past platforms with Microsoft commonly had a form-modeling editor, like a GUI mockup system. With .net, you could place a button, double-click on it, and have code auto-generated for you! Microsoft has done this well, but the older form-editor were just visual tools, not something easily changed through text (a small difference, but a huge impact on development time!). Now I can\u00c2\u00a0cleanly\u00c2\u00a0move a button either in the GUI editor (now a\u00c2\u00a0separate\u00c2\u00a0tool!).\u00c2\u00a0Want to catch when a user clicks a button? Just set the button-tag&#8217;s &#8220;PointerPressed&#8221; property to the name of your function. All of this really conforms to the\u00c2\u00a0<a href=\"http:\/\/en.wikipedia.org\/wiki\/Model%E2%80%93view%E2%80%93controller\">Model\u00e2\u20ac\u201cView\u00e2\u20ac\u201cController<\/a>:\u00c2\u00a0often dismissed as boilerplate\u00c2\u00a0code, this approach to GUI-programming is incredibly important since mobile platforms (Win8 Apps included) re-use many screens and are quick to change forms, fits perfectly with what is required in development.<\/p>\n<p>An aspect that I couldn&#8217;t decide if it was good or bad was the inclusion of CSS style-definitions in GUI forms. XML, much like HTML, lays out a document&#8217;s content, but shouldn&#8217;t define how these elements look in-line since many styles are often repeated. Thus, a CSS file makes sense, yet, if the platform has\u00c2\u00a0committed\u00c2\u00a0to an alternative to HTML, why not commit to replacing CSS with a less verbose language? CSS is powerful, but often hard to read and\u00c2\u00a0maintain\u00c2\u00a0&#8211; it makes more sense to allow some sort of repeatable style definitions within the source XML, or at least have the ability to include other XML files in-line. Then again, if developing an Win8 App is more like developing a web app, at least there is a strong and large shared-base of knowledge all over the web.<\/p>\n<p>Overall, Microsoft has done a great job simply because they are\u00c2\u00a0committing\u00c2\u00a0to the right direction: cleaner developer tools, a new XML layout system, and all based on the powerful .net platform. There are\u00c2\u00a0apparent\u00c2\u00a0weaknesses, such as the difficulty of\u00c2\u00a0programmatically\u00c2\u00a0moving content, which is trivial for Android and iOS. Microsoft simply needs to refine the platform, improve documentation (it was pretty hard to distinguish between this new platform, code from older .net versions, and Silverlight APIs), and most importantly: get the average consumer using Windows 8!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve recently written a little application for Windows 8&#8217;s Metro-App platform: let&#8217;s call it Win8 Apps platform for the sake of brevity. Metro isn&#8217;t new (Windows Phone came out a few years ago), but it&#8217;s now\u00c2\u00a0part of Windows 8,\u00c2\u00a0thus going &hellip; <a href=\"https:\/\/www.cores2.com\/blog\/?p=216\">Continue reading <span class=\"meta-nav\">&rarr;<\/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":[1],"tags":[],"class_list":["post-216","post","type-post","status-publish","format-standard","hentry","category-news_updates"],"_links":{"self":[{"href":"https:\/\/www.cores2.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/216","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.cores2.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.cores2.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.cores2.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.cores2.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=216"}],"version-history":[{"count":0,"href":"https:\/\/www.cores2.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/216\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.cores2.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=216"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.cores2.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=216"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.cores2.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=216"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}