<?xml version="1.0" encoding="UTF-8"?> <rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
xmlns:series="http://unfoldingneurons.com/"
><channel><title>Larry Ullman</title> <atom:link href="http://www.larryullman.com/feed/" rel="self" type="application/rss+xml" /><link>http://www.larryullman.com</link> <description>Translating Geek Into English</description> <lastBuildDate>Wed, 22 Feb 2012 15:25:43 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <item><title>&#8220;Modern JavaScript: Develop and Design&#8221; Exists!</title><link>http://www.larryullman.com/2012/02/22/modern-javascript-develop-and-design-exists/</link> <comments>http://www.larryullman.com/2012/02/22/modern-javascript-develop-and-design-exists/#comments</comments> <pubDate>Wed, 22 Feb 2012 15:25:43 +0000</pubDate> <dc:creator>Larry</dc:creator> <category><![CDATA[JavaScript]]></category> <category><![CDATA[Web Development]]></category> <category><![CDATA[book]]></category> <category><![CDATA[jsdd]]></category><guid
isPermaLink="false">http://www.larryullman.com/?p=3087</guid> <description><![CDATA[I am very, very happy to say that I received my printed copies of Modern JavaScript: Develop and Design on Monday evening (February 20, 2012). It&#8217;s safe to say that the book actually exists, after many, many delays, and should be available to you soon. My sincerest thanks to everyone for their interest in the book and for [...]]]></description> <content:encoded><![CDATA[<p>I am very, very happy to say that I received my printed copies of <em>Modern JavaScript: Develop and Design</em> on Monday evening (February 20, 2012). It&#8217;s safe to say that the book actually exists, after many, many delays, and should be available to you soon. My sincerest thanks to everyone for their interest in the book and for their patience.</p><p>The official Web site for the book is <a
href="http://www.larryullman.com/books/modern-javascript-develop-and-design/">http://www.larryullman.com/books/modern-javascript-develop-and-design/</a>. You can view the book&#8217;s <a
href="http://www.larryullman.com/books/modern-javascript-develop-and-design/table-of-contents/">Table of Contents</a> there, too. And I&#8217;ve created a <a
href="http://www.larryullman.com/forums/index.php?/forum/33-modern-javascript-develop-and-design/">support forum</a> for the book, naturally.</p><p>Over the next couple of weeks, some articles and videos I did in support of the book will be made available, and I&#8217;ll link those hear as that happens.</p> ]]></content:encoded> <wfw:commentRss>http://www.larryullman.com/2012/02/22/modern-javascript-develop-and-design-exists/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>What is Larry Thinking? #51 =&gt; Books!</title><link>http://www.larryullman.com/2012/02/20/what-is-larry-thinking-51-books/</link> <comments>http://www.larryullman.com/2012/02/20/what-is-larry-thinking-51-books/#comments</comments> <pubDate>Mon, 20 Feb 2012 15:25:56 +0000</pubDate> <dc:creator>Larry</dc:creator> <category><![CDATA[JavaScript]]></category> <category><![CDATA[PHP]]></category> <category><![CDATA[Web Development]]></category> <category><![CDATA[book]]></category> <category><![CDATA[books]]></category> <category><![CDATA[jsdd]]></category> <category><![CDATA[phpvqp3]]></category><guid
isPermaLink="false">http://www.larryullman.com/?p=3063</guid> <description><![CDATA[In this edition… About This Newsletter What Are You Thinking? =&#62; PHP 5 Advanced: Visual QuickPro Guide (3rd Edition) On the Web =&#62; President’s Day Discount at Peachpit.com On the Blog =&#62; Locale-aware Date and Time Formatting in PHP 5.3 Q&#38;A =&#62; What are some good general programming books? What is Larry Thinking =&#62; Your [...]]]></description> <content:encoded><![CDATA[<p>In this edition…</p><ul><li><a
href="http://www.larryullman.com/2012/02/20/what-is-larry-thinking-51-books/#about">About This Newsletter</a></li><li><a
href="http://www.larryullman.com/2012/02/20/what-is-larry-thinking-51-books/#you">What Are You Thinking? =&gt; PHP 5 Advanced: Visual QuickPro Guide (3rd Edition)</a></li><li><a
href="http://www.larryullman.com/2012/02/20/what-is-larry-thinking-51-books/#web">On the Web =&gt; President’s Day Discount at Peachpit.com</a></li><li><a
href="http://www.larryullman.com/2012/02/20/what-is-larry-thinking-51-books/#blog">On the Blog =&gt; Locale-aware Date and Time Formatting in PHP 5.3</a></li><li><a
href="http://www.larryullman.com/2012/02/20/what-is-larry-thinking-51-books/#qa">Q&amp;A =&gt; What are some good general programming books?</a></li><li><a
href="http://www.larryullman.com/2012/02/20/what-is-larry-thinking-51-books/#thinking">What is Larry Thinking =&gt; Your Knowledge Portfolio</a></li><li><a
href="http://www.larryullman.com/2012/02/20/what-is-larry-thinking-51-books/#news">Larry Ullman&#8217;s Book News =&gt; “Modern JavaScript: Develop and Design” Coming Soon!</a></li></ul><p><span
id="more-3063"></span></p><h2 id="about">About This Newsletter</h2><p>Through happenstance and a delay in finishing it, this newsletter actually has somewhat of a theme to it. Although that’s not a requirement for me, when I am able to theme a newsletter, it does make me happy for some reason. As the newsletter heading says, the theme is BOOKS! As you might imagine, it’s a subject that’s near and dear to my heart. But first, a caveat…</p><p>Although the goal is always to present information to you that I think you’ll benefit from or generally find interesting, this newsletter is a tad more commercial than I normally allow. In other words, if you buy some of the books mentioned in this newsletter, I might make a dollar or two (literally). Of course, there’s no pressure at all on you to buy any book discussed herein. I am sincerely trying to present those you may benefit from. And keep in mind you can also try getting any book that you might be interested in from your local library (for free!). With that caveat aside, let’s go to it.</p><p>As always, questions, comments, and all feedback are much appreciated. And thanks for your interest in what I have to say and do!</p><h2 id="you">What Are You Thinking? =&gt; PHP 5 Advanced: Visual QuickPro Guide (3rd Edition)</h2><p>Next month, I’m going to start working on the third edition of my “<a
href="http://www.larryullman.com/books/php-5-advanced-visual-quickpro-guide-2nd-edition/">PHP 5 Advanced: Visual QuickPro Guide</a>”. The PHP 5 Advanced book is somewhat different than my other books in that it discusses a number of individual topics, in a mostly non-linear order. The assumption the book makes is that the reader is already comfortable with PHP and MySQL, perhaps after having read my “<a
href="http://www.larryullman.com/books/php-and-mysql-for-dynamic-web-sites-visual-quickpro-guide-4th-edition/">PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide</a>” book, and is looking to further her or his skills or learn about specific, tangential concepts. The second edition of the book discusses a lot of OOP (about 150 pages or so), plus: security, advanced database topics, networking, PHP and the server, PHP’s command-line interface, XML, and more.</p><p>Right now, for the third edition, I’m tentatively planning on:</p><ul><li>Expanding the coverage of OOP</li><li>Discussing design patterns</li><li>Demonstrating unit testing</li><li>Walking through some good debugging tools, such as <a
href="http://www.xdebug.org/">Xdebug</a></li><li>Introducing the Zend Framework</li></ul><p>Other topics that I’m considering are: caching, MongoDB, CVS, Smarty, and doing a new example chapter (presumably using OOP). I also expect that I’ll drop a few chapters whose content is now covered in my other books.</p><p>My question, then, is: <em>What would you like to see</em>? Even if you don’t think you’re particularly interested in the book, what do you think is important? What hasn’t been well covered elsewhere (by anyone)? What hasn’t been well covered elsewhere by me?</p><p>Any and all ideas, suggestions, and feedback are very much welcome and appreciated!</p><h2 id="web">On the Web =&gt; President’s Day Discount at Peachpit.com</h2><p>Josee pointed out in <a
href="http://www.larryullman.com/forums/">my forums</a> that <a
href="http://www.peachpit.com">Peachpit Press</a>, the publisher of most of my books, is having a big President’s Day sale on their Web site (for those of you around the world, President’s Day is a rather trivial holiday we celebrate in the United States in February, ostensibly to honor our presidents). Peachpit is offering 40% off of any two eBooks or videos or 50% off any three. The coupon code is <strong>PRESIDENT</strong>. This is also advertised clearly on the front page of Peachpit’s site and ends on February 21. If you’ve been considering some titles, or are thinking about learning something new, this may be the right time.</p><p>As an example, looking at <a
href="http://www.peachpit.com/authors/bio.aspx?a=2a14d669-06f6-48cf-a5b8-907169808b9f">my books</a> (because, you know, it’s all about me), the list price for the eBook of “Modern JavaScript: Develop and Design” is $43.99 (all prices in USD). Although the book doesn’t formally come out until February 22nd, it can be pre-ordered. With the 40% discount, that comes down to $26.39. With the 50% discount, that comes down to $22.00. By comparison, the <a
href="http://amzn.to/wsdmkq">printed book at Amazon</a> is currently selling at $30.99. I will also point out that for international readers, purchasing an eBook will be the fastest way to get a copy, by many months or more (although only in English).</p><p>A couple of quick notes: First, I really don’t know much of anything about Peachpit’s site and only found out about this promotion when Josee pointed it out to me. I cannot answer any questions about Peachpit’s site, the e-commerce system there, the types of payments accepted, the policies, and so forth. Second, obviously I get a couple of dollars when you buy a book of mine (normally around $2 per book, depending upon the book) and I do receive an extra $1 more or less when you purchase it at Amazon through the above link. Just want to be transparent about that.</p><h2 id="blog">On the Blog =&gt; Locale-aware Date and Time Formatting in PHP 5.3</h2><p>In the third edition of my “PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide” book, titled “<a
href="http://www.larryullman.com/books/php-6-and-mysql-5-for-dynamic-web-sites-visual-quickpro-guide-3rd-edition/">PHP 6 and MySQL 5 for Dynamic Web Sites: Visual QuickPro Guide</a>”, I went out on a limb and used a beta version of PHP 6 when writing the book. PHP 6 was about half-way done at the time, and I didn’t want to complete the book, only to have it be outdated immediately thereafter (using PHP 6 wasn’t, by the way, an attempt to trick the reader into buying the book, as some cynical people have suggested). Well, <a
href="http://www.larryullman.com/2010/05/25/the-death-of-php-6the-future-of-php-6/">PHP 6 ended up dying due to many complications</a> and I had the proverbial egg on my face (what Paul rightfully called my “<a
href="http://en.wikipedia.org/wiki/Dewey_Defeats_Truman">Dewey Defeats Truman</a>” moment). In truth, only about 5% of the book or so required PHP 6, so it wasn’t a devastating mistake, but I certainly felt foolish.</p><p>One of the things I wanted to cover in PHP 6 was locale-aware date and time formatting, as part of the goal of PHP 6 was to recognize the more global Web environment. Even though PHP 6 was shelved, the key components have since been integrated into PHP 5.2, 5.3, and the forthcoming 5.4. Locale-aware date and time formatting was demonstrated in the book using the PHP <strong>date_format_locale()</strong> function. That function went belly-up, and PHP 5.3 now has the <a
href="http://us2.php.net/manual/en/class.intldateformatter.php">IntlDateFormatter</a> class instead. The documentation for the class is poor, but I <a
href="http://www.larryullman.com/2012/02/07/locale-aware-date-and-time-formatting-in-php-5-3/">posted on my blog</a> what I figured out.</p><h2 id="qa">Q&amp;A =&gt; What are some good general programming books?</h2><p>Some time back, Richard had sent me an email, saying that it seems like Web developers aren’t quite as up to speed on mainstream programming practices and paradigms. He was hoping for some book recommendations to help improve his own programming skills.</p><p>I would agree that because the most common Web-related languages, primarily PHP and JavaScript, are so approachable, they’re easy languages for non-programmers to use. Most people who learn C or Java, do so in a formal environment, obtaining all the fundamental programming theories at the same time. Conversely, many people using PHP, for example, may have no formal programming training, having only learned the language through a well-written book (ahem).</p><p>In any case, one should never stop learning, and I sent the following book recommendations back to Richard:</p><ul><li><a
href="http://amzn.to/wZS7AT">&#8220;The Pragmatic Programmer&#8221; by Andrew Hunt and David Thomas</a></li><li><a
href="http://amzn.to/zfeDUL">&#8220;The Practice of Programming&#8221; by Brian W. Kernighan and Rob Pike</a></li><li><a
href="http://amzn.to/xpEPDE">&#8220;The Productive Programmer&#8221; by Neal Ford</a></li><li><a
href="http://amzn.to/wLl7vd">&#8220;Code Complete&#8221; by Steve McConnell</a></li></ul><p>To be clear, I haven’t read all these myself, but they’re all on my short list. In fact, I just started reading “The Pragmatic Programmer” recently (more on that next). But these are the books that I normally come across when I’m looking for books on improving general programming skills. (Also, I’ll get like $1 if you by one of those books through one of those links, just to be completely honest.)</p><h2 id="thinking">What is Larry Thinking? =&gt; Your Knowledge Portfolio</h2><p>As part of my <a
href="http://www.larryullman.com/2012/01/03/my-january-2012-non-resolutions-list/">January-February non-resolutions list</a>, which quickly became my late-February non-resolutions list, I’m catching up on some reading, both work-related and personal. In terms of work, I’ve finally started reading <a
href="http://amzn.to/wZS7AT">&#8220;The Pragmatic Programmer&#8221; by Andrew Hunt and David Thomas</a>. I’m not far into it yet, but I am enjoying it. It’s too soon to say what I’ve learned, but I have had some of my own ideas validated, which is worth something, too.</p><p>In the very first chapter, there’s a section titled “Your Knowledge Portfolio”, which presents a great perspective on knowledge and learning. In every job, and even more so in IT, what you know is pretty much your value as a worker. This section of “The Pragmatic Programmer” starts off by pointing out that knowledge (and experience) is an <em>expiring asset</em>, meaning it becomes less valuable over time. For example, I used to know how to use HTML frames (not iframes, but classic frames), which isn’t so useful anymore. So “The Pragmatic Programmer” presents an argument for treating your knowledge asset like an investment portfolio. It’s an interesting and novel idea.</p><p>This means, for example, that you need to “invest regularly” in your knowledge portfolio and diversify the types of knowledge you acquire. Some should be “high-risk, high-reward”—information that may not pay off but, if it does, will pay off big—and some acquired knowledge should be more conservative. And you should review and rebalance your knowledge portfolio regularly.</p><p>The book recommends some specific ways to acquire new knowledge, such as:</p><ul><li>Learn new languages</li><li>Read technical books (ahem)</li><li>Read nontechnical books</li><li>Participate in local user groups</li></ul><p>It’s just a very well reasoned, interesting approach to the subject. I certainly see the value of knowledge and continuing to learn new things, but I had never equated this to an investment nor put such an analytic spin on the idea.</p><p>This section of the book also has a sidebar (on page 17 of the printed edition) on asking people for help online. It’s a topic that’s solidly on my radar, as I’m usually the one being asked for help (although I do ask others for help, too), and I could not have done a better job of explaining how to most appropriately and effectively ask for help. You can read this snippet through <a
href="http://books.google.com/books?id=5wBQEp6ruIAC&amp;lpg=PA17&amp;ots=n4hyhq9RpW&amp;dq=pragmatic%20programmer%20care%20guru&amp;pg=PA17#v=onepage&amp;q&amp;f=false">Google books</a>.</p><p>So I’m clearly enjoying the book so far and am happy to be finally reading it. No doubt I’ll share more thoughts on it, and some of the other books I’m finally reading, in future newsletters.</p><h2 id="news">Larry Ullman’s Book News =&gt; “Modern JavaScript: Develop and Design” Coming Soon!</h2><p>I am very, very happy to say that my latest book, “Modern JavaScript: Develop and Design”, is at the printer and is slated for a late February release (in the US, although <a
href="http://amzn.to/wsdmkq">Amazon</a> now has it as March 3rd). Because of the increased page count (624 pages), the price of the book was raised $5.00, to $54.99 (MSRP). However, it seems that Amazon only raised its price like 50 cents. Amazon is currently selling it at $31.00 (US).</p><p>I’ve also completed the supporting videos for the book, which will be made available through <a
href="http://www.peachpit.com">the publisher’s Web site</a> and in some electronic versions of the book. And I’ve written three supporting articles, that will be published at Peachpit.com.</p><p>For the first time ever, I plan on selling copies of select books myself. The books will, of course, be signed (inscribed however you want). For the “Modern JavaScript: Develop and Design” book, I will be able to offer it at $40 (US), plus shipping. This is more than the Amazon price, but I have more overhead (well, different overhead) and fewer employees than Amazon! Plus, Amazon has that whole “economies of scale” thing working for it. I’ll get the e-commerce system setup in the next couple of weeks for purchasing the book through me. If you have any questions or comments, let me know. Along with the eBook version, mentioned earlier, buying the book directly from me will be the fastest way for international recipients to get a copy, by far. I’ll need to receive my copies of the book before I can estimate the shipping costs.</p> ]]></content:encoded> <wfw:commentRss>http://www.larryullman.com/2012/02/20/what-is-larry-thinking-51-books/feed/</wfw:commentRss> <slash:comments>4</slash:comments> </item> <item><title>Blank HTML5 Reset Templates</title><link>http://www.larryullman.com/2012/02/17/blank-html5-reset-templates/</link> <comments>http://www.larryullman.com/2012/02/17/blank-html5-reset-templates/#comments</comments> <pubDate>Fri, 17 Feb 2012 15:38:52 +0000</pubDate> <dc:creator>Larry</dc:creator> <category><![CDATA[Web Development]]></category> <category><![CDATA[html5]]></category> <category><![CDATA[template]]></category><guid
isPermaLink="false">http://www.larryullman.com/?p=2881</guid> <description><![CDATA[As I have little to no design skill, I don&#8217;t often attempt to create my own HTML design. It&#8217;s really for the best. (When I do sites for clients, I&#8217;m normally using HTML and CSS created by an actual designer.) But when I go to write a book, I have to come up with a [...]]]></description> <content:encoded><![CDATA[<p>As I have little to no design skill, I don&#8217;t often attempt to create my own HTML design. It&#8217;s really for the best. (When I do sites for clients, I&#8217;m normally using HTML and CSS created by an actual designer.) But when I go to write a book, I have to come up with a design to use for many of the examples. In such cases, I try to find something as simple and clean as possible, while still being a bit stylish. HTML5 goes a long way towards this end, as do the many CSS reset tools that have been around for years. Well, HTML5, CSS resets, and more have been beautifully combined in a couple of different blank HTML5 reset templates.</p><p>One is the <a
href="http://html5boilerplate.com/">HTML5 Boilerplate</a>, which just came out in version 3. This is a fully-loaded template that includes key JavaScript libraries (<a
href="http://www.modernizr.com/">Modernizr</a>, <a
href="http://www.jquery.com">jQuery</a>, and <a
href="http://www.google.com/analytics/">Google Analytics</a>), caching recommendations, server configuration, and more. You can download the template in a well-documented format, a bare-bones file, or a custom creation based upon your desired needs.</p><p>Very similar is the <a
href="http://html5reset.org/">HTML5 Reset</a>. It also includes Modernizr, jQuery, and Google Analytics, along with a CSS reset, but doesn&#8217;t get into the server-side configuration, caching, and such. It&#8217;s also available in a corresponding blank WordPress theme, which I&#8217;m likely to use as the basis of my next site redesign.</p><p>Even if you don&#8217;t need to use an HTML5 reset template yourself, you can learn a lot about creating a well-constructed HTML template from  these. A lot of very smart people put quite a bit of thought into the ideas and functionality expressed in the templates. In sum, both represent the current best of the best practices, considering CSS3, jQuery, HTML5, meta tags, SEO, etc., etc.</p> ]]></content:encoded> <wfw:commentRss>http://www.larryullman.com/2012/02/17/blank-html5-reset-templates/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Technical Blogging, and a New, Formal Blog Posting Schedule</title><link>http://www.larryullman.com/2012/02/13/technical-blogging-and-a-new-formal-blog-posting-schedule/</link> <comments>http://www.larryullman.com/2012/02/13/technical-blogging-and-a-new-formal-blog-posting-schedule/#comments</comments> <pubDate>Mon, 13 Feb 2012 15:25:16 +0000</pubDate> <dc:creator>Larry</dc:creator> <category><![CDATA[Uncategorized]]></category> <category><![CDATA[about]]></category> <category><![CDATA[blog]]></category><guid
isPermaLink="false">http://www.larryullman.com/?p=3051</guid> <description><![CDATA[I&#8217;ve been reading the book Technical Blogging, by Antonio Cangiano, over the past couple of months and am glad that I am. I&#8217;m reading it in the hopes of improving the quality of (and, potentially, income from) this blog, and I think it will pan out. I started this blog a couple of years ago [...]]]></description> <content:encoded><![CDATA[<p>I&#8217;ve been reading the book <a
href="http://pragprog.com/book/actb/technical-blogging">Technical Blogging</a>, by Antonio Cangiano, over the past couple of months and am glad that I am. I&#8217;m reading it in the hopes of improving the quality of (and, potentially, income from) this blog, and I think it will pan out.<span
id="more-3051"></span></p><p>I started this blog a couple of years ago as a way to support my books and to connect with readers more directly. I hadn&#8217;t put much thought or planning into the blog, and have been mostly winging it thus far. Eventually I noticed that the blog was the only part of my site being updated within any regularity, and so I moved the blog to the forefront. When I did that, I also added the Amazon carousel widget as a way to promote my books (it just about covers the cost of hosting, which is a start). The blog had picked up significant viewership because of the popularity of <a
href="http://www.larryullman.com/series/learning-the-yii-framework/">my series on the Yii framework</a>, and I wanted to tap into that (i.e., if you like my writing with this series, you may like one of my books). And now, about a year and half later, I thought it time to put a bit more thought into it.</p><p>I&#8217;ve been reading many good pieces of advice in the Technical Blogging book, and one that I&#8217;ve started implementing already is a harder blogging schedule. Historically, I&#8217;ve posted three days a week: Tuesday, Thursday, and the weekend, hopefully not skipping more than one of those days every two weeks (i.e., my goal was to do at least 5 posts in a two-week period). The book makes a good argument for posting on weekdays and for being consistent in the time of day. So as of this month, I&#8217;ve started trying to consistently post Monday, Wednesday, and Friday, around 10:30AM (EST). Mostly this means that I&#8217;m still writing a blog post on Tuesday, Thursday, and the weekend, but those don&#8217;t go live until Monday, Wednesday, and Friday. Same requirement to me, but a consistent end result this way.</p><p>Another concept take from the book that I&#8217;ve started implementing is a schedule as to the types of posts being made. Almost all of the posts I write fall into one of three categories:</p><ul><li>About me (book updates, newsletters, and the like)</li><li>How-to&#8217;s (technical instruction)</li><li>Sharing links and resources</li></ul><p>Starting this month, Mondays are for the first type of post, Wednesdays, the second, and Fridays, the third. The thinking is that on Monday morning, you, the lovely reader, will find out what I&#8217;m up to, without taking too much time from your other Monday-morning duties. On Friday, you&#8217;ll be introduced to something useful, while your work week is winding down. And on Wednesday, in the middle of the week, you&#8217;ll see some actual code and perhaps learn how to do something new. That&#8217;s the thinking, anyway. This intended schedule also forces me to write more How-to&#8217;s, which are more time consuming than the other two types but arguably more useful to readers.</p><p>I&#8217;m thinking about adding guest posts, book reviews, and other new types of posts. Once I do those, they&#8217;ll probably be &#8220;one-off&#8221; postings that go on Tuesdays and Thursdays.</p><p>Through these and other planned changes, I hope to fulfill the two goals that I&#8217;ve finally identified for the site:</p><ol><li>Say something useful (such as my Yii series)</li><li>Sell a few more books</li></ol><p>I do get many specific requests for things people would like to see me write about. If you have any comments or suggestions, I&#8217;d love to hear them!</p> ]]></content:encoded> <wfw:commentRss>http://www.larryullman.com/2012/02/13/technical-blogging-and-a-new-formal-blog-posting-schedule/feed/</wfw:commentRss> <slash:comments>4</slash:comments> </item> <item><title>JavaScript Best Practices</title><link>http://www.larryullman.com/2012/02/10/javascript-best-practices/</link> <comments>http://www.larryullman.com/2012/02/10/javascript-best-practices/#comments</comments> <pubDate>Fri, 10 Feb 2012 15:32:06 +0000</pubDate> <dc:creator>Larry</dc:creator> <category><![CDATA[JavaScript]]></category> <category><![CDATA[jsdd]]></category><guid
isPermaLink="false">http://www.larryullman.com/?p=3049</guid> <description><![CDATA[I recently came across two good resources that discuss some best practices when it comes to JavaScript. The first is an article at Developer Drive, titled Top 10 &#8220;Must Follow&#8221; JavaScript Best Practices, written by Salman Siddiqui (it&#8217;s a good enough article that I&#8217;ll ignore the dubious use of quotation marks). It&#8217;s a pretty good list, [...]]]></description> <content:encoded><![CDATA[<p>I recently came across two good resources that discuss some best practices when it comes to JavaScript. The first is an article at <a
href="http://www.developerdrive.com">Developer Drive</a>, titled <a
href="http://www.developerdrive.com/2011/08/top-10-must-follow-javascript-best-practices-2/">Top 10 &#8220;Must Follow&#8221; JavaScript Best Practices</a>, written by <a
href="http://salmansiddiqui.com/">Salman Siddiqui</a> (it&#8217;s a good enough article that I&#8217;ll ignore the dubious use of quotation marks). It&#8217;s a pretty good list, with a range of beginner to advanced topics. I would disagree with one, however: &#8220;Better to avoid DOM.&#8221; While DOM manipulation is expensive, it&#8217;s often required, so I think it&#8217;s better to acknowledge that this is a necessary evil we&#8217;re stuck with and hope that browsers continue to make improvements in this area. I liken it to the common economic theory that getting a loan to buy a car makes poor monetary sense (because it&#8217;s a loan on something that depreciates). The fact is most people need a car to work and make money, so a car loan is often necessary. But I digresss&#8230;</p><p>The second resource is a presentation titled <a
href="http://www.slideshare.net/cheilmann/javascript-best-practices-1041724">JavaScript &#8220;Best Practices&#8221;</a> (again, the quotation marks), by <a
href="http://christianheilmann.com/">Christian Heilmann</a>. Heilmann presents about 20 specific suggestions and then explains them all in detail. The presentation itself lacks pretty much any style whatsoever, but content is more important, no? There&#8217;s lots of code in the presentation precisely demonstrating both good and bad behaviors, along with explanations as to why something is problematic.</p><p>I&#8217;m in the process of writing my own article, titled &#8220;The 10 Best JavaScript Development and Design Habits&#8221;, to be published at <a
href="http://www.peachpit.com">Peachpit.com</a>. I&#8217;ll post a link to that when it goes online.</p> ]]></content:encoded> <wfw:commentRss>http://www.larryullman.com/2012/02/10/javascript-best-practices/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Locale-aware Date and Time Formatting in PHP 5.3</title><link>http://www.larryullman.com/2012/02/07/locale-aware-date-and-time-formatting-in-php-5-3/</link> <comments>http://www.larryullman.com/2012/02/07/locale-aware-date-and-time-formatting-in-php-5-3/#comments</comments> <pubDate>Tue, 07 Feb 2012 15:25:43 +0000</pubDate> <dc:creator>Larry</dc:creator> <category><![CDATA[PHP]]></category> <category><![CDATA[Web Development]]></category> <category><![CDATA[date]]></category> <category><![CDATA[locale]]></category> <category><![CDATA[php5.3]]></category> <category><![CDATA[php6]]></category> <category><![CDATA[phpmysql3]]></category><guid
isPermaLink="false">http://www.larryullman.com/?p=3004</guid> <description><![CDATA[In the third edition of my &#8220;PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide&#8221; book, titled &#8220;&#8221;, I went out on a limb and used a beta version of PHP 6 when writing the book. PHP 6 was about half-way done at the time, and I didn&#8217;t want to complete the book, only [...]]]></description> <content:encoded><![CDATA[<p>In the third edition of my &#8220;PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide&#8221; book, titled &#8220;<a
href="http://www.larryullman.com/books/php-6-and-mysql-5-for-dynamic-web-sites-visual-quickpro-guide-3rd-edition/">PHP 6 and MySQL 5 for Dynamic Web Sites: Visual QuickPro Guide</a>&#8220;, I went out on a limb and used a beta version of PHP 6 when writing the book. PHP 6 was about half-way done at the time, and I didn&#8217;t want to complete the book, only to have it be outdated immediately thereafter (using PHP 6 wasn&#8217;t, by the way, an attempt to trick the reader into buying the book, as some cynical people have suggested). Well&#8230;<a
href="http://www.larryullman.com/2010/05/25/the-death-of-php-6the-future-of-php-6/">PHP 6 ended up dying due to many complications</a> and I had the proverbial egg on my face (what one reader rightfully called my &#8220;Dewey Defeats Truman&#8221; moment). In truth, only about 5% of the book or so required PHP 6, so it wasn&#8217;t a devastating mistake, but I certainly felt foolish.</p><p>One of the things I wanted to cover in PHP 6 was locale-aware date and time formatting, as part of the goal of PHP 6 was to recognize the more global Web environment. Even though PHP 6 was shelved, the key components have since been integrated into PHP 5.2, 5.3, and the forthcoming 5.4. Locale-aware date and time formatting was demonstrated in the book using the PHP 6 <strong>date_format_locale()</strong> function. That function went belly-up, and PHP 5.3 now has the <a
href="http://us2.php.net/manual/en/class.intldateformatter.php">IntlDateFormatter</a> class instead. The documentation for the class in poor, but here&#8217;s what I figured out&#8230;<img
title="More..." src="http://cloudfront.larryullman.com/wp-includes/js/tinymce/plugins/wordpress/img/trans.gif" alt="" /></p><p><span
id="more-3004"></span></p><p>First, let&#8217;s look at the original script, Script 14.5, <strong>locales.php</strong>:</p><pre class="brush: php; title: ; notranslate">// Set the default timezone:
date_default_timezone_set('UTC');

// Need a date object:
$d = new DateTime();

// Create a list of locales:
$locales = array('en_US', 'fr_FR', 'es_BO', 'zh_Hans_CN', 'ru_RU', 'el_GR', 'is_IS');

// Print the date in each locale:
foreach ($locales as $locale) {

    // Set the locale:
    locale_set_default($locale);

    // Print the date:
    echo &quot;&lt;p&gt;$locale: &quot; . strtotitle(date_format_locale($d, 'l, j F Y')) . &quot;&lt;/p&gt;\n&quot;;

}</pre><p>To convert this to work with the IntlDateFormatter class in PHP 5.3, the list of locales must first be changed to use hyphens instead of underscores:</p><pre class="brush: php; title: ; notranslate">$locales = array('en-US', 'fr-FR', 'es-BO', 'zh-Hans-CN', 'ru-RU', 'el-GR', 'is-IS');</pre><p>Then, the code for setting the local and formatting the date using that locale (both lines within the loop) have to be changed. As with many things in PHP, you can use the IntlDateFormatter class as an object or procedurally. Let&#8217;s look at the procedural approach first, which is what the book also does.</p><p>The first step is to create an IntDateFormatter object, using <strong><a
href="http://us2.php.net/manual/en/intldateformatter.create.php">datefmt_create()</a></strong>. Its first argument is the locale. Its next two arguments, both of which are required, are constants representing the date format and the time format. Those constants are <a
href="http://us2.php.net/manual/en/class.intldateformatter.php#intl.intldateformatter-constants">listed in the manual</a>. Here&#8217;s the complete function call, which would go first within the loop:</p><pre class="brush: php; title: ; notranslate">$fmt = datefmt_create($locale, IntlDateFormatter::LONG, IntlDateFormatter::SHORT);</pre><p>That variable will be used as the first argument in the <strong><a
href="http://us2.php.net/manual/en/intldateformatter.format.php">datefmt_format()</a></strong> function. The second argument to the function is the date and time, represented as a DateTime object:</p><pre class="brush: php; title: ; notranslate">echo &quot;&lt;p&gt;$locale: &quot; . datefmt_format($fmt, $d) . &quot;&lt;/p&gt;\n&quot;;</pre><p>Here is the resulting output:</p><div
id="attachment_3041" class="wp-caption aligncenter" style="width: 310px"><a
href="http://cloudfront.larryullman.com/wp-content/uploads/2012/02/PHP_locales_Figure_1.png"><img
class="size-medium wp-image-3041" title="PHP_locales_Figure_1" src="http://cloudfront.larryullman.com/wp-content/uploads/2012/02/PHP_locales_Figure_1-300x267.png" alt="" width="300" height="267" /></a><p
class="wp-caption-text">The date and time represented using different locales.</p></div><p>To do the same thing using OOP, you would write:</p><pre class="brush: php; title: ; notranslate">$ftm = new IntlDateFormatter($locale, IntlDateFormatter::LONG, IntlDateFormatter::SHORT);

$ftm-&gt;format($d);</pre><p>And there you have it!</p> ]]></content:encoded> <wfw:commentRss>http://www.larryullman.com/2012/02/07/locale-aware-date-and-time-formatting-in-php-5-3/feed/</wfw:commentRss> <slash:comments>3</slash:comments> </item> <item><title>Modern JavaScript: Develop and Design Off To the Printer!</title><link>http://www.larryullman.com/2012/02/06/modern-javascript-develop-and-design-off-to-the-printer/</link> <comments>http://www.larryullman.com/2012/02/06/modern-javascript-develop-and-design-off-to-the-printer/#comments</comments> <pubDate>Mon, 06 Feb 2012 15:25:36 +0000</pubDate> <dc:creator>Larry</dc:creator> <category><![CDATA[JavaScript]]></category> <category><![CDATA[Web Development]]></category> <category><![CDATA[book]]></category> <category><![CDATA[jsdd]]></category><guid
isPermaLink="false">http://www.larryullman.com/?p=3023</guid> <description><![CDATA[I am very happy to say that last week my latest book, Modern JavaScript: Develop and Design, went off to the printer. It&#8217;s still slated for a late February release (in the US). Because of the increased page count (624 pages), the price of the book was raised $5.00. However, it seems that Amazon only [...]]]></description> <content:encoded><![CDATA[<p>I am very happy to say that last week my latest book, <em>Modern JavaScript: Develop and Design</em>, went off to the printer. It&#8217;s still slated for a late February release (in the US). Because of the increased page count (624 pages), the price of the book was raised $5.00. However, it seems that Amazon only raised its price like 50 cents. Amazon is currently selling it at $31 (US) and you can buy it using the link below (note: I&#8217;ll get an extra dollar or so if you use the Amazon link).</p><p>For the first time ever, I plan on selling copies of select books myself. The books will, of course, be signed (inscribed however you want). For the <em>Modern JavaScript: Develop and Design</em> book, I believe I will be able to offer it at <del>$35</del> $40 (US), plus shipping. This is slightly more than the Amazon price, but I have more overhead (well, different overhead) and fewer employees than Amazon! Plus, Amazon has that whole &#8220;economies of scale&#8221; thing working for it. I&#8217;ll confirm the price and get the e-commerce system setup in the next couple of weeks. If you have any questions or comments, let me know.</p><p><strong>ADDITION:</strong> Presumably, the book will be available internationally in time, starting with English-language countries such as Canada, the UK, and Australia, followed by translations in other European countries and Asia (that&#8217;s my educated guess, based upon how things have gone in the past). Buying the book directly from me will be the fastest way for international recipients to get a copy, by far. I&#8217;ll need to receive my copies of the book before I can estimate the shipping costs.</p><p><strong>UPDATE: I just heard back from my contact at the publisher and it will cost me more than I had thought to purchase the book for resale. In order to cover my costs, I&#8217;ll need to charge $40 (US) plus shipping. Admittedly, this is almost $10 more than Amazon, but the $40 covers the cost of: the book itself, getting the book shipped to me, and packing materials. I think shipping within the United States via media rate will be around $4.</strong></p><p><iframe
style="width: 120px; height: 240px;" src="http://rcm.amazon.com/e/cm?t=larrullm09-20&amp;o=1&amp;p=8&amp;l=as1&amp;asins=0321812522&amp;nou=1&amp;ref=qf_sp_asin_til&amp;fc1=000000&amp;IS2=1&amp;lt1=_blank&amp;m=amazon&amp;lc1=0000FF&amp;bc1=FFFFFF&amp;bg1=FFFFFF&amp;f=ifr" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" width="320" height="240"></iframe></p> ]]></content:encoded> <wfw:commentRss>http://www.larryullman.com/2012/02/06/modern-javascript-develop-and-design-off-to-the-printer/feed/</wfw:commentRss> <slash:comments>13</slash:comments> </item> <item><title>Top 100 E-Commerce Tips</title><link>http://www.larryullman.com/2012/02/03/top-100-e-commerce-tips/</link> <comments>http://www.larryullman.com/2012/02/03/top-100-e-commerce-tips/#comments</comments> <pubDate>Fri, 03 Feb 2012 15:31:35 +0000</pubDate> <dc:creator>Larry</dc:creator> <category><![CDATA[JavaScript]]></category> <category><![CDATA[MySQL]]></category> <category><![CDATA[PHP]]></category> <category><![CDATA[Web Development]]></category> <category><![CDATA[e-commerce]]></category> <category><![CDATA[ecom]]></category><guid
isPermaLink="false">http://www.larryullman.com/?p=2982</guid> <description><![CDATA[I just recently came across this somewhat old post titled Top 100 E-commerce Tips from WebmasterWorld. Despite the fact that the article was published over four years ago, and it&#8217;s based upon a slightly older forum thread, there&#8217;s still a lot of material in the article worth reading if you do any e-commerce. Even though [...]]]></description> <content:encoded><![CDATA[<p>I just recently came across this somewhat old post titled <a
href="http://www.soloseo.com/blog/2007/06/18/top-100-e-commerce-tips-webmasterworld/">Top 100 E-commerce Tips from WebmasterWorld</a>. Despite the fact that the article was published over four years ago, and it&#8217;s based upon a slightly older forum thread, there&#8217;s still a lot of material in the article worth reading if you do any e-commerce. Even though there are a full 100 tips here, they&#8217;re short—most are just a single sentence—and quite valid. Admittedly, I disagree with a couple, and feel like a few could be tossed out, but there are many good points made, and many reminders of things that perhaps you&#8217;ve forgotten to emphasize on your most recent e-commerce. project.</p> ]]></content:encoded> <wfw:commentRss>http://www.larryullman.com/2012/02/03/top-100-e-commerce-tips/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Transliteration in PHP 5.4</title><link>http://www.larryullman.com/2012/02/01/transliteration-in-php-5-4/</link> <comments>http://www.larryullman.com/2012/02/01/transliteration-in-php-5-4/#comments</comments> <pubDate>Wed, 01 Feb 2012 15:25:50 +0000</pubDate> <dc:creator>Larry</dc:creator> <category><![CDATA[PHP]]></category> <category><![CDATA[Web Development]]></category> <category><![CDATA[phpmysql3]]></category> <category><![CDATA[transliteration]]></category> <category><![CDATA[transliterator]]></category><guid
isPermaLink="false">http://www.larryullman.com/?p=2998</guid> <description><![CDATA[In the third edition of my &#8220;PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide&#8221; book, titled &#8220;&#8221;, I went out on a limb and used a beta version of PHP 6 when writing the book. PHP 6 was about half-way done at the time, and I didn&#8217;t want to complete the book, only [...]]]></description> <content:encoded><![CDATA[<p>In the third edition of my &#8220;PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide&#8221; book, titled &#8220;<a
href="http://www.larryullman.com/books/php-6-and-mysql-5-for-dynamic-web-sites-visual-quickpro-guide-3rd-edition/">PHP 6 and MySQL 5 for Dynamic Web Sites: Visual QuickPro Guide</a>&#8220;, I went out on a limb and used a beta version of PHP 6 when writing the book. PHP 6 was about half-way done at the time, and I didn&#8217;t want to complete the book, only to have it be outdated immediately thereafter (using PHP 6 wasn&#8217;t, by the way, an attempt to trick the reader into buying the book, as some cynical people have suggested). Well&#8230;<a
href="http://www.larryullman.com/2010/05/25/the-death-of-php-6the-future-of-php-6/">PHP 6 ended up dying due to many complications</a> and I had the proverbial egg on my face (what one reader rightfully called my &#8220;Dewey Defeats Truman&#8221; moment). In truth, only about 5% of the book or so required PHP 6, so it wasn&#8217;t a devastating mistake, but I certainly felt foolish.</p><p>I had specifically wanted to discuss PHP 6 because of its intended support for <a
href="http://unicode.org/">Unicode</a>, which is what the code in the book requires for a couple of examples. Even though PHP 6 was shelved, the key components have since been integrated into PHP 5.2, 5.3, and the forthcoming 5.4. <em>Transliteration</em>, the ability to convert text from one alphabet to another, was demonstrated in the book using the PHP 6 <strong>str_transliterate()</strong> function. That function went belly-up, and PHP 5.4 now has the <a
href="http://www.php.net/manual/en/class.transliterator.php">Transliterator</a> class instead. The documentation for the class in non-existent, but here&#8217;s what I figured out&#8230;<span
id="more-2998"></span></p><p>As with many things in PHP, you can use the Transliterator class as an object or procedurally. Let&#8217;s look at the procedural approach first, which is what the book also does. The function that does all the work is <strong>transliterator_transliterate()</strong>. Its first argument is a either a string identifying the transliteration to conduct, or a Transliterator object. Its second argument is the text to be transliterated.</p><p>In the Transliterator class, transliterators are defined using the syntax <em>from</em>-<em>to</em>. So Bengali-Tamil will transliterate from the Bengali alphabet to the Tamil alphabet. Keep in mind this is just the replacing of characters from one alphabet to the corresponding characters in another. This is not translation!</p><p>To get the list of possible transliterators, invoke the <strong>transliterator_list_ids()</strong> method (Figure 1):</p><pre class="brush: php; title: ; notranslate">echo '&lt;pre&gt;' . print_r(transliterator_list_ids(), 1) . '&lt;/pre&gt;';</pre><div
id="attachment_3013" class="wp-caption aligncenter" style="width: 310px"><a
href="http://cloudfront.larryullman.com/wp-content/uploads/2012/02/PHP_trans_Figure_1.png"><img
class="size-medium wp-image-3013" title="PHP's List of Transliterators" src="http://cloudfront.larryullman.com/wp-content/uploads/2012/02/PHP_trans_Figure_1-300x271.png" alt="" width="300" height="271" /></a><p
class="wp-caption-text">Figure 1</p></div><p>Returning to the code in the book, in Script 14.4, <strong>trans.php</strong>, my name using the Latin alphabet was stored in a variable called <strong>$me</strong>. Then, an array of destination alphabets was created:</p><pre class="brush: php; title: ; notranslate">$me = 'Larry Ullman';
$scripts = array('Greek', 'Cyrillic', 'Hebrew', 'Arabic', 'Hangul');</pre><p>Next, a <strong>for</strong> loop iterated through the array. Within the array, originally, the <strong>str_transliterate()</strong> function was called:</p><pre class="brush: php; title: ; notranslate">foreach ($scripts as $script) {
    echo &quot;$me is &quot; . str_transliterate($me, 'Latin', $script) . &quot; in $script.\n&quot;;
}</pre><p>With the updated Transliterator class, the proper syntax is now (Figure 2):</p><pre class="brush: php; title: ; notranslate">echo &quot;$me is &quot; . transliterator_transliterate (&quot;Latin-$script&quot;, $me) . &quot; in $script.\n&quot;;</pre><p>And that&#8217;s all there is to it! (To reiterate, this does require PHP 5.4 or greater.)</p><div
id="attachment_3014" class="wp-caption aligncenter" style="width: 310px"><a
href="http://cloudfront.larryullman.com/wp-content/uploads/2012/02/PHP_trans_Figure_2.png"><img
class="size-medium wp-image-3014" title="Script 14.4, trans.php, Updated" src="http://cloudfront.larryullman.com/wp-content/uploads/2012/02/PHP_trans_Figure_2-300x209.png" alt="" width="300" height="209" /></a><p
class="wp-caption-text">Figure 2</p></div><p>To do the same thing using object-oriented programming, you&#8217;d first create a new Transliterator object:</p><pre class="brush: php; title: ; notranslate">$t = Transliterator::create(&quot;Latin-$script&quot;);</pre><p>Then you call the <strong>transliterate()</strong> method of the object, providing the text to transliterate as the first argument:</p><pre class="brush: php; title: ; notranslate">$t-&gt;transliterate($me);</pre><p>And there you have it!</p><p>The Transliterator class can be told to transliterate forwards, or in reverse, allowing you to go from an alphabet written in one language to an alphabet written in another.</p> ]]></content:encoded> <wfw:commentRss>http://www.larryullman.com/2012/02/01/transliteration-in-php-5-4/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>What is Larry Thinking? #50 =&gt; OOP Design, Part 1</title><link>http://www.larryullman.com/2012/01/30/what-is-larry-thinking-50-oop-design-part-1/</link> <comments>http://www.larryullman.com/2012/01/30/what-is-larry-thinking-50-oop-design-part-1/#comments</comments> <pubDate>Mon, 30 Jan 2012 06:58:39 +0000</pubDate> <dc:creator>Larry</dc:creator> <category><![CDATA[JavaScript]]></category> <category><![CDATA[PHP]]></category> <category><![CDATA[Web Development]]></category> <category><![CDATA[jsdd]]></category> <category><![CDATA[newsletter]]></category> <category><![CDATA[oop]]></category> <category><![CDATA[security]]></category><guid
isPermaLink="false">http://www.larryullman.com/?p=2987</guid> <description><![CDATA[In this edition… What Were You Thinking? =&#62; Bimonthly Newsletters On the Web =&#62; Security and Privacy Made Simpler On the Blog =&#62; My January 2012 Non-Resolutions List Q&#38;A =&#62; How do you go about designing the main OOP classes for a project? Larry Ullman&#8217;s Book News =&#62; “Modern Javascript: Develop and Design” Done! What [...]]]></description> <content:encoded><![CDATA[<p>In this edition…</p><ul><li><a
href="http://www.larryullman.com/2012/01/30/what-is-larry-thinking-50-oop-design-part-1/#you">What Were You Thinking? =&gt; Bimonthly Newsletters</a></li><li><a
href="http://www.larryullman.com/2012/01/30/what-is-larry-thinking-50-oop-design-part-1/#web">On the Web =&gt; Security and Privacy Made Simpler</a></li><li><a
href="http://www.larryullman.com/2012/01/30/what-is-larry-thinking-50-oop-design-part-1/#web">On the Blog =&gt; My January 2012 Non-Resolutions List</a></li><li><a
href="http://www.larryullman.com/2012/01/30/what-is-larry-thinking-50-oop-design-part-1/#qa">Q&amp;A =&gt; How do you go about designing the main OOP classes for a project?</a></li><li><a
href="http://www.larryullman.com/2012/01/30/what-is-larry-thinking-50-oop-design-part-1/#news">Larry Ullman&#8217;s Book News =&gt; “Modern Javascript: Develop and Design” Done!</a></li></ul><p><span
id="more-2987"></span></p><h2 id="you">What Were You Thinking? =&gt; Bimonthly Newsletters</h2><p>In <a
href="http://www.larryullman.com/2012/01/07/what-is-larry-thinking-49-a-new-year/#you">the previous newsletter</a>, I asked for input on the idea of changing the newsletter from going out every 3-4 weeks but being longer to going out every 2 weeks but being shorter. You were also able to vote in <a
href="http://www.larryullman.com/2012/01/06/newsletter-opinion-poll/">an online poll</a>. About two-thirds of the votes were for the change, although the more passionate responses were against the change, as those recipients already felt they received too many newsletters and emails. I think what I’m going to do, as a happy medium, is to shoot for a schedule where the newsletters come out slightly faster, like every 2-3 weeks, and are slightly shorter. This should be feasible for me to pull off without overwhelming you.</p><p>Towards that end, you may note that there’s no “What is Larry Thinking?” section in this particular newsletter. With the new plan for the newsletter, I’m not going to be quite so rigid about what goes into each newsletter, limiting myself to just five or so significant pieces. The bulk of this newsletter answers a question on OOP design.</p><p>My thanks to everyone for their input. And please always feel free to provide any feedback, questions, comments, etc., that you may have. (Postscript: Several of you rightfully pointed out that I misused “biweekly” in the text of the newsletter, despite correctly using “bimonthly” in the heading. I indeed meant “bimonthly”, although “biweekly” has the same inexactitude in that it can mean both every two weeks and twice a week.)</p><h2 id="web">On the Web =&gt; Security and Privacy Made Simpler</h2><p>When I was writing my <a
href="http://www.larryullman.com/books/effortless-e-commerce-with-php-and-mysql/">Effortless E-Commerce with PHP and MySQL</a> book, I naturally did a bunch of research, particularly with regards to the various laws that apply. Understanding the programming behind an e-commerce site is relatively simple; understanding all the applicable laws and implications of doing e-commerce is complex. One of the sites I found to be quite useful was the United States <a
href="http://www.bbb.org/">Better Business Bureau</a> (BBB).</p><p>I’m currently going through some items in my “to read” folder, and am reading, or perhaps re-reading, the Better Business Bureau’s PDF titled “<a
href="http://www.bbb.org/us/corporate-engagement/security/">Security &amp; Privacy – Made Simpler</a>. If you do any e-commerce, or even just Web development, in the U.S. or not, it’s worth your time. It’s a 22-page document that discusses almost every facet of e-commerce, such as:</p><ul><li>Developing a security and privacy plan</li><li>Creating and communicating your security and privacy policies</li><li>Good employee screening and policies</li><li>Common hack/theft strategies</li><li>General Internet security</li><li>Proper handling of customer data</li><li>Payment processing</li><li>What to do in the event of a data breach</li><li>A preview of international e-commerce considerations</li></ul><p>The document also has many resources listed in these and other categories. You can download the PDF from that page, but there are also related FAQs and more on the BBB’s site.</p><h2 id="blog">On the Blog =&gt; My January 2012 Non-Resolutions List</h2><p>I’ve never been much of a New Year’s Resolution person: if something is important enough to do, start today, not on some arbitrary date that happens to be the first day of the year. (Or, you know, January 2nd, because the first is a holiday and all.) But this year I happen to have quite a long non-resolutions list. The timing is entirely coincidental: I just happen to be done with my “Modern JavaScript: Develop and Design” book around this time, and I always have a long list of things to do between books. I recently <a
href="http://www.larryullman.com/2012/01/03/my-january-2012-non-resolutions-list/">posted on my blog</a> about my immediate plans (aka, my non-resolutions list).</p><h2 id="qa">Q&amp;A =&gt; How do you go about designing the main OOP classes for a project?</h2><p>While “diving into” Object-Oriented Programming development in PHP, Chris had emailed me about how one sets up the core classes for an OOP-based site. The specific example—user management with login/logout, roles, etc.—is common and not complex, but Chris didn’t know where to start. In my opinion, OOP is easy enough to <em>use</em> once the classes have been defined; the difficulties arise from coming up with the proper classes in the first place. So let’s look at that process, in the abstract.</p><p><em>Programming is a matter of taking actions with data.</em> In a linguistic sense, it’s very much a noun-verb relationship: the user submits form data to a server; the server stores data in a database; the user requests another page; the server pulls data from a database. Whether you’re using OOP or procedural code, you need to identify both the actions and the data first. What are all the <em>verbs</em> that the user or Web site needs to be able to do? What are all the <em>nouns</em> that will be involved in those actions? Once you’ve identified those attributes of the site, procedural programming focuses first on the verbs, OOP focuses first on the nouns.</p><p>To start designing OOP classes, one must first organize the types of data the site will work with, in detail. In a user management system, there’s one obvious noun: a <strong>User</strong>. The properties of a User include: userId, username, userPass, userRole, dateRegistered, and so forth. (Conventionally, OOP uses camel-case for variable and property names.) When you think you’ve identified the nouns involved, go back and see if all of the actions now have the data that needs to be involved. When a new person registers, a User is created (as both a PHP variable and a record in the database). When a person logs in, a User is retrieved from the database and created as a PHP variable. When a person logs out, the User PHP variable can be destroyed. To see if a person has authority to do X, you’d check the <strong>User-&gt;userRole</strong> property.</p><p>In some situations, there will be nouns with overlapping roles and properties, which would suggest that you should create a hierarchy of classes. I think of shapes as being the easiest example to comprehend. All two-dimensional shapes have some common attributes, such as area and perimeter, but triangles have three sides, rectangles have four, and circles have none (but do have a radius). When you find yourself in situations like this, you’ll want to design one master class, in this case, <strong>Shape</strong>, which you never create instances of. Then you define derived classes—<strong>Triangle</strong>, <strong>Rectangle</strong>, and <strong>Circle</strong>—that you would create instances of. Admittedly, knowing when to create a hierarchy can be tough. You might think with a user roles situation that you’d want common users and administrators as two separate classes, but the only difference between the two types is in what actions each can take, which is easily managed using Access Control Lists (ACLs) or the like. Or, put another way, everything about the two users is exactly the same except for the type, so there’s no need to create separate classes (unlike, by comparison, circles and triangles that have some overlapping properties but other very different ones).</p><p>Another common class to use on a site would be one for interacting with the database. You could create your own class for this purpose, or just use the <a
href="http://www.php.net/mysqli">MySQLi object</a> or <a
href="http://www.php.net/pdo">PDO</a> or the like.</p><p>Even in a simple site with content and users, there are other clear nouns: the pages of content. Going back to the language analogy, there are some sentences that have a single noun—<em>Johnny runs</em> or <em>A User logs out</em>—but many have more than one noun—<em>Johnny reads a book</em> or <em>A User views a page of content</em>. The content, then, would also be represented by one or more classes, depending upon the variety in the content displayed. If the content is just information displayed within a template of HTML, then <strong>Content</strong> might have these attributes: contentId, title, body, createdBy, dateCreated, and dateUpdated. The createdBy could be as simple as a userID integer, or more formally be an actual User instance.</p><p>Depending upon how OOP-y you want to be, you may also create classes for generating the HTML pages (i.e., View classes) and for handling actions (i.e., Controller classes). Those move you into the realm of a true MVC architecture, which isn’t always necessary, though.</p><p>In asking the question, Chris didn’t originally know how to handle the logging in and logging out and registration and such, not knowing if one makes classes for those. Those are actions performed on, or using, objects, and don’t get represented as classes themselves.</p><p>Because I’m going to be writing the third edition of my “<a
href="http://www.larryullman.com/books/php-5-advanced-visual-quickpro-guide-2nd-edition/">PHP 5 Advanced: Visual QuickPro Guide</a>” this year, I expect I’ll be doing a lot of writing on the subject of OOP, design patterns, and the like. If anyone has any more questions or comments regarding these topics, let me know.</p><h2 id="news">Larry Ullman’s Book News =&gt; “Modern Javascript: Develop and Design” Done!</h2><p>I am very, very happy to say that my latest book, “Modern JavaScript: Develop and Design”, is officially done. Like done, done. Last week Monday, I submitted the last chapter to be written, Chapter 13, Frameworks. In it, I quickly discuss how to choose a framework, when you should use a framework, and some common libraries (as a framework alternative). The bulk of the chapter introduces and uses <a
href="http://jquery.com/">jQuery</a> and the <a
href="http://yuilibrary.com/">Yahoo! User Interface (YUI) Library</a>. For both I explain how to perform common tasks—selecting DOM elements, DOM manipulation, event handling, and Ajax, and then walk through more advanced examples. For both, the chapter explains an autocomplete example, using a PHP script as the data source. For jQuery, I also discuss the <a
href="http://datatables.net/">DataTables</a> plug-in. For YUI, I also discuss and demonstrate the <a
href="http://developer.yahoo.com/yql/">Yahoo! Query Language</a> (YQL). For it, I go through a couple of examples, including fetching a weather report and a stock quote. (For the record, I specifically target YUI3, which is an improvement over YUI1 and 2, even if some of the framework is currently in beta.)</p><p>Chapter 13 is the first chapter in Part 3 of the book, Next Steps. I already wrote Chapter 14, Advanced JavaScript, which has a heavy focus on closures. Chapter 15, A PHP and JavaScript Example, creates a pseudo-complete auction system. Auctions are set to expire on a certain date and time. Logged-in users can bid on items. All dates and times are shown using Coordinated Universal Time (UTC) or the user’s timezone, if the user is logged-in. Then, JavaScript used to enhance the experience. This includes using Ajax for the login and bid forms, retrieving the latest bids via Ajax (and updating the table of bids with them), and creating countdown timers that show the amount of time left in an auction, when that’s less than an hour. I think the chapter turned out well, and it emphasizes the various ways to pass data back and forth between PHP and JavaScript, a common point of confusion.</p><p>Not only is all of the initial writing is complete, but I’ve also done the rewrites on the entire book, and I just—moments ago—finished reviewing the PDF layouts, which is the last step before the book goes to the printer. (As you can tell, there are a lot of overlapping steps here at the end.) I believe the book will still ship, as originally planned, at the end of February.</p><p>In support of the book, I’ll also be writing a couple of articles (published online for free) and create some screencasts (to be provided in various places).</p> ]]></content:encoded> <wfw:commentRss>http://www.larryullman.com/2012/01/30/what-is-larry-thinking-50-oop-design-part-1/feed/</wfw:commentRss> <slash:comments>5</slash:comments> </item> </channel> </rss>
<!-- Served from: www.larryullman.com @ 2012-02-23 00:50:55 by W3 Total Cache -->
