What is Larry Thinking? #8 => Lots of Questions and Answers

December 19, 2007

In this edition…

About this Newsletter

In the last book giveaway, I requested that people send in questions or topics for future newsletters. I received over 50 emails with lots of good stuff in them. Rather than answer one question at a time over a decade, I’ve decided to bang out a bunch of questions (with corresponding answers) here. I apologize that I wasn’t able to reply to every email and that I can’t answer every question immediately, but my thanks, as always, to people for their emails and feedback. Keep it coming! And, as a reminder, if you need a question answered, use the forums.

Also, and maybe everyone subscribed takes this as a given, but keep in mind that, even more than normal, what you’re getting here are my opinions on these topics. Presumably you ascribe some credit to my opinions, which is why you’re reading this, but I am fallible, I have my own biases, etc., and what I have to say isn’t the only valid opinion on any subject.

And, as always, this ended up being longer than intended. Maybe it’d be best read in short bursts…

Q & A => Have you done work for/with readers? Are you available for hire?

For a while, I probably made more money because I had written a book than I made for actually writing it. The short answer is that I have performed work for people who found me through the books, which is not a problem for me at all. Currently, the main reason I wouldn’t take on a job is that I’m booked too far in advance. I normally have 2-3 books planned for the next year, with a couple of other projects interspersed. So normally I can’t take on any new work for a year or two from the time I’m contacted (which is way too far off for most people).

Some readers contact me because they have a “big idea” (i.e., one that they think they’ll strike it rich with) and would like to see if I could help for cheap or for future considerations. This I won’t do. I’ve done it before a couple of times and it’s just not how I should be spending my limited time. I’m all for dreams and I certainly like the idea of coming up with the next big thing (I have fantasies of having YouTube-founder money), but I’m older now and have a house payment and kids that need food and might want to go to college some day, etc., so cash in hand today cannot be ignored. Plus, I think that in order to be successful in such an endeavor, you have to have a passion for it (which I likely wouldn’t as a newcomer to the project) and you have to be a little bit, or a lot, lucky.

I have also had readers offer to pay me a little to provide that final bit of help on a project they’re doing. This I also won’t do. Again, I don’t have the time. Secondarily, the amount I would charge for even a little work would probably not make sense for many people to pay. Thirdly and ironically, I would rather offer the help for free through the forums. Strange as that may seem, it’s part of my preference to teach people how to do something rather than doing it for them.

Q & A => How do you manage your time/workload? How long does it take to write a book?

A few of the questions I received were along these lines. As for the book writing process, you start with some research and development (coming up with the proposal, the table of contents, etc.). This is only a couple of weeks. Principal writing will take 2-3 months, hopefully. Sometimes it takes a lot longer, and it almost never takes less time than that (depends upon the book, of course). After I write a chapter, it goes to an editor, a line editor, and a technical editor (three different people). I then get the chapters back with their notes and edits and rewrite the chapters one more time. The rewrites start during the principal writing (e.g., I might turn in chapter 10, then do the rewrite on chapter 3) and continue on afterwards. Then the chapters are turned into PDFs, formatted as they will be in the printed book. I then read these and make corrections. Then I repeat the process again on a second set of PDFs. All these edits require about another month. So a book from start to finish requires at least 2-3 months but normally 4-5. It’s actually an excruciating amount of work but it’s the life I’ve chosen.

