{"id":1911,"date":"2019-01-18T14:20:19","date_gmt":"2019-01-18T14:20:19","guid":{"rendered":"http:\/\/dlang.org\/blog\/?p=1911"},"modified":"2021-10-08T11:03:16","modified_gmt":"2021-10-08T11:03:16","slug":"d-lighted-im-sure","status":"publish","type":"post","link":"https:\/\/dlang.org\/blog\/2019\/01\/18\/d-lighted-im-sure\/","title":{"rendered":"D-lighted, I&#8217;m Sure"},"content":{"rendered":"<p><img loading=\"lazy\" class=\"alignleft size-full wp-image-180\" src=\"http:\/\/dlang.org\/blog\/wp-content\/uploads\/2016\/08\/d3.png\" alt=\"\" width=\"160\" height=\"301\" srcset=\"https:\/\/dlang.org\/blog\/wp-content\/uploads\/2016\/08\/d3.png 160w, https:\/\/dlang.org\/blog\/wp-content\/uploads\/2016\/08\/d3-159x300.png 159w\" sizes=\"(max-width: 160px) 100vw, 160px\" \/>For me, finding D is the most recent step along a road winding back at least a dozen years. I\u2019d been searching for a cross-platform development language\/environment (POSIX and Windows, but not so much mobile since my search began before mobile was really a thing) and at this point, D fits better than anything else I\u2019ve tried. I won\u2019t go out on a limb and say it\u2019s the Holy Grail of X-Plat, but at the very least, it\u2019s brought some fun back into coding for me. And whenever I massage a hunk of code until it finally works\u2026 well, I\u2019m addicted to those little victories.<\/p>\n<h2 id=\"the-road-to-d\">The Road to D<\/h2>\n<p>The first language I tackled back in the mid-oughts to meet this end was PHP. I\u2019d been a web developer for a few years when I found out that PHP had a standalone desktop version. When I then stumbled across <a href=\"gtk.php.net\">Andrei Zmievski\u2019s PHP-GTK<\/a>, lightbulbs went on and fireworks went off. For a while. The big drawback I found with PHP-GTK was that no PHP compiler could handle the GTK end. So after a few years of patiently hoping someone would tackle this while I wrote nearly 40 blog posts on its use, I started looking elsewhere.<\/p>\n<p>Back in the 1990\u2019s, I\u2019d been steeped in Javascript and HTML, writing simple online apps for banking clients out of Vancouver, BC and later, Bancroft, Ontario. With such a background, when <a href=\"https:\/\/electronjs.org\/\">I ran across Electron<\/a> a few years ago, it seemed like a good fit. I assumed learning it would be easy-peasy-lemon-squeezy, but a lot about the nature of web development languages had changed. To boot, several more languages, standards, and paradigms had been thrown into the mix, so to say the least, I found it all confusing and more than a little intimidating. What I really wanted was one language, an easy distribution system, and a GUI toolkit that didn\u2019t necessitate balancing style sheets with front- and backend code as well as JSON files. And Electron, unfortunately, needs to drag Chromium along for the ride in a little metaphorical red wagon. It\u2019s a solution, but not the one I was looking for.<\/p>\n<p>Then last year, I stumbled onto D. I\u2019d been hearing about it for years, but I hadn\u2019t read much about it. I didn\u2019t realize it was available across so many POSIX platforms. I also didn\u2019t realize it embraced the OOP paradigm and so hadn\u2019t given it much thought. I liked the subtle humor of D being next in line after B, C and A (which oddly enough came along later than B and C), but after a brief smile, I paid no more attention until last October.<\/p>\n<p>When I finally took a good look, I realized that with its curly braces and OOP propensity, D runs right up my street. But before rolling up my sleeves, I made sure there was a GUI toolkit I could use, something that didn\u2019t necessitate balancing three differing paradigms at once. I found <a href=\"https:\/\/wiki.dlang.org\/Libraries_and_Frameworks#GUI_Libraries\">a list of GUI toolkits<\/a> on the D Wiki and was gratified <a href=\"https:\/\/gtkd.org\/\">to see GtkD among them<\/a>. So for the last two plus months, I\u2019ve been putting most of my effort into learning how D and GtkD work together.<\/p>\n<h2 id=\"persperation-and-refreshments\">Perspiration and Refreshments<\/h2>\n<p>It may or may not be important to know this, but I don\u2019t have a CS degree. I\u2019m completely self-taught, a process that started while stuck in the middle of a frozen nowhere for three weeks more than 30 years ago. But that\u2019s a whole other story. My point is, there are holes in my education. That\u2019s what happens when you follow your nose instead of a syllabus.<\/p>\n<p>Because of that, some of the intricacies of D elude me and may always do so. Although I\u2019ve read Ali \u00c7ehreli\u2019s chapter on the subject (<a href=\"https:\/\/ddili.org\/ders\/d.en\/index.html\">from Programming in D<\/a>) I have no idea what mixins are or why I\u2019d want to use them. And templates seem like a good idea, but I don\u2019t know why. I blame my lack of formal CS education for this, but I\u2019m quite comfortable with classes and objects, so I\u2019m not sweating it.<\/p>\n<p>I was first introduced to OOP and the Gang of Four when I was learning PHP, so D covers familiar territory in that regard. Curly braces are another thing I feel quite at home with, having used them for most of my programming life.<\/p>\n<p>But I\u2019m finding the familiarity of D to be a bit of a stumbling block as well. It\u2019s just different enough from C and PHP to mean I have to work hard at pounding those differences into my brain. I deal with it through rote typing of example code. I figure if I copy out enough D code instead of lazing along with copy-n-paste, eventually I\u2019ll push C and PHP far enough into the background that I can see past them. And I <a href=\"https:\/\/gumroad.com\/l\/PinD\">keep Mr. \u00c7ehreli\u2019s book handy<\/a> so I don\u2019t go completely off the rails. It\u2019s been quite helpful. And speaking of helpful\u2026<\/p>\n<h2 id=\"the-ecology-of-d\">The Ecology of D<\/h2>\n<h3 id=\"forums\">Forums<\/h3>\n<p>So far, I\u2019ve signed up for two D-oriented forums, <a href=\"https:\/\/forum.dlang.org\/\">one at dlang.org<\/a> and <a href=\"https:\/\/forum.gtkd.org\/\">the other at gtkd.org<\/a>. I have yet to find an unfriendly avatar. Everyone I\u2019ve encountered seems willing to jump in and help. To contrast these forums with one I\u2019ve been active on for a few years (not mentioning names, but this other forum is related to art and graphics, not programming) on the D forums I haven\u2019t been insulted, nor have I been questioned for looking at things from a (warning: film term) Dutch angle&#8212;which is one of the things I do best. That comes from my art background, I suspect. I was quite the rabble rouser in art college. (Just ask Alan Wood the installation artist about our knock-down-drag-out shouting match in the cafeteria of Emily Carr College if you don\u2019t believe me. But again, that\u2019s a whole other story.)<\/p>\n<p>On dlang.org, I mostly hang in <a href=\"https:\/\/forum.dlang.org\/group\/learn\">the Learn sub-forum<\/a>, which I suppose is only natural at this stage. It\u2019s probably the most polite bunch I\u2019ve run across on a forum ever, and I\u2019ve been frequenting forums since the hoary days of the BBS when 1200 BAUD was lauded as the fastest thing since the 427 hemi.<\/p>\n<p>Mike Wey seems quite patient for someone who answers more-or-less the same question over and over again on the GtkD forum. The only negative I found with that forum was technical. I signed up, made some posts, and when I went back to sign in a second time, I had to reregister. But I was still identified as the same Ron Tarrant who signed up the first time (I think) so perhaps that\u2019s how things are supposed to be. It\u2019s unusual, but it works.<\/p>\n<p>I will also mention that the GtkD documentation pages are a mind-bender, but because this is where I\u2019m planning to spend a lot of time over the next while, I\u2019ve decided to pitch in and help make things more accessible.<\/p>\n<p>I\u2019m drawing on experiences writing my PHP-GTK blog back in 2006 and porting a bunch of code examples and tutorials into GtkD. I went so far as to buy a domain name (<a href=\"http:\/\/gtkdcoding.com\/\">gtkDcoding.com<\/a>) in preparation for launching a site and blog covering all this. That\u2019s how I deal with learning curves and have done since I wrote that series of BASIC tutorials for my sister while freezing in a Newfoundland outport back in 1985.<\/p>\n<h3 id=\"tools\">Tools<\/h3>\n<p>I got up and running with dmd quite quickly. Installation on Windows 10 and FreeBSD was straightforward. A few quick questions on the D forum, and I had everything I needed to do single- or multi-file projects. A few more questions answered on the GtkD forum and I was comfortable enough to start porting my PHP-GTK code.<\/p>\n<p>But I have to say, <a href=\"https:\/\/dub.pm\/getting_started\">DUB eludes me<\/a>. I don\u2019t know if it\u2019s because Electron left me feeling like JSON files are a disgruntled engineer&#8217;s revenge plot or if it\u2019s just the way my brain works. Perhaps if I put my mind to it, I could learn it, but since I\u2019m getting the results I want from <a href=\"https:\/\/dlang.org\/download.html\">plain ole dmd<\/a>, I\u2019ve done no more than skim DUB\u2019s docs up until now. Just for the record, back in my C days, make files were a caution for me, too. I eventually licked them, and if it ever becomes important enough to me to figure out DUB, I guess I will. But for now, my heart\u2019s not in it.<\/p>\n<p>Finding a text editor that supports D (and especially GtkD) syntax highlighting rather than\u2014as a few people on the forum stated\u2014supporting C and getting \u2018good enough\u2019 support for D, led me to abandon the search and roll my own. So far, I\u2019ve done more-or-less complete highlighters for PSPad and CodeBlocks. To be fair, they both support D out of the box, but not GtkD which is important to me, mostly as an aid to remembering module names.<\/p>\n<p>I haven\u2019t even looked at other tools. I\u2019m dimly aware of some other sub-forums for what look like other tools, but to be honest I haven\u2019t read them. As I said, dmd does the job, so I\u2019m satisfied for now.<\/p>\n<h3 id=\"conclusion\">Conclusion<\/h3>\n<p>And that\u2019s a quick summary of my first two months with D. On the one hand, I don\u2019t really understand some of D\u2019s paradigms, but on the other, the ones I do relate to are meeting my expectations. The only two things I haven\u2019t found yet are:<\/p>\n<ul>\n<li>information about how I would go about packaging a D app (with GtkD) for distribution, and<\/li>\n<li>how to build on one platform for distribution on another (if that\u2019s even possible).<\/li>\n<\/ul>\n<p>I\u2019m willing to put in some time on this and eventually get gtkDcoding.com off the ground as my way of giving back. It\u2019s been a long time since those frozen weeks <a href=\"https:\/\/en.wikipedia.org\/wiki\/Coleco_Adam\">with a Coleco Adam<\/a> when I tried to explain BASIC to my thirteen-year-old sister (who is now a paramedic and doesn\u2019t care any more). And I must say, I\u2019m as excited now about D and GtkD as I was about BASIC and general computing way back then. Being retired, I have the time to pursue it and I\u2019m looking forward to becoming a regular member of the D community.<\/p>\n<p>And in case you don\u2019t know what a Dutch angle is, I urge you to watch some episodes of Batman from the 1960\u2019s. See how the camera tilts when things go wrong for our heroes? <a href=\"https:\/\/en.wikipedia.org\/wiki\/Dutch_angle\">That\u2019s a Dutch angle<\/a>.<\/p>\n<h2 id=\"bio\">Bio<\/h2>\n<p>I was inspired to learn programming while vacationing in a frozen Newfoundland outport in April of 1985. It started as a desperate attempt to keep from stripping down to my shorts and disappearing into a blizzard, but became a lifelong passion along with acting, writing, and music. In keeping with this non-typical start, it was in art college where I learned my first serious programming language (6502 assembly) and later it was on a job as a technical writer and artist that I wrote my first serious code for a client, an online mortgage calculator for a credit union in British Columbia. The culmination of my programming career was finishing the PHP-GTK app, Corkboard, a writer\u2019s tool for story planning. (Don\u2019t bother looking. I couldn\u2019t come up with a distribution system, so it languishes here on a back-up drive.)<\/p>\n<p>Since dropping out of high school in 1972, I\u2019ve made a living as a taxi driver, musician, screenwriter, technical writer, artist, sound reinforcement equipment salesman, and biology lab technician among other things. I\u2019ve also made money acting, programming, and promoting concerts. I retired from Statistics Canada in 2010 and have since divided my time between acting, writing lame novels, pursuing the elusive X-Plat beast, and keeping house for my wife of 33 years.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>For me, finding D is the most recent step along a road winding back at least a dozen years. I\u2019d been searching for a cross-platform development language\/environment (POSIX and Windows, but not so much mobile since my search began before mobile was really a thing) and at this point, D fits better than anything else [&hellip;]<\/p>\n","protected":false},"author":31,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[15,9,34],"tags":[],"_links":{"self":[{"href":"https:\/\/dlang.org\/blog\/wp-json\/wp\/v2\/posts\/1911"}],"collection":[{"href":"https:\/\/dlang.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dlang.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dlang.org\/blog\/wp-json\/wp\/v2\/users\/31"}],"replies":[{"embeddable":true,"href":"https:\/\/dlang.org\/blog\/wp-json\/wp\/v2\/comments?post=1911"}],"version-history":[{"count":6,"href":"https:\/\/dlang.org\/blog\/wp-json\/wp\/v2\/posts\/1911\/revisions"}],"predecessor-version":[{"id":1917,"href":"https:\/\/dlang.org\/blog\/wp-json\/wp\/v2\/posts\/1911\/revisions\/1917"}],"wp:attachment":[{"href":"https:\/\/dlang.org\/blog\/wp-json\/wp\/v2\/media?parent=1911"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dlang.org\/blog\/wp-json\/wp\/v2\/categories?post=1911"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dlang.org\/blog\/wp-json\/wp\/v2\/tags?post=1911"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}