PHP

Speaking at DPC12 & a Lone Star PHP Update

Well, I’ve been a little lazy around here and haven’t posted since the beginning of the year. I figured I’d fix that by posting an update about a few things going on around here.

First off, since the schedule was just released, I’ll mention that I’ll be presenting at this year’s Dutch PHP Conference with three different sessions (well, kind of just two):

  • Agile Applications with ExtJS and Zend Framework
    ExtJS is an enterprise-level Javascript framework, the Zend Framework is one of the most powerful and flexible PHP frameworks to date – its a match made in heaven. I’ll introduce you to these two technologies and how to combine them into an easy to maintain, agile application that can move as fast as your project needs. I’ll show you how to build a sample application including a frontend MVC, REST backend and unit testing the result. (Tutorial)
  • The API Dilema
    Creating a good, useful and functional API for your application can be one of the most difficult parts of a project. With more and more things becoming API-powered, it’s important to plan well and provide what the user expects. I’ll look at some principles you can follow to make sure the API you write is the right one, both from the developer perspective and what you, as a user, should expect of a quality web service API. (Session)
  • Agile Applications with ExtJS and Zend Framework
    ExtJS is an enterprise-level Javascript framework, the Zend Framework is one of the most powerful and flexible PHP frameworks to date – its a match made in heaven. I’ll introduce you to these two technologies and how to combine them into an easy to maintain, agile application that can move as fast as your project needs. I’ll show you how to build a sample application including a frontend MVC, REST backend and unit testing the result. (Session)

No, I didn’t repeat myself – the first session and the last session are on the same topics – they’re just different lengths. The tutorial on the first day will get more into coding and examples of ExtJS+ZF and the second shorter session will just give a high level overview of each tool and how they hook together. If you’re interested in the “guts” of an Ext-based app, you’d do better in the Tutorial.

Also, for those that don’t know me, I’m a co-organizer of the Dallas PHP User Group. Last year we decided to put on a local PHP-centric event and it was a great success. So, we’re back this year with the Lone Star PHP Conference 2012. We’ve just wrapped up our Call for Papers and are in the process of selecting the best fits for our schedule.

We’ll be announcing the schedule and opening the registration soon, so keep an eye out on the Lone Star PHP conference site for more updates!

Top three posts of 2011

With a nod to this post from Cal Evans, I’m presenting my own “Top Three” posts from 2011, in order of descending popularity:

  • I don’t understand the 9-to-5:
    This one is easily the tops of the popularity list…thanks to another PHP community member, this one made the front page of Hacker News for a little while and received almost five thousand hits in a day. My poor little slice didn’t know what hit it. I scrambled to put up something – anything – to be able to keep the site alive. Ultimately I ended up rendering a static version of the page to a buffer and manually refreshing it as new comments came in and were approved (39 of them!)

    The post was basically my views on developers who are genuinely interested in the work that they do and the ones that are more of the clock-in/clock-out coders that just “do the job”. There were tons of comments that both agreed and disagreed…and several that basically told me I needed to get a life or must not have kids (I have both, thankyouverymuch).

  • Process Oriented versus Product Driven:
    This post was actually a quote from an interesting book on architecture and some of the things the author had learned during his time in school. This particular nugget of wisdom shows the difference between letting your work drive you and, instead, learning how to drive and shape what you do into something even better.

  • How long is too long (for unit test names)?:
    This fun little post was a log of some tweets after I asked “how long is too long for a method name in a unit test”? It’s common to see things like “testValueIsValidInternalUrl” or “testUserCanExecuteTransaction” kinds of names so I wondered what other people’s experience with it was. One interesting point that came up was the use of “testdox” to translate out the name into something more readable.

These were just the most popular ones added in 2011…there’s a few others that were popular but were posted previously (like pdo+oracle and php+mq).

Hope your holidays were/are good and here’s to another great year of blogging and PHP community!

UPDATE: Besides Cal, other PHP community members are getting into the spirit – Matthew Turland, Joe Devon, Bradley Holt

The Future of (PHP) Progress

