A solid foundation on which more meaningful learning can happen
As someone who has previously taught computer programming for nearly a decade, I’m often asked questions that involve “what’s the best way to go about learning to program computers,” or “what’s the best way to get a software engineering job,” or “how can I learn to build mobile or web apps?”
Most of the readers of this blog have probably faced the same question at some point in their career. How did you answer it? I’ve seen many different responses: “come up with an idea for an app and build it,” or “get a computer science degree,” or “go read The Little Schemer,” or “join an open-source project that excites you,” or “learn Ruby on Rails.”
The interesting thing about these responses is that, for the most part, they can be classified into one of two categories: top-down approaches or bottom-up approaches. Top-down approaches are informed by the opinion that it’s better to be thrown in the middle of an application or a framework which encourages the learner to piece together knowledge in that context. Many books and online tutorials use an explicit top-down approach, often starting with the basics of a popular methodology, framework or technology. The most visible example of this are books on Ruby on Rails — they almost always inevitably begin with a description of the Model-View-Controller design pattern, but defer the incredible number of non-obvious ideas that make it up (Object-Oriented Programming, for instance).
On the other hand, a bottom-up approach starts with the basics/fundamentals of programming and then slowly builds your knowledge over time. In contrast to top-down approaches, bottom-up approaches try to minimize the number of these non-obvious ideas that the learner has to take for granted. Khan Academy and Code Academy are two examples of online sites that use a bottom-up approach to teaching programming. For the most part, they completely leave out any specific framework and focus on fundamentals of programming.
6 highlights from Axel Rauschmayer's webcast
- Layer 1, Single object. [at 3:55]
- Layer 2, Prototype chain. [at 14:52]
Layers 1 and 2 together form a simple core, which you can refer back to if confusion sets in. This way you can re-ground yourself at any point in the foundations of the course.
Using closures in a different way
this references can often be totally unrelated to the lexical scope of a function. To work around that we often see tricks like:
var that = this;
this. Sounds crazy? Let’s see.
PHP's experiencing a renaissance, with improvements and new standards
The programming language many love to hate is experiencing a renaissance. This is not your parents’ PHP. The new PHP is a more mature language with community standards, a growing affinity for interoperable components, and a passionate movement to improve performance. If you have bypassed PHP for alternative languages, or if you are a PHP veteran unaware of recent changes, you owe it to yourself to give PHP a second look.
PHP 5.5 (the latest stable build as of this writing) has made major progress from earlier versions. Recent PHP releases contain powerful new features and helpful developer tools, such as a built-in web server, generators for simpler iteration, and namespaces. With PHP 5.4, traits were introduced (a la Scala or Perl) to allow code reuse in single inheritance languages, as well as closures, which allow you to code PHP in a functional style. Other important features include the built-in FastCGI process manager and
phpdbg debugger, and a new password hashing API that makes it easy to hash and securely manage passwords in PHP.
Reducing object bloat begins with doing less
In almost every project there are those objects which seemingly get involved in every aspect of the application. These are the so-called “god objects”: they can do everything (omnipotent), they know everything (omniscient), and they are everywhere in the application (omnipresent). Most often these are objects which are at the intersections of business logic: User or Account, Project, and Order are all usual suspects.
One of the core tenants of object-oriented programming is that large problems are made up of many smaller problems, and as such, can be solved by providing solutions to those smaller problems in the form of objects. God objects violate this core tenet by trying to be one solution for too many problems.
A typical example of a god object is the
User model of many Rails applications. Here,
User might be responsible for user specific information as well as knowing about phone numbers, emails, profile information, preferences, and handling authentication. It’s too much and it results in
User being coupled to every aspect of the application.
Although there are many tactics a developer can employ to limit the influence of these “god objects”, one of the simplest is just reassigning some of their responsibility, and using a delegation pattern may be the simplest way to do just that.
Let’s look at four different ways we can use delegation in Ruby.
Practical strategies for debugging
This is a follow up to Brian MacDonald’s post on Debugging for Beginners. I read Brian’s post avidly, as I am always keen to take a look at different approaches to finding those elusive problems that plague all programmers (even those with decades of experience) from time to time.
Anyhow, I have to admit that I was a little bit…disappointed. You see, Brian writes in a wonderful, readable way, about topics that concern all programmers, whatever their background. But, I found that the general focus of his article was less on how to debug (even at a higher, theoretical level), and more about how to make fewer mistakes.
The changing landscape of web platform extensibility
From its nascent days, the growth of the web has been marked by the waxing and waning of technologies, frameworks and ideas. Old ideas and technologies expire and fade away, and new ones arise in their place. Much as the cicada molts and leaves behind an old shell as it moves into adulthood, the web has seen countless ideas come and go as it has evolved.
Relics (and Catalysts) of the Web
Remember XHTML? More specifically, do you remember caring deeply about XHTML? You likely do. Do you still care about XHTML? Chances are, the answer is no. The same goes for Flash, DHTML, HTML Components and countless other buzzwords of the web that once felt so alive and important, and now feel like relics of another time.
Occasionally, however, we collectively stumble upon ideas and technologies that stand the test of time. These are ideas that don’t just evolve with the web–they are often a catalyst for the evolution of the web itself. Ideas like Cascading Style Sheets and XMLHTTPRequest, the vendor hack that spurred the AJAX revolution, are two examples among many.
Rapid web development with MongoDB, Express, AngularJS, and Node.js
Problem 1: Prototyping, or, how do I build the damn thing?
With the growing popularity of the lean startup model, the pressure to shorten product development cycles and churn out a prototype application quickly and cheaply has never been greater. And, as developers, we’re doing this better at an exponential rate. Projects that once required hundreds of millions of dollars of capital in the late ‘90s became projects that you could build in a month or two with a couple tens of thousands of capital at a startup accelerator around 2008. Now, these sorts of projects are being churned out at hackathons around the country in a matter of days. As great as this seems, we can do better.
Part One: Easily find Chromecast devices on your local network
Now that Google has opened up the Chromecast API for anyone to play with, it’s possibile to create iOS applications that can leverage the $35 device as a way to display to HDMI devices wirelessly. In this series of tutorials, we’ll go over the API, starting with configuring your project to use the framework, and finding devices out on your local network to play with.
Let’s assume you’ve set up a Chromecast device attached to an HDMI TV and have it configured for your local network. Now it’s time to get an App set up to use it. We’ll use the iPhone Simulator in these examples, since it can talk to Chromecast devices just like a physical device, as long as the Mac you are developing on is on the same LAN as the Chromecast dongle.
Begin by creating a project, as usual. For this example, I used a single-view Storyboarded app. I set up an
UITableView inside the default
UIView, hooking it’s datasource and delegate to the default view controller the wizard had created. Next, I went to the Google Google Cast API page and downloaded the iOS framework, then used the “Add Files…” project option to add the framework to the project, copying in the files.
An excerpt from the third edition of PHP Cookbook
Editor’s Note: The following excerpt is from the third edition of PHP Cookbook by David Sklar and Adam Trachtenberg. For those already familiar with PHP, PHP Cookbook shows you how to overcome specific problems in your everyday work. Programmers coming from other languages will also find recipes helpful which demonstrate how to accomplish a particular task in PHP, such as sending email or parsing JSON, that you may already know how to do in another language. The recipes are self-contained in a simple problem-solution-discussion format with explanations of how and why the code works the way it does.
This cookbook arms PHP developers with important information for key PHP updates, particularly data manipulation, web services, internationalization, database access, security, and testing. This excerpt, from the chapter focused on Web Fundamentals, demonstrates how to set the HTTP Status Code and how to redirect a user to a different web page than the one they requested. Portions of this chapter have been edited and condensed for the purposes of this excerpt.