As for how I manage my time, um, yikes. With a lot of luck? The fact is that I’ve never had very good discipline (I was the student that started to read a book, write a paper, study, at 3 am the day the paper/test/whatever was due). The fix I’ve come up with for this is to overload myself with so much work that I can’t risk slowing down or delaying something. My primary job these days is to take care of my twins (16 months ago I went from being a stay-at-home worker to a stay-at-home dad) so there’s even less time to mess around. I’m able to get done what I get done because: I gave up all hobbies (I take care of the kids during the day, M-F; I work on evenings and weekends and during naps; I, tragically, don’t hit the Playstation anymore); I create lots of lists of what I need to do and make sure I get them done without distracting myself too much; and I do things as efficiently as possible. As an example, for each image in a book (maybe 300 per title), I’ll need to turn it into a grayscale version, darken it a bit, then save it. To optimize this process, I created an action in Photoshop that will do this in one fell swoop. It’ll only save me some seconds or minutes per chapter but every little bit helps. Or, I also created a process (using AppleScript and a Microsoft Office Macro) that: takes a script in my text editor, highlights everything, moves it all over one tab, adds line numbers, copies it all, closes the document without saving it, asks me the book name, chapter number, and script number, opens a new MS Word template, turns off tracking, pastes the text; formats it all properly, saves the file in the right folder on my computer, then closes the Word document. Whew! It took me a long time to develop this process but it does so much and saves me time.

Q & A => How did you teach yourself PHP? MySQL?

In the fall of 1999 I began a new career path doing digital media and multimedia. I had no experience, no clients, no formal training, nothing. (You may ask why I decided to go this route but it’s a long and rather odd story; I kind of backed into the role.) Despite my lack of qualifications, I’ve always had an aptitude with computers and I had the situation where going out on a limb was feasible. Without having much, if any, work to do, I had plenty of free time, mostly spent trying to learn the skills I would need. I intended to do some Web development, so I started creating an online football pool (American football) where my friends and I could make picks. I started doing the heavy work using CGI scripts written in Perl, which was way more tedious than I would have liked. I read an article online about PHP, started using it, and the rest is history. That history goes like this…

When I started learning PHP, I think there was only one or two books available on the subject. One was essentially a book version of the PHP manual, with a little more code in it. The other was an advanced book that was decent if you already knew PHP but wasn’t a good learning tool. So I read these, read the manual, read anything I could find online, and experimented. I learned by doing, by failing, by succeeding (almost as much as I failed). What I also learned during this time is what a book that teaches PHP should be like. That was an even more valuable lesson. Soon after I picked up PHP, I started learning MySQL in much the same way (read anything I could online, used the manual, etc.). There were even fewer MySQL books out at the time and the first one I bought was on both mSQL and MySQL (don’t be surprised if you’ve never heard of mSQL). The hardest thing to overcome when learning, as you probably know already, is what to do when you encounter a problem, which I address in the next answer.

Not to be too didactic about it, but the trick is that I never stopped learning. I continue to read any articles that I find online on any topic that might pique my interest. I subscribe to all of the associated newsgroups to see what other people are thinking, asking, or doing. And, of course, I use the technologies myself so that I have real-world experience. This helps most when it comes to writing the books, both in terms of being able to provide good examples and in knowing what likely issues or hurdles may come up.

Q & A => When you get stuck with a PHP problem or other language problem, where do you turn to for help?

I like this question a lot, in part because it gives me a chance to point out that I do get stuck sometimes. I know a fair amount of computer stuff, but I get stuck, I create errors, I get frustrated, and so on. Nothing you can do about that except change how you feel when it happens! I may be somewhat rare in this, but I do find the online manuals to be very useful (it depends upon the topic, naturally). In particular, the manuals that also include user-supplied comments are very helpful, because those people may have had the same problem I’m having and have figured out, and posted, the solution. Never forget that you’re probably not the first person to have a certain question or comment! I don’t use any forums regularly because I just don’t have the time. Normally, a quick search in Google will turn up the answer I need on the first or second page.

As an interesting corollary to this, I ran into some PHP problems while writing the third edition of my “PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide” (technically called “PHP 6 and MySQL 5 for…”). The chapter that covers Unicode and other new features in PHP 6 go through things that aren’t even in the PHP manual yet! In some cases, I found out what was possible by downloading presentations that some of the PHP developers have given over the years. But, I was still left with using and explaining functions that aren’t formally documented. In some of these cases, functions wouldn’t work as expected. One place I found some help was searching the PHP internals message group. This is where the PHP developers discuss changes in the language. In other cases, I had to go to the PHP source code itself (written in C) to figure out how a function was to be used. This level of digging isn’t for everybody, and fortunately isn’t necessary for almost everyone, but was an interesting experience for me.