I’ll admit it – I love to geek out as much as the next guy at the latest features of the PHP frameworks out there. I read the articles and tutorials every day about something awesome some framework can do (that maybe another can’t) and wish I had a place to apply it. I even find myself trying to think of new little projects so I can say I work with the latest tech. It’s an easy trap to fall into. I came to a realization earlier about frameworks, though – it’s less about the new hotness that the frameworks offer and more about what you do with them that matters.

Tech is great, don’t get me wrong – I love digging into some good code and getting my hands dirty. I love being close to the action and watching my work evolve with each reload. It’s easy to get lost in line after line of curly braces and colons and not look at the bigger picture, though. Remember as you’re doing your development – pick the right tool for the job and don’t be pulled in by the latest and greatest “just because”. Remember that the future of this language we love isn’t in the tech, but it’s in what you do with it.

If you haven’t gotten to check them out yet, be sure you listen to the webcasts from EngineYard about the future of PHP. So far they’ve covered a few of the more popular frameworks and where they’re headed, but I have it on good authority that upcoming episodes will be talking less about the “what powers it” and more about the “why it’s there” kind of topics.

Gimme Bar+TwitterFeed+PHP = One-click Syndication

I recently set up a new Twitter account that shares links to some of the smaller stories I come across in my news reading for PHPDeveloper.org called @phpquickfix. I recently had started playing with Gimme Bar more and wondered how easy it’d be to set it up as a backend repository for some links. Thanks to some hints from other blog posts, it was super easy to set up a “one click syndication” system that combines Gimme Bar, Twitterfeed and a little bit of PHP.

Here’s how it’s set up:

  • I have an account for the PHP Quick Fix over on Gimme Bar here. I use their Chrome extension (and sometimes the bookmarklet) to grab the pages that I want to add.
  • There’s a little PHP script I put together that does a few things – first, if the cached json from the Gimme Bar feed is out of date, it grabs it and wgets the latest from their API. Then it parses this json and outputs it as a simple RSS feed. You can see the result here.
  • Finally, we add Twitterfeed into the mix – it pulls from the RSS feed and posts it to Twitter automatically.

The end result is a system where I can click “Gimme the Page” to my public collection and let the services do the rest. There’s no automation in the link selection – it’s all chosen with my own “human aggregation system”. I think it’s a pretty simple solution to the problem – plus it has the added benefit of making a good collection of hand-picked PHP resources for anyone to pull from.

UPDATE: You can also directly access the PHP Quick Fix posts over on it’s feed: http://phpquickfix.me/feed.

Uniqueness in Fuel Models

As a part of broadening my horizons, I’m back to working with Fuel, a framework that has a familiar feel to some of the ones I’ve used in the past but has some extra “oomf” from new features and PHP 5.3-ness.

I was working in my models the other day and had a need for uniqueness – I wanted to be sure that the object I was pushing into the database didn’t match any other one. I went through the docs and didn’t see anything about it and a glance through the source didn’t turn up anything either. So, as an alternative, I came up with a method I put in my base model:

[php]
class Model_Base extends OrmModel
{
public function isUnique($modelObject)
{
$modelType = get_class($modelObject);
$found = $modelType::find(‘all’,array(
‘where’ => $modelObject->to_array()
));
return (count($found)>0) ? false : true;
}
}
[/php]

The code above finds the class name (the model the object is made from) and tries to find anything with exactly the same properties. The “to_array()” method is something Fuel has to translate objects into handy arrays.

Fuel ORM docs

The Joind.in & I

By now I’m sure a lot of the folks reading the posts from this blog know of the site I’ve helped shape over the past few years, Joind.in. It’s become most successful in PHP circles, but has branched out into other communities, both tech and non-tech. Not too long after the project started up, it was decided to open source the code and pull in contributions from whoever offered their time. I personally feel that, for a first out of the box open source project for me, it’s turned out well and has a great, active community around it. I’ve learned a lot working on not only the code but in management of the project as well.

I’m taking a break from all of this for now though. I know, Joind.in has been my baby for the last few years, but I’ve been feeling a little burnt out on it the last few months and I’m starting to feel like it’s having a negative impact on the project. My plan is to take a few months to regroup myself and pull my head out of the code and maybe even get a better, broader picture of what the project could become. My priorities are shifting towards another project I’ve been putting in some time on (no hints yet) that I hope can be a good tool for a similar community.

