Creative Synthesis Blog

Talking about Creativity as Combination, The thoughts and works of the Creative Synthesis Collaborative.

Feed Subscriptions

RSS FeedRSS Things
RSS Comments

Present This Blog

A Friendly Note

To support us, Make a Donation - we rely on private donations for our operating costs, things like paying salaries and stipends, office space, and even post-its.

Rolling Links

Things by Category

Things by Month

• You can follow comments through the RSS 2.0 feed. You can leave a comment, or trackback.

An introduction to web development.

We assume some familiarity with programming in general, probably from a more traditional background of something like java - or possibly python. Traditional programming is kind of like becoming an apprentice clockmaker, you’re given a nice set of tools, a rich tradition of techniques and the ability to meticulously craft something beautiful. Unfortunately web programming is often like becoming the assistant to a bad plumber. You meet him on a job, he’s brought the wrong tools, the pipes are clogged, some of them are from 20 years ago, and you have to fix it with some stuff that’s lying around the job site.

While web programing can seem incredibly unstructured, it doesn’t have to be this way. Of course, by trying to structure how to learn it a bit we are going to narrow some of our choices (and actually select our tools well in advance). We’ll talk about some alternatives at the end.

An overview of the Process:

Web programming basically starts with a server. That server serves up some markup, sometimes that markup is static (lovingly handcrafted), say from an html file, sometimes is is dynamic and generated from code on the server in the form of php, python, or even something like perl, asp, or java. The point is that once the server delivers the markup to the browser it is done. The browser will then decide how to render the markup, based on any style information it has. Any user interaction now comes from default behaviors like form buttons, or javascript code that runs client side in the browser.

Core Concepts:

Markup: A structured markup language that is interpreted by the browser. HTML usually fills this role, but it could be XML or some other specialized language. This has meaning only in the sense that it is interpreted by a browser. If the browser doesn’t understand the markup - it is meaningless. This isn’t really programming, because you can’t actually program. We usually call it coding or markup.

HTML or XHTML: This is the kind of markup we’ll be dealing with. You can think of it as a tree of elements. An element is something like a <div&rt; or an <a>. Sometimes these elements have attributes, like an id or a class name. This allows us to reference them in CSS or Javascript. Other times they have embedded style attributes, which we’ll try to avoid doing (it gets messy). Sometimes they have legitimately functional attributes, like an href. An <a> without an href attribute is pretty useless, the <a> is a link and the href attribute tells it where to go. So normally expect to see something like: <a href=”www.google.com”>.

The part of the element we’ve just showed you is just a tag. Most elements consist of open tags, close tags, and attributes. So to be perfectly precise about our link we would need something like: <a href=”http://www.google.com”>Link to google</a>. That “Link to google” bit is the content of the element. Elements can get quite complex once you start nesting them, just like a tree.

Style: Cascading StyleSheets, or CSS, is what makes the html look like a web page. Browsers usually have some idea of what things are supposed to look like (defaults). For the most part though, they trust the CSS information and will use that to style things. For example, adding a property like div#borderdiv {border:1px solid red;} will put a one pixel solid red border around the div with the id borderdiv.

The Browser: It displays HTML and styles it according to the CSS - Pretty much the same way you would if you read raw HTML code and drew exactly what the CSS told you to do. Of course, sometimes you would get bored and start doodling randomly, and of course nobody would be able to draw exactly the same way. That’s exactly how Browsers manage it.

Traditional Programming Concepts

Algorithms: There are no algorithms in HTML or CSS. Any actual programming functionality at this point needs to be coded in javascript. At the server level, a scripting language like php can be used to program

User Actions: Actions at this level either take place through links and buttons, or events. Links and buttons are generally tied to either server calls (http calls for a new page, or to send/get information to a separate script on the server) or javascript algorithms that manipulate the page at a local level. Events can occur with javascript either based on regular timers, based on timers that ‘poll’ the page to see if changes have occurred, or as call back functions that occur when information returns from the server.

Data Storage: Data at this point is stored in one of two ways. It is either stored structurally in the html itself (and that data is shown to users in a structured way, unless it is styled to be hidden) or it can be placed in javascript, coded as either variables, plain text, or a structured format such as embedded xml. At the server level this stuff is usually queried from a database like MySQL.

Getting Started

Server Environment: This article assumes you have access to a webserver running something like linux / apache / mysql / and php (what is commonly called a LAMP environment). We don’t need all of these things exactly like this. At the minimum we need php, mysql is also handy (but postgresql would work allright). Apache is handy because of its general familiarity and interoperability. While php 5 is the current version of php, we’ll mostly concentrate on php 4 because of the still fairly ubiquitous hold it has on the php community.

A local server environment may be highly useful for testing. Setting one of these up shouldn’t be so hard. Ideally they are fairly sandboxed kinds of environments. Bitnami’s WAMPStack is a good window’s solution while MAMP works pretty well on the Mac. Linux users, this should be pretty easy to set up (you may have it set up already).

Development Environment