Q & A => Is there any thing that you still consider hard to do on the computer, or that you’ve had trouble doing, or have had trouble learning?

I just wanted to include this question to reiterate that yes, I get stuck, have troubles, don’t always grasp things the first time around, and so on. I do believe that whatever skills I have as an author in part come from my going through the same trials as most readers. Normally I get through these hurdles by taking breaks, re-approaching something from a different perspective, breaking problems down into smaller parts, etc. In thinking about the things that I find hard to learn or do, anything that’s lacking good documentation is infinitely harder to pickup. Whether it is a lack of documentation (as with some things in PHP 6, see above, or in the new Adobe AIR in its beta version) or the lack of a clear explanation (which we all know is too-common in computer books), not having a usable resource when learning something makes it challenging on another level.

In terms of specifics, I think some of the very advanced OOP stuff is hard to grasp. Also, going between different database applications–MySQL, Oracle, PostgreSQL, SQL Server, SQLite–is tricky and fraught with errors. And, for some reason I have a really hard time with software that’s supposed to simplify something I already know how to do. For example, I find developing databases in MS Access to be beyond me because I’m used to getting my hands dirty, not using some GUI approach. Some of the more advanced Unix and Linux issues will send me searching the Web for a day. That’s all I have off the top of my head, I’m sure there are many more things that trip me up.

Q & A => What are your favorite tools of the trade, editors and such?

I wrote about this some in the Mac-only newsletter as I primarily use a Mac. I do run Windows (on my Mac) for testing purposes and to take images for the books, but I prefer using a Mac if I can. (As an aside, Parallels is excellent for running Windows on a Mac.) In terms of actual software that I use, this means BBEdit, Transmit, Firefox, and Terminal. For non-Mac users, BBEdit is a text editor, a GREAT text editor. It has lots of good features. I’ve always preferred using a text editor over an IDE, mostly because I’m not a design kind of person. I’ve tried two IDE’s–Zend Studio and Nusphere’s PhpED–but don’t use them regularly. I never really got into Zend Studio (it ran rather slowly and didn’t have the features I wanted) but I have been impressed with PhpED (disclaimer: I’ve been doing some writing for Nusphere, which is why I’m now familiar with their IDE). Unfortunately PhpED only works on Windows. Despite the fact that I tend not to use IDEs, I’ve started using Aptana Studio for my Adobe AIR work and it’s really wonderful. It comes in a free version and can be used for (X)HTML, CSS, JavaScript, PHP, even Ruby on Rails! It runs on most operating systems.

Transmit is my FTP application; if you do Web development, a top-notch FTP app is worth the money. I’ve not yet mastered CVS or Subversion (software that helps manage the versions of documents on your computer and on a server; often used in group projects). For testing and developing Web sites, I can’t speak highly enough of the Firefox browser. Even if you don’t use it for your day-to-day Web surfing, do use it for testing purposes. It has tons of add-ons that you can install (all free) that really, really help. Naturally I also use Photoshop. It’s so very expensive but nothing really comes close to what Photoshop can do (or how easy it is to use). Every so often I attempt to use the open-source GIMP for image editing, but it never really satisfies me.

One thing I’ve learned, which applies to any application, is to read the manual. If a program has a quick start tutorial, go through that first. Then, after playing around with the app for a while, go and read the manual. You’ll always learn ways to do what you’re already doing more efficiently. I will often go back and re-read the manual every year or two, just to remind myself of what’s possible.

Q & A => Besides your books, what other author do you respect and recommend?

