Nov 14 2006

Jewels and Stones

So my web design opportunities have slimmed down. That’s to be expected, really. I had two people courting me for help, only one has come through with plans, meetings, and a set of requirements. So, naturally, that is the one I will work on.

I’ve already made a temporary site; it’s mostly in Perl and straight HTML. Got a webmail form, a hard-coded gallery, and a front page set up. The site is mostly served from cgi scripts using templates; each script is specialized to its own page. Boy, do I love Template Toolkit.

After some careful thought, investigation, and simple tests, I decided that Maypole, the Perl Model-View-Controller application framework, though it’s powerful in its own right, had some shortcomings. In one review of Maypole I read, the writer stated that he had a difficult time setting up Maypole to do anything beyond the sample demo applications that are provided in the documentation. I tend to agree with that writer. It’s got promise, but there’s some gnarly details that need to be hammered out before I can do something large-scale with it.

All this talk I’ve made about Maypole being the Perl equivalent of Ruby On Rails, I decided, in one evening of frustration, to actually look into Rails. After reading some docs, installing Ruby, Gem, and Rails, and building some demo applications, I’m kind of sold on the idea. A simple application can be built in one night, a medium one in a few, and a complex one in a few weeks…given I can focus on the task.

Ruby is a strange and foreign language to me, given my history with Perl and Javascript. Everything is an object, like in Javascript, and everything returns something, like in Perl. In Ruby’s case, everything, from constants, to strings, integers, floats, and on up are a subclass of Object, and as such feature a few built-in methods. What most people call methods, Ruby calls messages. You have an object of a certain class, and it has methods that are called with messages like so: someObject.sayHello("Hi There") This is similar in structure to Javascript’s heavy usage of dot notation, but I think the depth stops at one dot. Ruby also has little need of the semicolon to punctuate statements; this I find alien and a little offsetting. They’re really only needed for multiple statements on one line, otherwise the newlines delineate statements.

Perhaps one of Ruby’s greatest strengths, one I’m barely understanding, is its ability to encapsulate blocks of code and store them, and their variables, into persistent chunks to be thrown around as closures, iterators, etcetera. This is where curly braces are most likely to be found. Ruby doesn’t require curly braces around methods, loops, conditions, or anywhere else; those are enclosed by the statement itself and its corresponding end statement.

Rails is programmed in Ruby, and it takes advantage of Ruby’s strengths. Most important to Rails is the class ActiveRecord, which is Ruby’s version of Perl’s venerable Class::DBI module; each object of that class corresponds in some way to a specific record in a specific database table. Coupled with that is a menagerie of other Rails classes such as ActionController and ActionView which round out the triumvirate of the Model-View-Controller paradigm.

Rails is much like Maypole in that it takes only a few real lines of programmer code to make it work. When one creates a Rails application on the command line, Rails builds a generic framework of directories, templates, scripts, tests, and configuration files you can then edit. Once you configure the application to use the database, and have created your tables, you can then ask Rails to create for you a scaffold of classes, templates, and controller methods so you can start manipulating records in the database right off the bat. Once you are done with the generic “CRUD” methods (Create, Retrieve, Update, Delete), you can then replace them with your own custom methods.

As good as all this sounds, what makes me balk about the framework is that, to the uninitiated, Ruby On Rails has some damnable voodoo in it. By this I mean that there are requirements to the way you name your database tables, the fields in those tables, and your application classes; you must conform to certain naming conventions for Rails to automatically see and interact with them, elsewise you’re scratching your head trying to find a way to force Rails to see things your way (which there are ways).

One such naming convention is that your tables must be a plural of what they hold; for instance, you have a table where each record is a “toy”, therefore the table must be named “toys”. Rails has singular-to-plural inflection code built in. Your model must be named “toys”, your application controller class, “toys”, your templates will be in the “toys” directory. Some damnable voodoo indeed! I’ve yet to discover where I can expect Rails to do this, but there are ways to circumvent it, fear not. Most of Rails’ personality is configurable, but doing so makes so much of the automatic things that Rails does fewer and farther between.

So this website I’m building; it’s turning into this smallfry e-commerce storefront with multiple vendors, multiple products, pictures, a blog, a webmail system, back-office report generation, and so on. It gives me trepidation to think what all I have before me. I know I’m not going to get any barebones functionality ready before deadline, but it’s my hope that my client will understand and will be lenient on me. Learning a new language, discovering the powers and caveats of a new framework, trying to handle the things in my personal life…it’s a lot of work.


