Planet Ubercart
Defining Classes in Modules "Leanly"
Through some personal development efforts and work on Ubercart, I've been confronted lately with how to best use classes in my Drupal modules. For this post, I'm really just curious how others are defining and using classes in their modules and if the "lean" approach I've outlined below is reasonable. (i.e. Is what I'm doing to ensure Drupal loads less code even worthwhile?)
The general idea I'm following is that I want as little unnecessary code to be in my .module file as possible. To that end, I'm following Drupal's core practice of using .admin.inc and .pages.inc files to hold page callbacks. I believe Views does something similar (coupled with some auto-inclusion), and we're using this in some places in Ubercart.
Now I'm doing some experimental development on making something like a shopping cart a class. I've used a method in my FreshBooks module (w.i.p.) where I define the class in a .class.inc. So, in the module I obviously can't use $object = new ClassName();, but instead I create a small function in the .module that includes the .class.inc and passes the arguments on to the constructor when it creates and returns the object. From there on out it's using an object like normal.
This means I can have a thousand lines of code tucked neatly into a .class.inc file that needn't be loaded and parsed on every page request... just those where the class is actually needed. It also helps me personally to isolate all this code in a single file when developing/debugging. It seems like this segmentation would provide a performance boost, but I don't know what sort of tests to do to establish that. Should I just assume less code loaded is better? What about the require_once() bits from Rasmus' Drupalcon session?
What about possible pitfalls? Another module can't simply extend my class right off, but it could just as easily include the .class.inc before trying to do so. Would the hassle and file access outweigh the memory difference? Thoughts?
Got a few minutes to share your thoughts on Drupal?
We’re conducting a 13-question survey to better understand what users of Drupal find lacking in some specific areas, including themes, e-commerce, and support. The responses will primarily be used for a series of free reports, and also to help us create products/services that better serve your needs.
Personal/contact information is optional. We’ll also be sharing the (anonymized) results so they can benefit everyone.
Take the surveyTwo new Drupal 6 themes, plus customer favourite Ubercart theme updated
Two new Drupal 6 themes joined the TopNotchThemes family yesterday, Fresh Start and Vidz. Also worth noting is that our top selling theme for Ubercart, Sharp Sales, has now been updated to Ubercart 2 for Drupal 6, which is still in development but getting very close to a stable release. Ah, life on the bleeding edge!
Fresh Start is a clean and, um, fresh theme for Drupal 6. It's a wide two column theme where your sidebar can easily switch from left to right. Whether the (optional) sprouting plant is to be taken literally (perhaps for your environmental or grassroots organization) or metaphorically (new startup, anyone?), you can't go wrong with a light, modern look.
Vidz is a new Drupal 6 design that gets a little funky with custom layout theming for multimedia websites -- if you're using the Embedded Media Field module, the Vidz theme will give media nodes and teaser listings a nice floated layout. Of course it also would work great for a corporate site, blog, or online community.
Article declares Ubercart part of "A new breed of open source shopping carts"
I got a Google Alert and an e-mail from Wim Mostrey upon returning from lunch today both linking to this article posted on the IT news site InternetNews. The topic of the article is open source shopping carts, and the author reviewed Ubercart alongside of Prestashop and previously Magento as part of a new breed of carts. As you might guess... that makes me happy. 
The Ubercart "brand" continues to stand up independently while at the same time spreading awareness and good karma for Drupal through non-traditional channels like this article and the recent nod in PC Magazine. The review was pretty encouraging, and the author managed to relate the back story of Ubercart quite well without having to consult me regarding the oft confused tale.
What's more, a good majority of her Ubercart review focuses on the strengths of Drupal as a content management system. She points out the advantages of Drupal's modularity and highlights several major contributed modules like CCK, Views, and Userpoints. I'm grateful yet again for the strengths of Drupal as a base for an e-commerce suite.
Check out the article if you feel inclined and post your feedback here.
7 reasons why Ubercart is the right choice for Drupal e-commerce
We had to make a tough decision early this year — which Drupal e-commerce package was right for us? There are currently two full e-commerce solutions for Drupal, eCommerce and Ubercart.
We chose Ubercart and jumped in with both feet. We’re happy to say that nine months later, this has definitely shown itself to be the right choice.
This post isn’t really going to discuss the technical merits or specific features of each option. This is better served by doing your own research on each one to see if there are any particular features that you need. What I’m going to focus on here are the less tangible aspects; things that we have since found to be clear indicators of the strength of Ubercart.
1) Big names are using itProminent companies such as AOL and Warner Brothers Records has been using Ubercart for a while. More recently, Lullabot launched an Ubercart site for their conference registration (and will be covering UC in their upcoming book), and Acquia’s registration for their beta service currently uses Ubercart. Support from key players like this has a lot of weight in the Drupal community.
|
|
|
Planet Ubercart is accepting settlers from all corners of the web. If you'd like to find a home for your Ubercart related posts on the planet, check out this post for more information. |