I get this question, or a variation on it (i.e., what book do you recommend that discusses X), and, unfortunately, it’s not one I feel I can answer. First off, although I read a fair number of computer books, I don’t always read them cover-to-cover or attentively (the kind of thing that might annoy me if someone did it with my books!), so I don’t always get an appropriate sense of a book. More importantly, as a writer myself, I don’t approach books the same way the average reader might. So I don’t think my opinion will be as valid as that of a non-writer. Finally, there may be a conflict of interest as my books compete with other books. For all these reasons, I just don’t feel like I can answer such a question. Normally I recommend people check out the reviews at Amazon or wherever. As a writer, I know for a fact that some reviews aren’t valid (e.g., I’ve seen a review where they said that my chapter on X was poor, even though the book didn’t have a chapter on that subject), but overall that’s a reliable resource for opinions on things.

Q & A => What is Linux and what makes it better than other OS’s? Which version of Linux do you recommend?

Depending upon whom you ask, Linux is either a version of Unix or is distinct from (but very similar to) Unix. It’s a testament to how dominating Microsoft is that lots of people don’t even know that there are other operating systems besides Windows. Ironically Unix predates Windows (and Macs) but was not intended for desktop computers so still has a limited market share. WIkipedia (or other resources) can give you a more fact-based history and distinction but what I see this question as being is “Should I be using Linux and, if so, which version?”

If you’re working with PHP or MySQL or PostgreSQL or Ruby, or if you’re hosting Web sites, you’re going to end up familiarizing yourself with servers to some degree. Certainly you can develop Web sites and program in many languages or use different technologies on your desktop, but when it comes to one computer talking to another, you’ll use a server. And server’s normally use a different OS than a desktop. Unix and Linux are popular for servers not just because they’re free (and, in fact, not all versions of Unix and Linux are free, like Mac OS X). I would attribute their popularity to their stability, security, and to being a natural environment for these technologies. For example, PHP was written on Unix/Linux for Unix/Linux and later ported to work on Windows. The fact is that a properly set-up Linux server will run and run without problem. But they can do so in part because there’s a limit to what’s being demanded of them.

As people became more familiar with Linux servers, and saw how reliable they were, there was an interest to make a desktop version. Desktop Linux has an advantage over Windows and Mac OS X in that it’s cheap or free and doesn’t require the same level of hardware. I first started using Linux on a desktop computer in 1999 (using RedHat, one of the most popular distributions). Lately I’ve been using Ubuntu, which gets rave reviews. Personally, it’s great that you can download and install Linux for free, that it runs well, has some neat features, etc., etc. but I just don’t see it as being a viable option for most people. I definitely think it’s worth playing around with and experimenting on, but I don’t know that many people would use it as a long-term, only operating system solution. Once you get everything set up and running, it’s wonderful and will work forever without complaint. But getting Linux to recognize your modem or your mouse or your whatever can be nearly impossible for the average user. And while you can get tons and tons of software for free, you can’t get comparable software (or games) to things like Microsoft Office (OpenOffice isn’t nearly as powerful), Photoshop, and more.

This is one of the reasons I prefer Macs, by the way. The latest versions of the Mac operating system–Mac OS X–is Unix (FreeBSD). So I can get into the computer on a command line level and install most things I’m used to using and have it run well. But I can also easily install a printer or use common applications or my wife and friends can use the computer without even being aware of the Unix underpinnings. It’s really the best of both worlds to me.

Q & A => Do you feel that its best to build a project with an open source resource or to start from scratch and why?

As you probably gather from what I write about, I’m pretty big on open source technologies. But when it comes to creating a project, I don’t personally use open source stuff very often. Mostly that’s because the overhead of the open source software is too much for project I’m developing. For example, if you start with some CMS software, it has tons of built-in flexibility. But if you’re project doesn’t need that flexibility, then you lose some efficiency with no real benefit for you. A second reason I might not use an open source resource is that I’ll inevitably need to modify it and that’s just going to be too much effort.