Sep 9 2006

In Which the Hobbyist Gets Business

My time of dabbling and dawdling with HTML, CSS, and server-side scripting are potentially yielding me some business. Two seperate friends of mine have been talking with me about building websites for them. They’re both hobbyist craftspersons, and they need sites that are beyond the basic “business card” site. They need galleries, user authentication, project dossiers with potential sales linkage, news/blogging functionality, as well as the usual Contact, FAQ, About, and Links pages.

It excites me that I get to build these sites. It’s been over 6 years since I built my last for-pay site for a tattoo-artist friend back home. So it’ll be swell to get my hands back into the code and do some good stuff. Hopefully it’ll all work out well, and that I can learn something while I’m doing it.

That’s every designer’s hope, I guess.

The technological solution I have my eye on is called Maypole. It’s a Perl-based solution, very similar (according to the documentation) to Java Struts or, as I can figure, Ruby On Rails. It’s a generic application framework that, in its default unmodified state, provides basic methods and templates to manipulate and display data in a database. Its design paradigm is that of Model-View-Controller, and as such is based on the expansive Class::DBI package for the data model and the powerful Template Toolkit for the view.

By default, Maypole will Do The Right Thing: the basic application can be had with the only cost to the programmer being 20 lines of code. Expanded functionality can be done for a bit more work.

I’m currently reading through the documentation and learning more about it. I’ve messed with it a little bit; got the sample application up and running, hacked it enough to make it run well on my laptop without Mod_Perl installed. There are plenty of other coders who are messing with Maypole – it’s still in active development. So it looks like a good fit for what I’m needing.

It’s my hope that Maypole is a good fit, and that I can use it to build these sites to the standards of usability, power, and flexibility that my customers want and that I’ve been blathering on about for years.


Jul 17 2003

Keepin’ up with the Bones

Just a quick update:

I’m working on making the html of Phaysis a little more robust. It’s still a little screwy in IE (all versions), but looks fine in Mozilla. Netscape 4+ is just right-out. :sighs: Really goes against my drive for cross-browser, cross-platform design techniques. It’s a learning process, at least. :shakes fist at the CSS gods:

I haven’t written anything substantial on the website engine in roughly 2 weeks. Been too busy doing other stuff, and sitting down to code this particular chunk of program code is taxing at best. I wonder if I’m going about it all the right way, or if this chunk is really necessary. :shrugs: I’ll make some decisions about it soon.

I visited Texarkana last weekend. It was good to spend some decent time with my family saturday night. None of my sister’s kids were sick, her husband was available, and mom was doing well, so we all had dinner together at mother’s house. I decided to forego visiting some people, namely Moderne Primitives, in order to hang with the fam for a few hours longer, and it was worth it. It almost made the 13 hours (!!) on the road last weekend worth it (where the hell is high-speed rail when we need it?).

I smelled natural gas around my apartment complex’s courtyard last night, and it kinda freaked me out. When I came home from work this afternoon, I still kinda smelled it, so I called the landlord. His assistant told me that the landlord was over here at this complex this morning and noticed the smell. He investigated and found an open valve in the vacant apartment directly underneath mine! Holy shit! It’s since been closed, but I’ll still keep my paranoid nose in the air for it. That shit scares the bejeezus out of me; everything I own, car excluded, is in this apartment. Ugh

My 11-day absence from Mojo’s has been kind of refreshing. I’m spending more time at home lately, which is kind-of a good thing. I’m also out doing other things that I skipped-out on when I spent all my time in one place every night. I’ve found it surprising how much larger this town has gotten now that I’m not a regular anywhere. Breaking habits is the first step to listening for Serendipity’s call. She knows my number.

And you folks who “miss me” know my number too.


Mar 11 2003

Hi there!

Hey y’all. Got a spiffy new journal engine. Nice, eh?

In this box you’ll find my latest journal entry. You can click the “journal” link in the menu on the left to view past entries, or you can click the “read more” link at the bottom of this box to continue reading more entries.

The code is good, the output a little cludgy, but all-in-all, I’m happy with what I’ve got here. If you’d like to offer some feedback, go to the message gateway and drop me a line. It’ll be fun. I promise.

Ok, kids. So much to do. So many miles to go. New Year’s Resolution 1 of 4 is done and done. And only 1/4 of the year is burned. Good, good.

Stay tuned for more.

Later!
-Shawn