If only Ning were as easy to hack on as WordPress! Ning is a different animal in that you can’t just throw a Ning up on your own hosting like you can with WP. All Ning social networks reside on Ning’s servers. They can’t be deployed elsewhere because they rest on a proprietary inner core (written in Java) that Ning don’t give out. When we say hacking Ning we have to specify our level of involvement. It can fall anywhere from superficial to committed.
Skins: Like WordPress, you can make skins (themes) for Ning. As with any well behaved MVC model application the presentation (AKA View) layer is completely separate from the logic. Skins aren’t my thing. If you are interested in making skins for Ning, leave a comment because I want to know you.
Serious hacking: Call me needy but I yearn for greater involvement. We’re talking direct exchange of data in both the read/write directions. The human analog would be exchange of bodily fluids. You have to talk before you do that. You have to request that your serverside source code be decentralized, and then they let you have access to it (via SFTP — I installed FileZilla on my Ubuntu workstation.). Once you’re decentralized, (or unmanaged, as I prefer to think of it) Ning no longer auto updates your code when they do a new release. I’m not quite sure just what the procedure is to upgrade once you’ve unplugged, but it sounds like it could stand some improvement. I guess I’ll find out about that when they do a new release. Of course you can always just recentralize. My plan is to not tamper with the Ning provided files at all. I have all my hackage in separate files. If and when they upgrade I will just request to be plugged back into the matrix, at which point they will blow away all my custom stuff. Then I will just request to be unplugged , put my stuff all back and hope it all still works. Unless they come up with a way to update straight from their subversion. They don’t give us a control panel or anything. That always comes when the project is more mature.
Unplugged: Free at last! I finally got my notification from Ning that the code for my network was accessible. Woot! For my first hack I implemented the Hello World Tutorial. It is a nicely done little tutorial that explains the structure of the system. It puts a new tab up on the network control panel. When you click it, it opens a new screen and says Hello World. Whoop de doo. It was a very valuable exercise because it exposes you to the mechanics of hacking Ning without challenging your head too much with what it actually does. Next I was on to the much more realistic next hack example, a member search. This actually involved creating a form and sucking out the data from it.
My impressions: I was a little disappointed with how verbose it turned out to be. When I played with Ruby on Rails a while back, you hardly had to write any code at all. I was especially disappointed that the example included explicit code to sanitize the data. In my own application I had a much slicker way to do it than writing 20 lines of custom sanitization code every time you process a form. Perhaps they were just doing it explicitly for expediency’s sake. I hope there’s some routine to sanitize the $_GET array!
The big hurdle will be mastering the query language. Ning have their own data store wrapper around the database. At the bottom, of course, it’s some SQL database. But you don’t write SQL queries, especially not in a controller. You have to query their data store in the custom language and it builds the SQL queries for you. Obviously I don’t want to learn the ins and outs of their database schema so I hope the data store schema is simple and scales. Finally I was a little perturbed when the tutorial had me copy an identical shell into each of two templates. Although the two copies eventually got filled up with different innards, it seems that the shell itself should have been factored. Repeating code is a violation of the DRY principle. Let’s hope they just did that for expediency’s sake and there is a way to factor template code as well as controller code. The advanced tutorial had a few mistakes in it, but one way or another I was able to straighten the code out and get it working.
Training wheels off next week!