The management of the project is being put in capable hands, though – no worries there. Lorna will be the gatekeeper for all things Joind.in. She’ll be handling both the site and the open source project in their day to day needs. I’ll still be lurking around in the same places, but I won’t be as active in the project as I have been.

Thank you to the community that has made the site everything it is and I know it will grow even more in the months to come. Thanks for your contributions, both in code and even just in kind words. Please keep them coming and if you’re a fan or contributor of the project, ask Lorna if there’s a helpful hand you can lend. I know she’d appreciate it.

UPDATE: You can also see Lorna’s post here.

Joind.in + Combell FTW

A while back we (the team leads of the Joind.in project) made the decision to move off of the hosting we were on and up to bigger and better things. Slicehost was a good place to start, but our needs were moving beyond what the little VPS was providing. Through a fortunate series of events, Thijs Feryn set up some space for the project to live on in the Combell servers. This allowed us to more easily set up things like a Hudson instance for deployment and a full test site. Here’s the info from the blog post over on Joind.in:

In recent weeks the Joind.In project has moved onto a new hosting platform. After launching the project in a quiet corner of the server used to host phpdeveloper.org (both are the brain-child of @enygma), it had somewhat outgrown the resources available to it as more and more people used it for more and bigger events.

The new platform is generously provided by Combell, who are a large Belgian ISP. They are familiar faces (and often sponsors) at technical events in Europe, and we’re very happy to have them supporting Joind.In! We now have a dedicated platform for the site, a staging area and a build server, all thanks to the support we have received.

In particular we’d like to thank Thijs Feryn who made it all happen, and of course Combell themselves. You can see their logo in our sidebar and footer, so do check them out.

We’re looking forward to some of the great things this move and new technology will allow us to do in the future of the project. If you’d like to get involved, go over to the github repo for the project or troll through the bug list and pick up something to work on.

Thanks again to Combell and to Thijs for their contribution!

You’re Open Source…Now What? (Communication – Part 3)

So, what started out to be a post or two on some of the important things to consider about communication in open source projects, has now turned into it’s own little mini-series. In part one I talked about some of the important things to consider when it’s you, the organizer, talking to the people that come in and want to get involved with your project. In the second part I covered some of the organizer-to-organizer communication techniques to keep the project running smoothly.

In this part I’m going to focus on something that’s a bit harder to control, but can still make a huge amount of difference in your project’s life. Contributors talking back and forth with the organizers is fun and all, but sometimes they just want to skip a step and go directly to another developer. Dev-to-dev communication is absolutely necessary to make a project thrive. If a developer comes in and the only chatter they see on a mailing list is the project’s admin taking to various people, chances are they won’t stick around too long. People want to see life, they want to see lively discussions and ideas being explained and played off one another.

There only one real issue – you can’t control this.

You can, however, make use of some tools that make it a lot easier. As I mentioned, mailing lists are great tools to have for your contributors to ask questions and get their own ideas across. You have to encourage this, though – it’s not just going to magically happen. Sometimes you have to get the ball rolling by asking a few questions yourself first, but once that ice is broken conversations will more easily pop up. Even just a response or two to a question you posed to the list can spark ideas from other developers not even interested in the original thread. Challenge yourself to, at the start of every week, try to come up with a topic that you think needs to be discussed on the project and start a thread on the list. It’s okay if the majority of the activity at the project’s start is from the organizer(s). Lots of people have their opinions, some are just more forthcoming than others with them. Having a good “feel” for the list helps bring these out.

A second tool that can be invaluable for any project, just starting out or already mature with its contributor base in hand, is something that several of the code repository sites (like github or Bitbucket) offer as a part of their service – the ability to look at the changes someone’s committed to their branch (or to trunk), see the differences and comment on them right in the same page. Previously, version control systems have sent out commit emails that might have included the diffs from one version to another. This is good and all, but developers would need to respond to these emails with their suggestions and, well, as I’ve already mentioned, email is really more about the point-to-point rather than for lengthly discussions.

