Creative Communications

29 October, 2008

A Methodology for Approaching New Frameworks

Filed under: Insights,Using Experience,Work Adaptations — Tags: , , — Sean Canton @ 12:49 pm

How many frameworks have I wrapped my head around, Symfony, Ruby on Rails, Joomla, Drupal, WordPress, and now, I’ve been tasked with porting a classified ad module from phpBB2 to phpBB3. In approaching a foreign framework and trying to understand it’s workings as a whole I almost gave up several times. Looking at it from the outside in, I find it overwhelming to try to understand how it all ties together from a big picture point of view.
That’s just my uninformed approach, because I feel like I have to understand all I can before jumping into the pool. This isn’t the right approach, and my hope is that by committing this to bytes, I’ll change it next time around and save myself some time. Maybe save you some time too.
The right approach is systematic, and involves a step-by-step understanding of how a single element is rendered on a page and interacted with.

1) After installation and basic configuration find the index file and it’s associated code, language files and templates.
2) Work your way backwards from a specific element in the body of the document. Title tags are part of the header and are often a level removed from the index template.
3) Find the template variables in the code, and where that information is pulled from.
4) Learning a new framework is akin to learning a new programming language, in that it’s not the function that matters. Loops, conditionals, and variables are the same idea no matter where you are. It’s the language you use to access these ideas. So pay attention to:

  • How template variables are set
  • How database calls are made
  • How are session variables handled

Basically, everything that has to do with the movement of information is worth paying attention to because the whole point of using a framework is because those pathways are already created for you to use.

5) Learn about custom functions. I find it’s useful to keep a untampered copy of a framework available locally to search through for functions.

6) Identify your global classes. Finally, we’re back to the bigger picture. Global classes are the super-objects used to pass information around and reference it easily within the code. For me at least, I had to see the classes ‘in action’ before I could begin to fully understand what their purpose was.

This might be phpbb3 specific, but that’s where my head is right now. I think the basic ideas could apply to other frameworks however.

That’s it, now I have to get back to porting.

Powered by WordPress