I’m an interface developer
I’m an interface developer
In his latest post Roger Johansson asks the question Are we designers or developers?. I have a simple answer for that. None of them. Let me explain: First we have these people calling themselves developers. And boy do they know programming… and math… and… no that’s all. Many have a masters degree in computer science, a […]
Safari now available on Windows
Hi, this is just a short post to let you know that Safari is now available on windows. It’s was unveiled at the World Wide Developer Conference 2007 by Steve jobs himself. I can’t stress enough how important this is for all Safari users. Most developers still use Windows when developing web sites (it’s changing, […]
An Introduction to Web Standards
I’ve recently come to the conclusion that a great number of Web developers either don’t know about Web standards, or simply don’t care. For those who aren’t already aware of the standards I’ll offer a brief introduction along with resources for additional information. For those who don’t care, or who are anti-standards, I’ll offer some examples as to why I feel they’re important.

Standards are simply
the rules of the road for the Web
I’ve recently come to the conclusion that a great number of Web developers either don’t know about Web standards, or simply don’t care. For those who aren’t already aware of the standards I’ll offer a brief introduction along with resources for additional information. For those who don’t care, or who are anti-standards, I’ll offer some examples as to why I feel they’re important. For those of you already in the know, feel free to add your own advice, examples or pet peeves in the comments section.
The reason for Web Standards
According to the Web Standards Project Mission, “The World Wide Web Consortium (W3C), along with other groups and standards bodies, has established technologies for creating and interpreting web-based content. These technologies, which we call “web standards,” are carefully designed to deliver the greatest benefits to the greatest number of web users while ensuring the long-term viability of any document published on the Web.”
Think of these as the rules of the road. When you are driving a car in Ohio you know you have to drive on the right side of the road, stop at stop signs, not enter an intersection unless there is room for your vehicle on the other side, yield to pedestrians, etc. If you are driving in Hong Kong you know to drive on the left and follow the various rules relevant to that jurisdiction. Following these rules makes the driving experience more pleasant for everyone; whereas ignoring these rules will, at best, annoy other drivers and, at worst, cause a traffic related fatality.
In most cases, a non-standard Web site isn’t likely to cause fatalities, but anything is in the realm of possibility. Errors in formatting can cause content to render incorrectly. Imagine if the word “Never” wasn’t visible to users reading the sentence “Never pour gasoline on an open fire.” A reader unfamiliar with the combustible nature of rising gasoline vapors could easily immolate himself. That’s an extreme example, but whether your site is about fire prevention or your book club, you probably don’t intend to misinform or confuse your readers.
Following Web standards lets you increase the odds* that your site will be properly rendered by most browsers and user agents and that your information will be more accessible to users and search engines.
* I say “increase the odds” rather than “guarantee” because there are still differences between the way browsers interpret the standards.
What are the Web Standards?
Different standards are available for different purposes, but for the most part standards will define the type of coding that you should use when creating a Web page or stylesheet, or the procedures or policies you should consider when creating the site. Thus if you are building a site in HTML using Cascading Style Sheets, and want to ensure your site is Section 508 compliant for accessibility, you might follow the standards for HTML 4.01, CSS 2, and Section 508.
For example, HTML standards specify using
to start a paragraph,
for a primary header and for emphasis. CSS standards specify things like color and position, so that a purple header could be defined in a stylesheet by: h1 {color:#571963}. Using a descriptive word or phrase in the alt tag of images conforms to accessibility standards (both 508 and WAI).
One of the most overlooked HTML standards seems to be the inclusion of the correct document type. For example, if you are building a site using XHTML 1.0 (as is true of many Case sites) you would include this document type:
This small piece of code tells browsers and user agents what version of HTML you are using, so they don’t have to guess when rendering the site. This is like telling Babel Fish whether you want to translate a phrase from Dutch to English or from German to English. If you don’t give it the right information you may not get the right result. I’m amazed by the number of sites don’t include this basic information.
Another important standard for HTML 4.01 and XHTML 1.0 is the separation of format and presentation.
Headline
is an example of format, indicating that something is a header. Styling the
with CSS, either in the document or in an external stylesheet, to be a certain size, color and font would be an example of presentation. In the old days of the Web this was done within the HTML using the now deprecated tag. In the past one might have typed
Headline
. This not only filled up your page with a lot of extra code, but it also meant that if you decided later to make all of your
’s a different color you would have to go and change all of the font codes one by one. When using a style sheet you can define how your
’s will look in one place. To change the color you just make the one change in the stylesheet and you are ready to go.
Separation of format and presentation isn’t a particularly new idea, but adoption has spread slowly. CSS 1 was first introduced in 1996 and the CSS 2 recommendation has been around since 1998. While many sites use CSS, it is still not uncommon to stumble upon current sites that are still using older codes such as .
Why this has been on my mind
A few weeks ago a friend sent me a link to a pretty cool looking site for an online magazine. Alas the site wasn’t standards compliant and therefore didn’t work properly. This particular site was Flash-based with dimensions too big to fit my screen. The page had no scroll bars so I couldn’t get to the menus to navigate through the site. I could see the whole site on my Mac, but not on my Dell, and I’m pretty sure I’m not the only one to have had that problem. Since I couldn’t navigate the site, they might as well have posted a page that said “Do Not Enter. We don’t care about your business.” If they had built a compliant site they would have ensured greater accessibility to users and not had this problem.
I’ve found a number of other non-compliant sites while working to compile a list of local Web developers. Departments without Web staff often look to outsource their Web projects and turn to me for referrals. Thus I’m trying to put together a list of local (to support the regional economy) developers who I can trust to build compliant sites that follow the Case design scheme, maintain a logical navigational structure and support the goals of the client. This has not been an easy task.
The problem is that almost anyone can learn to build a Web site, but only a few can do it well. There are a lot of firms out there, but the quality of work varies dramatically, and only a handful build standards compliant sites. Sites with major compliance errors don’t end up on my list. This isn’t just because I’m persnickety. If a site fails validation because of a few stray &’s or they’ve forgotten to close a few
’s I’m not worried. Such errors are easily corrected and don’t disturb the overall functionality of the site. But if a site uses tags, doesn’t include a doctype, leaves alt tags blank on all of their images, etc., then I will conclude that its designers are not professional and will not be able to offer the client the advice or service necessary to implement a successful site.
Conclusion and Disclaimer
If you’ve ever built a Web site, you’ve followed at least a few of the standards. The site wouldn’t work if you hadn’t. For example if you left out the
tag your page wouldn’t render. Since we’re all following some of the standards anyway, I would just encourage everyone to learn and apply more of them. As you become more familiar with them you’ll find that your sites become both easier to use and easier to build. To learn more about Web standards visit The Web Standards Project and the resources below.
Standards compliance is an ongoing goal of mine, but I’m only human. Not every site I’ve built is standards compliant, and the errors become more egregious the older the pages may be. Since I readily acknowledge this you don’t need to go hunt them down, they are out there, and I know it!
Web Standards Resources
- Asterisk Web Standards Archive
- Designing With Web Standards, Second Edition by Jeffrey Zeldman
- Jeffrey Zeldman: King of Web Standards (Business Week)
- Section 508: The Road to Accessibility
- The Web Standards Group
- The Web Standards Project
- W3C Cascading Style Sheets, level 2 CSS2 Specification
- W3C Cascading Style Sheets, level 1
- W3C HTML 3.2 Reference Specification
- W3C HTML 4.01 Specification
- W3C XHTML™ 1.0 The Extensible HyperText Markup Language (Second Edition)
- W3C Technical Reports and Publications
- Web Accessibility Initiative (WAI)
- World Wide Web Consortium (W3C)
What italic means
Finally an image that dispells all myths about the element. As you can see it’s all about presentation. Disappear you foul demon! (You have more HTML humor? Show me in the comments)
@media Ajax London, here I come
Just a short note that I’ll be attending @media Ajax London, 19th-20th November. If you see me, come by and say hello!
Usenet Newsgroups: Anachronistic Service or Useful Communication Tool?
Earlier this week ITS announced that it would be taking down the Usenet news server as of December 5, 2007. In a fit of nostalgia, I opened up my newsreader (Mozilla) to leave a farewell message on cwru.general. Oddly enough, my message got a response; others (not many) were still using Usenet! This led me to wonder what had happened to newsgroups. Did the generation that grew up on the Web not know about newsgroups, or did they know about them but prefer the Web? In this age of Web 2.0, where some update their Facebook status by the hour, users pose questions on discussion boards such as http://forum.case.edu, and writers merge their Twitter, Pownce and Jaiku posts into central RSS feeds that can be shared on their Tumblr blogs, is there still a place for Usenet news?

alt.politics.usa.constitution as seen in
Seamonkey (above) and Google Groups (below).
Click on the images to enlarge.
Earlier this week ITS announced that it would be taking down the Usenet news server as of December 5, 2007. In a fit of nostalgia, I opened up my newsreader (Mozilla) to leave a farewell message on cwru.general. Oddly enough, my message got a response; others (not many) were still using Usenet! This led me to wonder what had happened to newsgroups. Did the generation that grew up on the Web not know about newsgroups, or did they know about them but prefer the Web? In this age of Web 2.0, where some update their Facebook status by the hour, users pose questions on discussion boards such as http://forum.case.edu, and writers merge their Twitter, Pownce and Jaiku posts into central RSS feeds that can be shared on their Tumblr blogs, is there still a place for Usenet news?
I think perhaps there is. But before we ponder that, perhaps we need to review—for those who don’t know—what Usenet is/was all about.
History
Many users today think of the World Wide Web and the Internet as being interchangeable. But as most of you know, the WWW is only one of many protocols used on the Internet. Back in the era before the WWW (which most users didn’t access until 1994-95), Usenet was one of the most popular features of the Internet. To some it still is.
First created in 1979, Usenet allows users to share thoughts and ideas with one another on a variety of topics ranging from the Internet itself to the latest episode of CSI. While T. V. viewers now discuss their favorite show on Web-based forums, in those days folks dissected X-Files episodes on alt.tv.x-files. (Actually they still do.)
How Usenet is used
As one uses a Web browser to surf the Web, one uses a newsreader to subscribe to and read/respond to newsgroups. Some news readers are stand-alone programs, while others are built into e-mail programs or Web browsers and Internet suites. Once the reader is installed, the user configures it to connect to a news server just as one would configure an e-mail program to use a certain e-mail server. Most Internet service providers offer news server access.
With the newsreader installed and configured to access the appropriate server, users can then subscribe to any of thousands of newsgroups based on their interests. This will be familiar to those of you who use RSS readers to read blogs. With a newsreader you would typically call up a searchable list of the newsgroups provided by your server and subscribe to those you like. Once subscribed you would select a group from your subscription list and download the latest headers (subject lines, that link to messages) to read the various posts. From there you can respond to an existing discussion or start a new thread, just as you would on a discussion forum, but more similar to e-mail in that you can include attachments.
There are thousands of newsgroups available on the internet with topics ranging from alt.tv.survivor to alt.politics.usa.constitution. Many of these will be available through your Internet Service Provider’s news server, but some may be limited to certain servers.
To learn more about using Usenet newsgroups refer to the resources listed at the bottom of this entry.
Is Usenet still viable?
Given the research I’ve done today, Usenet seems to be alive and well—particularly in certain circles. Those circles would be those interested in file sharing. As I’ve been exploring this issue I’ve noticed two trends:
- Newsreaders such as Binary Boy geared towards optimizing music, picture and movie sharing
- Uncensored News Servers, such as Tera News offering uncensored access to groups, anonymous posting and firewall counter measures
I’d like to think that the above are being used to provide more efficient news reading or to give access to users living in countries with unreasonably strict censorship laws; but I’m guessing these folks are making their money by offering an easy way for people to trade naughty pictures and pirated media. With prices for some servers ranging anywhere from $7 to $49 (and up, depending on download limits) per month, I don’t think folks are signing up to share their grandmother’s bundt cake recipes.
What about the rest of us? Is Usenet still a good way to share information, discuss politics and find out how to clean the headlight lenses on your ‘96 Passat? I think it could be. This evening I installed Mozilla’s Seamonkey Internet Suite, on my home computer, to use as my newsreader and subscribed to some of the groups I’d read in the past such as alt.www.webmaster. The group was alive and well, filled with the same kind of reasonable questions, helpful advice, spam and people who shouldn’t be thinking of starting a Web design business, as it always was. Newsgroups are like that, but so are discussion boards. Some members will be knowledgeable, others never will be, and some just want to push their product or start a flame war. A lot of good information can still be traded.
If one is looking for discussion geared towards very specific topics I think Usenet works well for two reasons.
- One Stop Shopping: One can subscribe to groups on cars, sports, T. V. shows, politics, philosophy, etc. and view them all in one place as one does with RSS readers.
- Threaded Discussion: This format is really easy to use. You are presented with a list of headers, so you can choose which topic to read, and then all the messages in the thread are listed below (the way this works may depend on your reader). Google Groups offers Web-based access to newsgroups, but if there are more than a few messages in a given topic it can be very hard to follow. Google presents them in full in order, rather like Gmail. But when you get a few hundred this also involves multiple pages and can be tricky to navigate.
Perhaps I’m just being nostalgic, but this still seems like a pretty efficient way to communicate. Back in the day, I got a lot of good information from newsgroups, and I think if one chooses a group with an active, knowledgeable subscriber-base one still can. And if that is the case one can use these to network, share ideas, promote Web sites and blogs (but only in the context of providing meaningful content to the group) just as one can with Web-based services.
What do you think? Is there a place for Usenet in your social media world?
Usenet News Resources
- An Introduction to Usenet News
- Choosing a Usenet News Reader
- How the Usenet News Protocols Work
- Internet FAQ Archives: What is Usenet? (Historical, yet definitive, read both parts)
- news.newusers.questions
- News Readers
- On the History and Impact of the Net
- Reference to Newsgroups (List of Groups)
- SeaMonkey (Web browser/e-mail/newsreader)
- Usenetpedia: An encyclopedia of Usenet Newsgroups related facts
- Wikipedia: Usenet
- Network News Transport Protocol (NNTP)
P.S. When mentioning specific newsgroups I linked to them using the news protocol. These will only work if you have configured a newsreader in your browser and are using a server that includes that particular group.
Visual Studio 2008 Review
I know it’s a bit late, but as promised here’s a review of Visual Studio 2008. I’ve had it for a while now, but I wanted to wait until I’d worked on a few projects with it before I offered my opinion. Overall, it’s a solid improvement over 2005. The guys at Microsoft have made some good changes that actually improved the development experience rather than just adding a bunch of fluff.
I know it’s a bit late, but as promised here’s a review of Visual Studio 2008. I’ve had it for a while now, but I wanted to wait until I’d worked on a few projects with it before I offered my opinion.
Overall, it’s a solid improvement over 2005. The guys at Microsoft have made some good changes that actually improved the development experience rather than just adding a bunch of fluff. Unlike 2005, you’re not required to upgrade to the newest framework to use it, so you don’t have to upgrade to .NET 3.5 just yet. The IDE is generally a bit faster than 2005 and several of the features that were a headache for my team in 2005 have been made useful. The 2 most notable improvements were support for nested master pages in design view and a huge performance improvement in the table adapter editing interface.
One of the first things I noticed about the interface is the influence from Expression Web. There is a new split view for the designer and several new CSS helper tools. The split view has been in other products, like Dreamweaver, for ages and I have generally not found it very useful and initially, I felt the same way about the split view in Visual Studio. It really doesn’t help much when laying out your pages, but when writing code-behinds, it provides a much quick method for reviewing the layout and server control properties. The CSS tools, much like Expression, seem like they may be useful to those inexperienced with CSS, but for me they were more of a hindrance than help.
The biggest improvement is the javascript support. The support for the ASP.NET AJAX extensions is much improved, but that’s pretty much expected. What surprised me is the extensive intellisense support for javascript. It not only picks up the built-in javascript functions, it provides intellisense for any of your custom functions and variables. While my javascript skills are about average, our dedicated AJAX guy just wouldn’t shut up about how good the new javascript support is, which tells me it’s pretty solid. The new javascript debugging support is nice too, but it requires that you turn on the script debugger in IE, which makes any browsing outside of debugging your apps a pain.
Visual Studio 2008 is a nice step forward for Visual Studio. While some people were hoping for more features, the features that made it in are solid and the overall performance in improved. The javascript intellisense and debugging alone will make it worth getting for anybody working heavily with AJAX and the performance tweaks will satisfy impatient coders like me. There are a few shortcomings (it’s still a memory hog) but the improvements are well worth the upgrade.
This article provided by sitepoint.com.
Happy Holidays from SitePoint!
As I write this, most of Team SitePoint is up on the 3rd floor partying down in style. It’s the end of a big year for us, and we’ve got a lot to celebrate … but of course there’s also plenty to look forward to in the year ahead! In 2008, you can expect the following […]
As I write this, most of Team SitePoint is up on the 3rd floor partying down in style. It’s the end of a big year for us, and we’ve got a lot to celebrate … but of course there’s also plenty to look forward to in the year ahead!
In 2008, you can expect the following from SitePoint:
- 99designs
The new incarnation of SitePoint Design Contests that we launched this year has been so successful that we feel it’s time it was set free to make its own way in the world. This active design community will be split off onto its own site and renamed to ‘99designs’.
Of course, this rebranding will come with a whole new visual design for the site. Watch for us to run a contest in the SitePoint Design Contests community to design the 99designs logo!
- The SitePoint Reference
Our CSS Reference site is already in closed beta, and we’re getting loads of great feedback from the SitePoint forum community. Early in 2008, this ‘reference to end all CSS references’ will open its doors to the world, and will be closely followed by references for HTML and JavaScript … each written by some of the foremost authorities on each technology.
- More great books
Our first title for 2008 will be The Art & Science of JavaScript, brought to you by a star-studded team of JavaScript experts.
- …and lots more!
SitePoint HQ is shutting its doors as we all take some time off over the holiday season. We’ve got some great articles queued up to go live while we’re away, and a few of our regular bloggers will no doubt chime in with any breaking news, but otherwise it may be a bit quiet around here for the next week. Rest assured, we’re just saving up some energy for the exciting year ahead!
See you in 2008…
This article provided by sitepoint.com.
IE8 renders the acid 2 test
I’m not sure why I don’t see that many people talking about the fact that IE8 renders the acid 2 test perfectly now. It really seems Microsoft is starting to move forward again, after starting to feel some pressure from the open source world. Will they be able to pick up the speed needed to […]
Java 6 for Mac OS X Back on the Radar
Nearly two months on from the release of Mac OS X 10.5 (Leopard) and the resulting uproar from Java developers over Apple’s silent removal of preview builds of Java 6 for Mac, Apple has just as quietly released Java SE 6 Developer Preview 8, the first developer preview of Java 6 that runs on Leopard. Many […]
Nearly two months on from the release of Mac OS X 10.5 (Leopard) and the resulting uproar from Java developers over Apple’s silent removal of preview builds of Java 6 for Mac, Apple has just as quietly released Java SE 6 Developer Preview 8, the first developer preview of Java 6 that runs on Leopard.
Many developers had feared that the removal of the previous preview signalled an intent from Apple to ignore Java 6 in favour of continued minor tweaks to Java 5. It seems now that the optimists were right: Apple just needed more time to get Java 6 right, so it took a step back and made some improvements to Java 5 for the Leopard release before pressing on with its work on Java 6.
The fact remains that if Apple were only to communicate with its closest allies—software developers—in a meaningful way, we wouldn’t be left playing these guessing games over the company’s intentions.
This article provided by sitepoint.com.
Don’t attach HTML-files in Outlook
Just a short word of warning. I thought I’d mail the min-/max-width template to a colleague at work. So I fired up Outlook, attached the file and sent it. I thought that was it, Outlook couldn’t get something simple like that wrong, could it? Yes it could! Opening the file I found some pretty nasty […]
Quick Accessibility Testing
A recent project of mine required me to do a quick review of the accessibility level of a site. Nothing serious, just to show what was possible to test and where the site scored right now. I managed to assemble a small list of tools that I believe did a rather good job. This article […]
Podcast Recommendation: Boagworld
As many of you know, I have something of a podcast addiction. My iPod contains everything from the video mischief of Mr. Deity to the probing intellectual discussions of In Our Time–which returns from summer hiatus this week. I listen to these while walking about campus, driving around town or when trying to fall asleep at night. Alas some of these podcasts are ill-suited to the fight against insomnia. Instead of lulling me into slumber, they taunt me with ideas that I want to tinker with right away. One such Podcast is Boagworld, “the podcast for those involved in designing, developing and running Web sites.”
As many of you know, I have something of a podcast addiction. My iPod contains everything from the video mischief of Mr. Deity to the probing intellectual discussions of In Our Time—which returns from summer hiatus this week. I listen to these while walking about campus, driving around town or when trying to fall asleep at night. Alas some of these podcasts are ill-suited to the fight against insomnia. Instead of lulling me into slumber, they taunt me with ideas that I want to tinker with right away. One such Podcast is Boagworld, “the podcast for those involved in designing, developing and running Web sites.”
Boagworld is the creation of Paul Boag and Marcus Lillington, co-founders (along with Chris Scott) of Headscape, a Web design firm in the U. K. According to their Web site, “Boagworld.com aims to educate you about the latest web innovations, teach you how to manage the development of your site and show you how to integrate your site into your broader business. Most of all it aims to put you in a position where you are not baffled by the techies who are building your site!”
Why you should listen to Boagworld
Two things struck me the first time I listened to Boagworld. 1) They’re quite entertaining, and 2) They really know what they are talking about. As soon as I heard them referring to such tried and true resources as A List Apart and Case alumnus, Eric Meyer, I knew they were on the right track. A visit to their well-organized, standards-compliant site served to confirm that they practice what they preach.
The podcasts cover a nice cross-section of topics aimed towards designers, developers, marketers and anyone else who is involved in some aspect of an organizations Web presence. As the mission statements says, “This site/podcast exists to help you poor sods who have been lumbered with the job of managing the company’s website. This responsibility is on top of your normal work and has been given to you despite the fact that you know little or nothing about the internet and building websites. It is for you that boagworld.com exists.” (I told you they were entertaining.) Shows are 50-60 minutes in length and typically feature:
- Light hearted banter between Paul and Marcus as they share the week’s Web-related news, tips, advice and recommendations
- Marcus’s Bit, typically focusing on an issue related to Web project/client management or marketing
- Paul’s Corner, covering a design or development subject, and
- Interviews with various experts, such as Patrick McNeil from Design Meltdown and Daniel Burka, the creative director at digg.com and/or book reviews
The order of the above may vary, but each week they cover a wide range of material on everything from css to social media.
Why you should read Boagworld
One of the problems with audio podcasts is keeping track of the names, links, books and other details mentioned throughout the show. This is not a problem with Boagworld as the accompanying Web site and blog includes summaries and/or transcripts of the shows including links to everything mentioned within. Rather than having to listen with pencil and paper at the ready, you can simply relax with the audio then go to the site later to follow-up on their recommendations. Archives are organized by date and subject as well as tagged by keyword, making the information easily accessible even if you can’t remember which episode featured what. The blog allows listeners to leave comments about the shows and the site also features a discussion board for further interaction with the hosts and other Web developers around the world.
Why are you still reading this? Go give it a listen!
At this point in this entry I could prattle on with various details and examples, but as I’m recommending that you listen to Boagworld, perhaps it is time that I let you do just that.
The future of friendlybit.com
It’s vacation time and you’re allowed to lean back and just relax. A blog it’s always there though, you post to it on your spare time, and as soon as you have some a little glitch in your schedule you need to consider blogging. It’s a full time job. Current situation I use Friendly Bit as […]
The state of functional programming in PHP
With the rise of Javascript, and languages like Python and Ruby, functional programming is becoming more mainstream. Even Java seems to be getting closures in the next version, so does this leave PHP lacking behind or is there an unrealised potential hidden within? Dynamic dispatch What exactly defines a functional programming language, is perhaps an open question, […]
With the rise of Javascript, and languages like Python and Ruby, functional programming is becoming more mainstream. Even Java seems to be getting closures in the next version, so does this leave PHP lacking behind or is there an unrealised potential hidden within?
Dynamic dispatch
What exactly defines a functional programming language, is perhaps an open question, but one key element is functions as data. As it happens, PHP kind-of-supports this concept; The syntax permits you to use variables as function-names, making the following possible:
function add($a, $b) { return $a + $b; } $add = "add"; $add(2, 8); // return 10
Unlike languages with first class functions support, the variable $add isn’t a special type — It’s merely a string, which is evaluated in the context. It may just be a wrapped up eval, but superficially it works similar, once the function has been declared.
It is also possible to explicitly call a function reference with call_user_func. This is interesting, because it accepts different types of arguments, which makes it possible to call a method on an object. More on this in a moment.
Binding state
Another prerequisite for functional programming, is the ability to bind a variable to a function. This bound function serves essentially the same purpose as objects do in object oriented programming, but is usually more fine grained and more flexible.
In languages, which are traditionally associated with functional programming, functions are usually bound with variables, through something called a closure. This is a side effect of the scoping rules of those languages.
Since PHP doesn’t have lexical scope, we can’t use closures, but we can use currying to achieve the same goal. In Wikipedia’s words, currying is the technique of transforming a function that takes multiple arguments into a function that takes a single argument. If that sounds abstract, assume the following:
$add2 = curry($add, 2); // returns a new function reference, to add(), bound with 2 as the first argument $add2(8); // return 10
Before you try that out, hold your horses — it won’t work, because curry isn’t a PHP function. As it turns out though, it’s possible to create it. Sort of.
Implementing curry
Without going into great details, there are two ways, currying can be implemented in PHP.
- The first option is some sort of run-time evaluated code. This could be variable-variables, pointing to function names or callback pseudotype, invoked by call_user_func. Eventually, they are just kinds of eval.
- The other option is to use a command object, encapsulating the callback and its state.
For a more detailed explanation, have a look at Partial function application in PHP.
Weighing the options
Looking at the syntax, variable-variables have a much more functional “feel” to them, than a command object. The callback pseudotype does allow one to reference an object + method-name, but even though this is supported by PHP’s internal functions, it get’s bulky in user land code. If a command object feels like functional programming with OOP syntax, then call_user_func feels like functional programming with procedural syntax.
When it comes to performance, the run-time evaluated approach has some serious shortcomings. Currying must be done by creating new static code each time and this can’t be reclaimed until the end of the process. Furthermore, the only way to bind state, using this pattern, is to rely on a global container of some sort, generating a new, unique symbol each time. Since it’s impossible to know, when the callback isn’t referred anymore, it follows, that it’s impossible to safely remove the variable from the global container. Thus, any state bound this way, will be impossible to reclaim for PHP’s memory management system, furthering the risk of the script running out of memory.
In conclusion
So, if the offset for this post was to assert the current options for functional programming in PHP, the only practical solution is currying, using command objects. The awkwardness can be somewhat smoothed out, with a library of utility classes. phunctional is an attempt at this and we might also see some of these ideas emerge into more general purpose frameworks.
Another idea, could be a language level addition to PHP. What we need, is a way to make all callbacks callable with the variable-variable syntax. I’m thinking this could be supported with a magic-method. If an object was to be used as a function, and it implemented said magic method, the method would be called. From a design perspective, it would fit fine with the other magic methods, such as __call and friends.
Declaring functions
Another limitation, which could be addressed at the language level, is the matter of declaring functions in the first place. Currently, functions must be declared in the global scope or through the use of the hideous create_function. There have been some stabs at improving this, on the php-internals team, so maybe we should be as lucky as to see this in PHP 6?
This article provided by sitepoint.com.
Future of web standards (my take)
Stuart Landridge sums up the ongoing debate about the future of CSS. My thoughts on this are that we should: 1. Let browser makers run loose with implementing new features, based on feedback from web developers. 2. Have a standard body (or some other group) that look at those existing features and see how they can be […]
Manipulating innerHTML removes events
Others have written about this before, but I thought I’d mention it again, just so you don’t miss it. Aleksandar Vacić found it while playing with tables and their cells. I found it when Robert and I played with nested lists. It works the same across browers. Let me show a quick example: You have a […]
New design for friendlybit coming up
Hi. I just wanted to tell you that I’m now working on the new friendlybit. I’ve listened to your previous comments, and these are the changes I’m going to make/not make: Blog format stays, no community. You’re damn conservative (something like 95% percent said to keep it a blog). More compact writing. I’ll skip more of the […]
Headline
. This not only filled up your page with a lot of extra code, but it also meant that if you decided later to make all of your
’s a different color you would have to go and change all of the font codes one by one. When using a style sheet you can define how your
’s will look in one place. To change the color you just make the one change in the stylesheet and you are ready to go.
Separation of format and presentation isn’t a particularly new idea, but adoption has spread slowly. CSS 1 was first introduced in 1996 and the CSS 2 recommendation has been around since 1998. While many sites use CSS, it is still not uncommon to stumble upon current sites that are still using older codes such as .
Why this has been on my mind
A few weeks ago a friend sent me a link to a pretty cool looking site for an online magazine. Alas the site wasn’t standards compliant and therefore didn’t work properly. This particular site was Flash-based with dimensions too big to fit my screen. The page had no scroll bars so I couldn’t get to the menus to navigate through the site. I could see the whole site on my Mac, but not on my Dell, and I’m pretty sure I’m not the only one to have had that problem. Since I couldn’t navigate the site, they might as well have posted a page that said “Do Not Enter. We don’t care about your business.” If they had built a compliant site they would have ensured greater accessibility to users and not had this problem.
I’ve found a number of other non-compliant sites while working to compile a list of local Web developers. Departments without Web staff often look to outsource their Web projects and turn to me for referrals. Thus I’m trying to put together a list of local (to support the regional economy) developers who I can trust to build compliant sites that follow the Case design scheme, maintain a logical navigational structure and support the goals of the client. This has not been an easy task.
The problem is that almost anyone can learn to build a Web site, but only a few can do it well. There are a lot of firms out there, but the quality of work varies dramatically, and only a handful build standards compliant sites. Sites with major compliance errors don’t end up on my list. This isn’t just because I’m persnickety. If a site fails validation because of a few stray &’s or they’ve forgotten to close a few
’s I’m not worried. Such errors are easily corrected and don’t disturb the overall functionality of the site. But if a site uses tags, doesn’t include a doctype, leaves alt tags blank on all of their images, etc., then I will conclude that its designers are not professional and will not be able to offer the client the advice or service necessary to implement a successful site.
Conclusion and Disclaimer
If you’ve ever built a Web site, you’ve followed at least a few of the standards. The site wouldn’t work if you hadn’t. For example if you left out the
tag your page wouldn’t render. Since we’re all following some of the standards anyway, I would just encourage everyone to learn and apply more of them. As you become more familiar with them you’ll find that your sites become both easier to use and easier to build. To learn more about Web standards visit The Web Standards Project and the resources below.Standards compliance is an ongoing goal of mine, but I’m only human. Not every site I’ve built is standards compliant, and the errors become more egregious the older the pages may be. Since I readily acknowledge this you don’t need to go hunt them down, they are out there, and I know it!
Web Standards Resources
- Asterisk Web Standards Archive
- Designing With Web Standards, Second Edition by Jeffrey Zeldman
- Jeffrey Zeldman: King of Web Standards (Business Week)
- Section 508: The Road to Accessibility
- The Web Standards Group
- The Web Standards Project
- W3C Cascading Style Sheets, level 2 CSS2 Specification
- W3C Cascading Style Sheets, level 1
- W3C HTML 3.2 Reference Specification
- W3C HTML 4.01 Specification
- W3C XHTML™ 1.0 The Extensible HyperText Markup Language (Second Edition)
- W3C Technical Reports and Publications
- Web Accessibility Initiative (WAI)
- World Wide Web Consortium (W3C)
What italic means
Finally an image that dispells all myths about the element. As you can see it’s all about presentation. Disappear you foul demon! (You have more HTML humor? Show me in the comments)
@media Ajax London, here I come
Just a short note that I’ll be attending @media Ajax London, 19th-20th November. If you see me, come by and say hello!
Usenet Newsgroups: Anachronistic Service or Useful Communication Tool?
Earlier this week ITS announced that it would be taking down the Usenet news server as of December 5, 2007. In a fit of nostalgia, I opened up my newsreader (Mozilla) to leave a farewell message on cwru.general. Oddly enough, my message got a response; others (not many) were still using Usenet! This led me to wonder what had happened to newsgroups. Did the generation that grew up on the Web not know about newsgroups, or did they know about them but prefer the Web? In this age of Web 2.0, where some update their Facebook status by the hour, users pose questions on discussion boards such as http://forum.case.edu, and writers merge their Twitter, Pownce and Jaiku posts into central RSS feeds that can be shared on their Tumblr blogs, is there still a place for Usenet news?