There are times when I will use an open source option; I will almost always do so when I need a forum or a search engine. These are two subjects that are complicated and expansive enough that’s it’s often best to start with an established foundation. Similarly, if I just need a CMS or a blog, I’ll probably go the open source route.

Q & A => What should I do/learn/pursue?

This question also makes the most frequently asked list, in various forms. Sometimes people want to know what other languages or technologies to learn; sometimes they want to know what to pursue for the sake of their education or vocation. I would start by stating unequivocally that you shouldn’t put too much emphasis on career advice from strangers. I know what I know, what works for me, but that doesn’t mean that’s what’s best for you. Second, learn as much as you can and keep learning. I once read a suggestion that you should learn a new programming language every year. That’s more than a bit overzealous but the point is valid. Frankly, there’s no reason for knowing only one language. If you’ve gone through the effort once, expand your horizons. And, any language you learn next will be easier to pick up. For example, if you know PHP, much about C will be familiar. If you know C, then C++ and C# are logical follow-ups. If you really want to understand object-oriented programming, learn Java or Ruby.

Which language you choose to learn is a tougher question. One common mistake I see people making is: I know PHP, so I’ll create a desktop application in PHP. Bad idea! Just because you know a language doesn’t mean it’s the best language for every possible situation. If your whole focus is on Web development, stick with PHP, JavaScript, maybe Java, and Ruby (for Ruby on Rails). If you want to try using ASP.NET, learn C#. If you want to create desktop applications, you might want to go with C++, C#, or Java. If you’re only concerned with making applications for Windows, you can go with Visual C++ or Visual C#. That’s how I view the more commonly-mentioned languages. There’s also Perl, which can be used for many things and is considerably more popular than PHP. But I see it primarily as a command line utility, a more specific target. On the really technical side, there’s also Smalltalk and Lisp and the like, which are highly regarded but I haven’t personally used them myself (I’m comfortable with PHP, JavaScript, C, C++, C#, Ruby, Perl, and Java, to varying degrees).

In terms of other technologies, being familiar with one or more database applications–MySQL, PostgreSQL, Oracle, SQL Server–is a good thing and not that hard to do once you understand the fundamentals of a relational database. SQL is the common language of all database applications, so after learning it, it’s really a matter of knowing the names of functions and the available data types. I would also say that basic familiarity with a data description language like XML or JSON is good to have. XML can be quite daunting, particularly when you get into doing XSLT and such, but it’s pretty easy to grasp primary XML. If you’re doing Web development, getting to know something about Web servers–Apache and IIS being the big two–is very useful.

The last thing I’ll say about particular technologies is that there seems to be separate paths people tend to take. Windows developers learn ASP.NET, SQL Server, IIS, Visual C#, etc. Web developers (that are not Windows-centric) often learn PHP, MySQL, and maybe Apache. People that do lots of command line things, primarily on Unix, might go with Perl, C, Ruby, etc. Again, which body of technologies you pursue depends upon within which lot you fall. Although there are overlaps and cross-interests.

Aside from specific languages and technologies, there are skills that seem to be valuable in many jobs (as you read this, keep in mind that I haven’t had a “conventional” job in 10 years!). Good communication skills may be the most important. This will normally present itself, or the lack thereof, in any interview or correspondence. I know for a fact that I’ve had some success as a Web developer because of my communication skills. It just makes clients more comfortable. And this isn’t just a matter of actually talking or writing well, but also replying to emails promptly and keeping people informed. It’s a problem if you miss a deadline on a project, but it’s a much bigger problem if you miss a deadline and haven’t been in contact with the client as well! It also seems that many employers want you to be simultaneously an expert in a couple of subjects and well-versed in several others. I’m not sure that’s possible, but the fact is that everyone stretches the truth a bit when it comes to saying what they “know”! It also seems that the size of the company dictates how broad your knowledge should be. Smaller companies need people that can fulfill lots of roles. Bigger companies prefer someone that’s an expert in a smaller area.