There’s a huge benefit to having a record of all comments related to change in the code right there in front of you. Github will even let you make a comment about a specific line in the change and all parties involved in the discussion are notified. No more batting around emails and trying to keep track of how many “Re:” there are in the latest response.

The final recommendation I’ll make is probably the most tricky depending on the size of the project. If at all possible having developers on your project physically in the same room makes amazing things happen. Take, for example, the Hackathon that happened at the last php|tek conference. Several developers were all there with the intent of working out some of the bugs in the Joind.in project as well as several others (including writing tests for PHP itself). Remote communications can be efficient, but there’s nothing quite like sitting across the table from another developer poking around the same code you are and hashing things through. Obviously, the Hackathon was a rare event, but if you’re even able to just get two or three contributors together, do it. Conferences are a great place to organize things like this – there’s people from all over that already know the project and look forward to the community that comes with other developers on the same project. There’s even the possibility of drafting new recruits!

Developer -to-developer communications is one of the hardest to get right mostly because it’s not really something you can control. It’s more of a “throw it and hope it sticks” kind of thing that can really pay off in the future of your project.

You’re Open Source…Now What? (Communication – Part 2)

In case you missed it, this post is a continuation of another post looking a some of the things I’ve learned in the time I’ve spent as an open source project organizer for Joind.in. In this second post I’m going to keep looking at communication and the role it plays in the project. The focus will be a little bit different, though – this time it’s more about internal communication.

Keeping all of the contributors to your project informed and involved is a task to itself, but this should be only half of your focus. It’s easy to get caught up in the code merges, mailing list threads and even heated IRC conversations about the next fixes that need to be made. It can be fun, trust me – there’s times when it’s easier to just think about the code and where the popular opinion says it should go. Unfortunately, this almost always leads to bad decisions.

See, one of the core things you can’t forget about when you’re organizing an open source project is to keep the “staff” all on the same page too. When you start off small and it’s maybe you and a few casual committers, it’s easy. You can pull out the decisions without having to worry about anyone else. This all changes when you have one or more others come in and start to be a part of the project. It’s a tough transition for a lone gunman developer used to calling the shots to flip that switch in their head labeled “ask the team”. It’s crucial that everyone involved in running the project be on the same page about things. If they’re not, that’s when bad things can happen like major code forks or worse – a poisoning of the project’s community.

I know in the previous article I advocated keeping things out in the open when dealing with the project and its intentions, but there’s a “but” that comes with it. Contributors and casual observers don’t need to be in on some of the organizational decisions related to the project. There’s things related to the code of the project and then there’s things related to the project itself. It’s up to you and your fellow organizers to make the call on what discussions belong where. Usually the line is pretty clear, but somethings a “let’s ask the community what they think” is the right way to go.

So, how does a (possibly) completely remote team keep up with one another? Well, here’s a few ways, some being better than others:

  • Email – one of the more cumbersome techniques due to it’s nature as more of a point to point method. This can work if there’s only 2-3 of you, but when it starts growing past that, this just gets confusing
  • Mailing List – this is a step above the emailing method and at least will give you a way to review the threads in case questions pop back up. Still not great, but better
  • Online project management apps – these can be great if you need something with a bit more superpower to help manage the project. Even something as easy as Basecamp can help.

The real key is to finding something that works well for your project, though. Sometimes it’s enough to just keep a running list of decisions/future plans made about the project, but I’ll warn you that you’ll outgrow this pretty quickly. It just doesn’t scale very well for anything other than a 2-3 person project.

Thankfully, keeping your project’s “staff” informed isn’t as difficult as keeping up with the general contributor base. It’s easier to just tell them where they need to go rather than trying to get the message out to as many people as possible and hoping it sticks.

Do you and your project have a tool or method that you use to keep all of the admins on the same page? Share it in the comments!

You’re Open Source…Now What? (Communication – Part 1)