Those of you coming from a more traditional programming environment (such as java) may be surprised to learn that there isn’t too much of a focus on an integrated development environment in web programming. Efforts do exist, but for the most part there is nothing comparable in popularity to something like Eclipse. Basically all you need is a good text editor and a browser.

An Editor: Textmate is by far the best choice on the Mac, it features svn integration, bundles for nearly every applicable programming language, and great extensibility. The E Text Editor is a Textmate clone available for windows. Linux users likely already have an editor that they are used to. One of the reasons textmate (and it’s clone) is great is that it has a lot of useful bundles for some of the disparate tools we’ll be working with:

A Browser:When developing for a web based application you’ll have to make sure it eventually works in all browsers, but some browsers are easier to work with than others. Firefox is generally a good choice for web development, in part because of some of its great extensions:

Things to learn or ‘know’

XHTML: Knowing html is a pretty necessary step for anyone doing web programming. Even if you are able to abstract yourself pretty far away from doing it, it is pretty important to at least know what the features are and what good markup looks like. There are some good references:

PHP: PHP will be what we’ll focus on for the generation of HTML and other server side actions. We’ll be using Codeigniter as a framework for PHP, but its important to understand PHP’s capabilities by itself.

CSS: CSS allows us to make the page look good, work consistently and generally present a good image of itself.

Javascript: Javascript allows us to do some programming on the client side, after the basic markup has been served to the browser. Most of the time this takes the form of programming for user interaction. For example, a user clicks something and we want the page to change in some way.

MySQL: Databases allow us to keep information on the web server for use in our applications. While strictly speaking there are a lot of database options, many of these aren’t highly practical. Distributed ‘cloud’ databases are becoming more common, but simple solutions like MySQL and PostgreSQL still serve as a good introduction. MySQL (and other databases) have their own ‘language’ to work with data, but for the most part we’ll be abstracting some of that out with PHP and further with Codeigniter.

Targeted tools and how to use them

Javascript Library
There are a lot of competing javascript libraries that provide different kinds of premade functions. They vary quite a bit in what the offer, how easy they are to use, and so on. We target JQuery as our library of choice.

JQuery and References for Learning JQuery

Server Framework
Because of the fairly unstructured nature of web programming it helps a lot to have a framework to provide consistency in what you’re doing. Not only do these tend to help us organize the server files we’ll be using to generate pages and entire web applications, but they often come with a set of useful tools and supplementary code libraries, formatting conventions and more.

Codeigniter is a nice MVC / Active Record framework, which we’ll target. It isn’t an overly heavy framework, can be easily picked up and offers a nice collection of base functionality we can build off of. There are a lot of nice references and tools available:

Other Tools and References

Ajax: Ajax (Asynchronous Javascript and XML) is a technique for data exchange with the server. Normally when we want to talk to the server we need to refresh the entire page. This is alright if we are doing something large (like moving to a different part of an application). There are plenty of times, however, where we need some information that is small, or is dependent on user interactions that need to occur ‘live’ or close to it. One use of Ajax might be to suggest possible search results as a user types. It would be fairly irritating if each time the user typed a character the page refreshed to populate this list. At the same time, that might be a lot of information to keep locally so we could pull it up with just javascript. Ajax bridges these two extremes. Data is retrieved using the XMLHttpRequest object that is available to scripting languages run in modern browsers, through the use of Remote Scripting in browsers that do not support XMLHttpRequest. That data doesn’t actually have to be XML formatted, despite the name.

Feeds: RSS and Atom are formats for delivering regularly changing web content. Why should you care? Lots of user are getting used to the idea that they can use feeds to follow information added to applications, changes, updates and things like that. If you check around you might see that a lot of applications have built feeds into the application in intelligent ways.

Apache Configuration: Knowing a little about how to configure the webserver itself may be useful. For example, knowing a little bit about .htaccess files allows you to do nice things like url rewriting.

  • htaccess cheatsheet - comprehensive listing of the directives that you can use in htaccess files.

SVN / Version Control

General Purpose Tools

Validation:

Code Cleanup:

Documenting Code:

  • Naturaldocs - Great multi-language documentation generator.

General Purpose Reference

Reading List

  • A List Apart - Web Magazine for “people who make websites”, often delves into the nitty gritty of html and css development and techniques.
  • Smashing Magazine - Daily web design (plus extra design) articles and discussion.
  • Vitamin - is nourishment to help the web grow. More specifically it focuses on web design and development.
  • UX Magazine - All about the user experience.
  • Boxes and Arrows - Focus on web design in terms of user experience and usability
  • Devlounge - Articles on programming, design and development for the web - though quite a bit more as well.
  • Alertbox - Jakob Nielsen’s newsletter on what not to do (and occasionally, what to do) on the web in terms of usability.


WebDev 202

More advanced topics, starting with design issues on the web.

Design Issues

Web Colors:

  • Colourlovers - social website focused on sharing color palettes.
  • Kuler - Similar, but can be used with great mac color palette plugin Mondrianum

Web Typography:

Design Techniques and Frameworks

This thing was constructed by .
Matthew is the Director of the Collaborative. He writes rarely, and that makes him sad.

• You can follow comments through the RSS 2.0 feed. You can leave a comment, or trackback.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*