alt.politics.usa.constitution as seen in
Seamonkey (above) and Google Groups (below).
Click on the images to enlarge.
Earlier this week ITS announced that it would be taking down the Usenet news server as of December 5, 2007. In a fit of nostalgia, I opened up my newsreader (Mozilla) to leave a farewell message on cwru.general. Oddly enough, my message got a response; others (not many) were still using Usenet! This led me to wonder what had happened to newsgroups. Did the generation that grew up on the Web not know about newsgroups, or did they know about them but prefer the Web? In this age of Web 2.0, where some update their Facebook status by the hour, users pose questions on discussion boards such as http://forum.case.edu, and writers merge their Twitter, Pownce and Jaiku posts into central RSS feeds that can be shared on their Tumblr blogs, is there still a place for Usenet news?
I think perhaps there is. But before we ponder that, perhaps we need to review—for those who don’t know—what Usenet is/was all about.
History
Many users today think of the World Wide Web and the Internet as being interchangeable. But as most of you know, the WWW is only one of many protocols used on the Internet. Back in the era before the WWW (which most users didn’t access until 1994-95), Usenet was one of the most popular features of the Internet. To some it still is.
First created in 1979, Usenet allows users to share thoughts and ideas with one another on a variety of topics ranging from the Internet itself to the latest episode of CSI. While T. V. viewers now discuss their favorite show on Web-based forums, in those days folks dissected X-Files episodes on alt.tv.x-files. (Actually they still do.)
How Usenet is used
As one uses a Web browser to surf the Web, one uses a newsreader to subscribe to and read/respond to newsgroups. Some news readers are stand-alone programs, while others are built into e-mail programs or Web browsers and Internet suites. Once the reader is installed, the user configures it to connect to a news server just as one would configure an e-mail program to use a certain e-mail server. Most Internet service providers offer news server access.
With the newsreader installed and configured to access the appropriate server, users can then subscribe to any of thousands of newsgroups based on their interests. This will be familiar to those of you who use RSS readers to read blogs. With a newsreader you would typically call up a searchable list of the newsgroups provided by your server and subscribe to those you like. Once subscribed you would select a group from your subscription list and download the latest headers (subject lines, that link to messages) to read the various posts. From there you can respond to an existing discussion or start a new thread, just as you would on a discussion forum, but more similar to e-mail in that you can include attachments.
There are thousands of newsgroups available on the internet with topics ranging from alt.tv.survivor to alt.politics.usa.constitution. Many of these will be available through your Internet Service Provider’s news server, but some may be limited to certain servers.
To learn more about using Usenet newsgroups refer to the resources listed at the bottom of this entry.
Is Usenet still viable?
Given the research I’ve done today, Usenet seems to be alive and well—particularly in certain circles. Those circles would be those interested in file sharing. As I’ve been exploring this issue I’ve noticed two trends:
- Newsreaders such as Binary Boy geared towards optimizing music, picture and movie sharing
- Uncensored News Servers, such as Tera News offering uncensored access to groups, anonymous posting and firewall counter measures
I’d like to think that the above are being used to provide more efficient news reading or to give access to users living in countries with unreasonably strict censorship laws; but I’m guessing these folks are making their money by offering an easy way for people to trade naughty pictures and pirated media. With prices for some servers ranging anywhere from $7 to $49 (and up, depending on download limits) per month, I don’t think folks are signing up to share their grandmother’s bundt cake recipes.
What about the rest of us? Is Usenet still a good way to share information, discuss politics and find out how to clean the headlight lenses on your ‘96 Passat? I think it could be. This evening I installed Mozilla’s Seamonkey Internet Suite, on my home computer, to use as my newsreader and subscribed to some of the groups I’d read in the past such as alt.www.webmaster. The group was alive and well, filled with the same kind of reasonable questions, helpful advice, spam and people who shouldn’t be thinking of starting a Web design business, as it always was. Newsgroups are like that, but so are discussion boards. Some members will be knowledgeable, others never will be, and some just want to push their product or start a flame war. A lot of good information can still be traded.
If one is looking for discussion geared towards very specific topics I think Usenet works well for two reasons.
- One Stop Shopping: One can subscribe to groups on cars, sports, T. V. shows, politics, philosophy, etc. and view them all in one place as one does with RSS readers.
- Threaded Discussion: This format is really easy to use. You are presented with a list of headers, so you can choose which topic to read, and then all the messages in the thread are listed below (the way this works may depend on your reader). Google Groups offers Web-based access to newsgroups, but if there are more than a few messages in a given topic it can be very hard to follow. Google presents them in full in order, rather like Gmail. But when you get a few hundred this also involves multiple pages and can be tricky to navigate.
Perhaps I’m just being nostalgic, but this still seems like a pretty efficient way to communicate. Back in the day, I got a lot of good information from newsgroups, and I think if one chooses a group with an active, knowledgeable subscriber-base one still can. And if that is the case one can use these to network, share ideas, promote Web sites and blogs (but only in the context of providing meaningful content to the group) just as one can with Web-based services.
What do you think? Is there a place for Usenet in your social media world?
Usenet News Resources
- An Introduction to Usenet News
- Choosing a Usenet News Reader
- How the Usenet News Protocols Work
- Internet FAQ Archives: What is Usenet? (Historical, yet definitive, read both parts)
- news.newusers.questions
- News Readers
- On the History and Impact of the Net
- Reference to Newsgroups (List of Groups)
- SeaMonkey (Web browser/e-mail/newsreader)
- Usenetpedia: An encyclopedia of Usenet Newsgroups related facts
- Wikipedia: Usenet
- Network News Transport Protocol (NNTP)
P.S. When mentioning specific newsgroups I linked to them using the news protocol. These will only work if you have configured a newsreader in your browser and are using a server that includes that particular group.
Visual Studio 2008 Review
I know it’s a bit late, but as promised here’s a review of Visual Studio 2008. I’ve had it for a while now, but I wanted to wait until I’d worked on a few projects with it before I offered my opinion. Overall, it’s a solid improvement over 2005. The guys at Microsoft have made some good changes that actually improved the development experience rather than just adding a bunch of fluff.
I know it’s a bit late, but as promised here’s a review of Visual Studio 2008. I’ve had it for a while now, but I wanted to wait until I’d worked on a few projects with it before I offered my opinion.
Overall, it’s a solid improvement over 2005. The guys at Microsoft have made some good changes that actually improved the development experience rather than just adding a bunch of fluff. Unlike 2005, you’re not required to upgrade to the newest framework to use it, so you don’t have to upgrade to .NET 3.5 just yet. The IDE is generally a bit faster than 2005 and several of the features that were a headache for my team in 2005 have been made useful. The 2 most notable improvements were support for nested master pages in design view and a huge performance improvement in the table adapter editing interface.
One of the first things I noticed about the interface is the influence from Expression Web. There is a new split view for the designer and several new CSS helper tools. The split view has been in other products, like Dreamweaver, for ages and I have generally not found it very useful and initially, I felt the same way about the split view in Visual Studio. It really doesn’t help much when laying out your pages, but when writing code-behinds, it provides a much quick method for reviewing the layout and server control properties. The CSS tools, much like Expression, seem like they may be useful to those inexperienced with CSS, but for me they were more of a hindrance than help.
The biggest improvement is the javascript support. The support for the ASP.NET AJAX extensions is much improved, but that’s pretty much expected. What surprised me is the extensive intellisense support for javascript. It not only picks up the built-in javascript functions, it provides intellisense for any of your custom functions and variables. While my javascript skills are about average, our dedicated AJAX guy just wouldn’t shut up about how good the new javascript support is, which tells me it’s pretty solid. The new javascript debugging support is nice too, but it requires that you turn on the script debugger in IE, which makes any browsing outside of debugging your apps a pain.
Visual Studio 2008 is a nice step forward for Visual Studio. While some people were hoping for more features, the features that made it in are solid and the overall performance in improved. The javascript intellisense and debugging alone will make it worth getting for anybody working heavily with AJAX and the performance tweaks will satisfy impatient coders like me. There are a few shortcomings (it’s still a memory hog) but the improvements are well worth the upgrade.
This article provided by sitepoint.com.
Happy Holidays from SitePoint!
As I write this, most of Team SitePoint is up on the 3rd floor partying down in style. It’s the end of a big year for us, and we’ve got a lot to celebrate … but of course there’s also plenty to look forward to in the year ahead! In 2008, you can expect the following […]
As I write this, most of Team SitePoint is up on the 3rd floor partying down in style. It’s the end of a big year for us, and we’ve got a lot to celebrate … but of course there’s also plenty to look forward to in the year ahead!
In 2008, you can expect the following from SitePoint:
- 99designs
The new incarnation of SitePoint Design Contests that we launched this year has been so successful that we feel it’s time it was set free to make its own way in the world. This active design community will be split off onto its own site and renamed to ‘99designs’.
Of course, this rebranding will come with a whole new visual design for the site. Watch for us to run a contest in the SitePoint Design Contests community to design the 99designs logo!
- The SitePoint Reference
Our CSS Reference site is already in closed beta, and we’re getting loads of great feedback from the SitePoint forum community. Early in 2008, this ‘reference to end all CSS references’ will open its doors to the world, and will be closely followed by references for HTML and JavaScript … each written by some of the foremost authorities on each technology.
- More great books
Our first title for 2008 will be The Art & Science of JavaScript, brought to you by a star-studded team of JavaScript experts.
- …and lots more!
SitePoint HQ is shutting its doors as we all take some time off over the holiday season. We’ve got some great articles queued up to go live while we’re away, and a few of our regular bloggers will no doubt chime in with any breaking news, but otherwise it may be a bit quiet around here for the next week. Rest assured, we’re just saving up some energy for the exciting year ahead!
See you in 2008…
This article provided by sitepoint.com.
IE8 renders the acid 2 test
I’m not sure why I don’t see that many people talking about the fact that IE8 renders the acid 2 test perfectly now. It really seems Microsoft is starting to move forward again, after starting to feel some pressure from the open source world. Will they be able to pick up the speed needed to […]
Java 6 for Mac OS X Back on the Radar
Nearly two months on from the release of Mac OS X 10.5 (Leopard) and the resulting uproar from Java developers over Apple’s silent removal of preview builds of Java 6 for Mac, Apple has just as quietly released Java SE 6 Developer Preview 8, the first developer preview of Java 6 that runs on Leopard. Many […]
Nearly two months on from the release of Mac OS X 10.5 (Leopard) and the resulting uproar from Java developers over Apple’s silent removal of preview builds of Java 6 for Mac, Apple has just as quietly released Java SE 6 Developer Preview 8, the first developer preview of Java 6 that runs on Leopard.
Many developers had feared that the removal of the previous preview signalled an intent from Apple to ignore Java 6 in favour of continued minor tweaks to Java 5. It seems now that the optimists were right: Apple just needed more time to get Java 6 right, so it took a step back and made some improvements to Java 5 for the Leopard release before pressing on with its work on Java 6.
The fact remains that if Apple were only to communicate with its closest allies—software developers—in a meaningful way, we wouldn’t be left playing these guessing games over the company’s intentions.
This article provided by sitepoint.com.
Don’t attach HTML-files in Outlook
Just a short word of warning. I thought I’d mail the min-/max-width template to a colleague at work. So I fired up Outlook, attached the file and sent it. I thought that was it, Outlook couldn’t get something simple like that wrong, could it? Yes it could! Opening the file I found some pretty nasty […]
Quick Accessibility Testing
A recent project of mine required me to do a quick review of the accessibility level of a site. Nothing serious, just to show what was possible to test and where the site scored right now. I managed to assemble a small list of tools that I believe did a rather good job. This article […]
Podcast Recommendation: Boagworld
As many of you know, I have something of a podcast addiction. My iPod contains everything from the video mischief of Mr. Deity to the probing intellectual discussions of In Our Time–which returns from summer hiatus this week. I listen to these while walking about campus, driving around town or when trying to fall asleep at night. Alas some of these podcasts are ill-suited to the fight against insomnia. Instead of lulling me into slumber, they taunt me with ideas that I want to tinker with right away. One such Podcast is Boagworld, “the podcast for those involved in designing, developing and running Web sites.”
As many of you know, I have something of a podcast addiction. My iPod contains everything from the video mischief of Mr. Deity to the probing intellectual discussions of In Our Time—which returns from summer hiatus this week. I listen to these while walking about campus, driving around town or when trying to fall asleep at night. Alas some of these podcasts are ill-suited to the fight against insomnia. Instead of lulling me into slumber, they taunt me with ideas that I want to tinker with right away. One such Podcast is Boagworld, “the podcast for those involved in designing, developing and running Web sites.”
Boagworld is the creation of Paul Boag and Marcus Lillington, co-founders (along with Chris Scott) of Headscape, a Web design firm in the U. K. According to their Web site, “Boagworld.com aims to educate you about the latest web innovations, teach you how to manage the development of your site and show you how to integrate your site into your broader business. Most of all it aims to put you in a position where you are not baffled by the techies who are building your site!”
Why you should listen to Boagworld
Two things struck me the first time I listened to Boagworld. 1) They’re quite entertaining, and 2) They really know what they are talking about. As soon as I heard them referring to such tried and true resources as A List Apart and Case alumnus, Eric Meyer, I knew they were on the right track. A visit to their well-organized, standards-compliant site served to confirm that they practice what they preach.
The podcasts cover a nice cross-section of topics aimed towards designers, developers, marketers and anyone else who is involved in some aspect of an organizations Web presence. As the mission statements says, “This site/podcast exists to help you poor sods who have been lumbered with the job of managing the company’s website. This responsibility is on top of your normal work and has been given to you despite the fact that you know little or nothing about the internet and building websites. It is for you that boagworld.com exists.” (I told you they were entertaining.) Shows are 50-60 minutes in length and typically feature:
- Light hearted banter between Paul and Marcus as they share the week’s Web-related news, tips, advice and recommendations
- Marcus’s Bit, typically focusing on an issue related to Web project/client management or marketing
- Paul’s Corner, covering a design or development subject, and
- Interviews with various experts, such as Patrick McNeil from Design Meltdown and Daniel Burka, the creative director at digg.com and/or book reviews
The order of the above may vary, but each week they cover a wide range of material on everything from css to social media.
Why you should read Boagworld
One of the problems with audio podcasts is keeping track of the names, links, books and other details mentioned throughout the show. This is not a problem with Boagworld as the accompanying Web site and blog includes summaries and/or transcripts of the shows including links to everything mentioned within. Rather than having to listen with pencil and paper at the ready, you can simply relax with the audio then go to the site later to follow-up on their recommendations. Archives are organized by date and subject as well as tagged by keyword, making the information easily accessible even if you can’t remember which episode featured what. The blog allows listeners to leave comments about the shows and the site also features a discussion board for further interaction with the hosts and other Web developers around the world.
Why are you still reading this? Go give it a listen!
At this point in this entry I could prattle on with various details and examples, but as I’m recommending that you listen to Boagworld, perhaps it is time that I let you do just that.
The future of friendlybit.com
It’s vacation time and you’re allowed to lean back and just relax. A blog it’s always there though, you post to it on your spare time, and as soon as you have some a little glitch in your schedule you need to consider blogging. It’s a full time job. Current situation I use Friendly Bit as […]
The state of functional programming in PHP
With the rise of Javascript, and languages like Python and Ruby, functional programming is becoming more mainstream. Even Java seems to be getting closures in the next version, so does this leave PHP lacking behind or is there an unrealised potential hidden within? Dynamic dispatch What exactly defines a functional programming language, is perhaps an open question, […]
With the rise of Javascript, and languages like Python and Ruby, functional programming is becoming more mainstream. Even Java seems to be getting closures in the next version, so does this leave PHP lacking behind or is there an unrealised potential hidden within?
Dynamic dispatch
What exactly defines a functional programming language, is perhaps an open question, but one key element is functions as data. As it happens, PHP kind-of-supports this concept; The syntax permits you to use variables as function-names, making the following possible:
function add($a, $b) { return $a + $b; } $add = "add"; $add(2, 8); // return 10
Unlike languages with first class functions support, the variable $add isn’t a special type — It’s merely a string, which is evaluated in the context. It may just be a wrapped up eval, but superficially it works similar, once the function has been declared.
It is also possible to explicitly call a function reference with call_user_func. This is interesting, because it accepts different types of arguments, which makes it possible to call a method on an object. More on this in a moment.
Binding state
Another prerequisite for functional programming, is the ability to bind a variable to a function. This bound function serves essentially the same purpose as objects do in object oriented programming, but is usually more fine grained and more flexible.
In languages, which are traditionally associated with functional programming, functions are usually bound with variables, through something called a closure. This is a side effect of the scoping rules of those languages.
Since PHP doesn’t have lexical scope, we can’t use closures, but we can use currying to achieve the same goal. In Wikipedia’s words, currying is the technique of transforming a function that takes multiple arguments into a function that takes a single argument. If that sounds abstract, assume the following:
$add2 = curry($add, 2); // returns a new function reference, to add(), bound with 2 as the first argument $add2(8); // return 10
Before you try that out, hold your horses — it won’t work, because curry isn’t a PHP function. As it turns out though, it’s possible to create it. Sort of.
Implementing curry
Without going into great details, there are two ways, currying can be implemented in PHP.
- The first option is some sort of run-time evaluated code. This could be variable-variables, pointing to function names or callback pseudotype, invoked by call_user_func. Eventually, they are just kinds of eval.
- The other option is to use a command object, encapsulating the callback and its state.
For a more detailed explanation, have a look at Partial function application in PHP.
Weighing the options
Looking at the syntax, variable-variables have a much more functional “feel” to them, than a command object. The callback pseudotype does allow one to reference an object + method-name, but even though this is supported by PHP’s internal functions, it get’s bulky in user land code. If a command object feels like functional programming with OOP syntax, then call_user_func feels like functional programming with procedural syntax.
When it comes to performance, the run-time evaluated approach has some serious shortcomings. Currying must be done by creating new static code each time and this can’t be reclaimed until the end of the process. Furthermore, the only way to bind state, using this pattern, is to rely on a global container of some sort, generating a new, unique symbol each time. Since it’s impossible to know, when the callback isn’t referred anymore, it follows, that it’s impossible to safely remove the variable from the global container. Thus, any state bound this way, will be impossible to reclaim for PHP’s memory management system, furthering the risk of the script running out of memory.
In conclusion
So, if the offset for this post was to assert the current options for functional programming in PHP, the only practical solution is currying, using command objects. The awkwardness can be somewhat smoothed out, with a library of utility classes. phunctional is an attempt at this and we might also see some of these ideas emerge into more general purpose frameworks.
Another idea, could be a language level addition to PHP. What we need, is a way to make all callbacks callable with the variable-variable syntax. I’m thinking this could be supported with a magic-method. If an object was to be used as a function, and it implemented said magic method, the method would be called. From a design perspective, it would fit fine with the other magic methods, such as __call and friends.
Declaring functions
Another limitation, which could be addressed at the language level, is the matter of declaring functions in the first place. Currently, functions must be declared in the global scope or through the use of the hideous create_function. There have been some stabs at improving this, on the php-internals team, so maybe we should be as lucky as to see this in PHP 6?
This article provided by sitepoint.com.
Future of web standards (my take)
Stuart Landridge sums up the ongoing debate about the future of CSS. My thoughts on this are that we should: 1. Let browser makers run loose with implementing new features, based on feedback from web developers. 2. Have a standard body (or some other group) that look at those existing features and see how they can be […]
Manipulating innerHTML removes events
Others have written about this before, but I thought I’d mention it again, just so you don’t miss it. Aleksandar Vacić found it while playing with tables and their cells. I found it when Robert and I played with nested lists. It works the same across browers. Let me show a quick example: You have a […]
New design for friendlybit coming up
Hi. I just wanted to tell you that I’m now working on the new friendlybit. I’ve listened to your previous comments, and these are the changes I’m going to make/not make: Blog format stays, no community. You’re damn conservative (something like 95% percent said to keep it a blog). More compact writing. I’ll skip more of the […]

Jack…
Cool post. 100% great content everytime. Thanks for sharing….
Allison Hannigan…
After this soaks in, I am sure what you have here is really brilliant….
Pet Fish Names…
this article alone provides very clear answer to the most misunderstood part of the issue….
Compact Flash Readers…
There comes a point when a dream becomes reality and reality becomes a dream. ~ Frances Farmer…