I’ve had an idea rolling around in the back of my mind for a little while now and the Call for Papers for ZendCon brought it up and into focus in the last few weeks. I am a part of the Joind.in project, a community event feedback site that’s also an open source project. My co-conspirator Lorna Mitchell and I have worked hard over the past year or so really trying to make the project the best it can be. There’s been a lot of learning that’s gone on during that time, so I wanted to share some of that in a series of blog posts.

This first post, as the title mentions is about communication. I’m going to break it up into two parts because there’s really two different sides to this one word when it comes to a project with so many moving pieces.

Communication with the Group

The first and more obvious form of communication people of think of when working with an open source project is talking to the community at large. Once you take that step an decide to open the source for your application, you’re no longer alone in its development. Sure, you might be the only one committing code to the project, but that doesn’t mean there’s not interested parties out there keeping an eye on your work. This is the first thing to consider as communication from your project to the outside world – the code you write. Even the best, most elegant code without some kind of commenting or internal documentation will fall flat. If there’s nothing helping an outside developer to understand your code and the design of it, chances are they’ll abandon it before they even get started.

Following this same line of thought, there’s the next most important (maybe more important?) form of communication for you to share with potential developers – project documentation. I know it’s been hounded to death by this point, but please don’t wait until the very end of your coding to write documentation. Yes, it’s a pain, but with so many tools out there (like the excellent DocBlox) to help you generate documentation, you have no excuse. Auto-generated docs are great, but real human-made files that include examples and descriptions are even better. Don’t forget to put a human side on your project – it draws in more contributors than just code comments alone.

The “human touch” brings me to the next topic under communication – personal interaction. Comments and documentation on the project are one thing, but if you really want to get people involved and get them as excited about the project as you are, you need to reach out to them on a personal level. There’s lots of ways to make this happen including:

  • mailing lists (we have ours split into “developers”, “features” and “site news”)
  • an IRC channel (#joind.in on Freenode, stop on by and say “hi”)
  • a blog
  • a Facebook page
  • a Twitter account

It’s an easy thing for a developer of a project to just want to stick with the code and get tunnel vision when it comes to the overall project. I’m going to go so far, though, as to say that if you don’t choose at least one of the things from the list above, your project will not succeed past the point of you and maybe a few other developers hacking on the code. At the recent php|tek conference in Chicago, there was a hackathon one night where several (I think it was around 8 or 9) folks all sat down and worked on Joind.in bugs. This was excellent except for the fact that I, one of the project leads, wasn’t able to be at the conference. This is where the IRC channel became invaluable – Lorna was there helping but there was only so much of her to go around. Me being able to have an official place for those people to come and ask questions was a huge boost in productivity over something like email.

Two things to remember, though – having these things is great, but don’t spread yourself too thin. You don’t have to have all of the things from the above list to make a successful project. Pick what fits your needs and the needs of your group. Remember, not everyone that’s interested may be a developer. Also, and this goes hand in hand with #1, don’t forget to nurture the communities you build. I’ve seen first-hand how things can drop off if the driving forces behind the project aren’t there to help drive these interactions. The past few months my time was increasingly eaten up by the conference I was planning and I just wasn’t able to spend the time with Joind.in that I wanted to. As a result, the mailing lists ran a bit dry and even the IRC channel was sparse. I’m on a mission to turn this around, though and am doing what I can to keep our current developers and bring in those shiny new faces eager to hack away.

Disclaimer: Okay, so I lied a little bit – turns out there’s more to say on this topic than I thought, so the second part of the “communication” idea will be in a “Part 2” post coming soon. Until then, here’s a few suggestions for the project organizers out there about communication with your developers:

Suggestions

  • Be transparent – don’t hide decisions from your community. No one likes surprises, so do them a favor and let them give their input
  • Be consistent – you and the other project leaders need to present a united front on decisions. No “ask him, he’ll say yes” sort of thing
  • Be polite – yes, there’s going to be “those people” that seem to live to cause trouble, but deal with them politely. You never know who’s listening
  • Be a dev leader – this is an easy one for the project leads that are still developing, but for the others this could mean moderating pull requests or being familiar enough with the code structure to answer some high-level questions

In the next post I’ll talk more about the flip side of this – communication within the project between organizers and some of the difficulties that are hiding in there.