Stealing from the core and elsewhere

Mostly Irrelevant: MyselF


Development Director for Tag Creative Studio in Seattle

Tag works in all environments

Drupal has been used in our more standard web projects 

Won the Best in Class Interactive Media Award for Arts/Culture website for Chihuly Garden and Glass

What are we stealing?


No actual stealing

Not completely original: Drupal is a large open source system that incorporates ideas from all over

Looking at patterns and architecture rather than actual code to copy

Not a full examination of sample topics. Just structure

Examples are shown in a non-PHP language to show extensibility


IMPETUS


Good code patterns are portable

Not everything is done in Drupal

Drupal is a great teacher with lots of documentation

Typically it exposes structures at the high level

Annoyance

Topics

Bootstrapping 
Db Layer Abstraction

Weighting
Hook system

Dependencies (extended to Asynchronous)

Template system and Regioning

Themes


Generic Application Development

Portability

Scaling

Don't Repeat Yourself (DRY)

Set yourself up for success (SYUS)

Quick Theme Layer


Theme functions are just functions that take in data and spit out HTML

Theme functions are typically tree like - <ul>'s hand off <li> work to an <li> specific function

Theme functions can add baseline classes and other attributes 

Bootstrap


Best definition: "Improves itself by its own efforts."

Drupal's case: initializes variables, designates handlers to the server, and including files for access to functions, classes and interfaces

Drupal has a tiered process


Why Bootstrap


Control: knowing when an environment is / should begin, resolves dependencies

Encapsulates variables/classes/functions based on the context booting, placing it all in an expected place

Allows for multiple levels of booting. Full vs. partial

Scale: larger systems develop, extend or add a level of boot without interfering with existing levels

DB Abstraction


Drupal runs all of its Db queries through its own interface

This interface is implemented into one of three standard Db classes

Queries are clear to implement, and handle validation/sanitation implicitly

Ever concerned about connection setup? Me neither.

DIY


Using JS, AJAX typically becomes the Db layer 

For the moment, we'll ignore binding frameworks

Important to make it generic. But provide support for common actions.

Additional support for error handling, such as email alert, server log.

Weighting


Weighting is ubiquitous in Drupal

Most folks are exposed to weighting from the block system or possibly your own module development

Weighting is the order of rendering or module invoke, particularly useful in systematizing layout and resolving dependencies

Weighting is a simple numeric notation 

Why Weighting


Makes order of initializing / rendering  controlled rather than ad hoc or quasi-sequential

Weighting sets a convention or reference point for how booting / data gathering will run

Weighting is relative rather than well ordered. Pushing something to 1 doesn't require you push everything down


Hook System

Hooking is the process of allowing a function to tie into a particular thread 

Drupal uses hook_menu format where "hook" is the name of your function "_menu" is the hook

Drupal has a ton of hooks at a lot of levels that allow alteration of data, theme, validation, and additional function fires

HOoks Applied


Our hooks will just be a straight name match

Hooks are about scale and customization

Hooks are also about not setting stuff up you don't need to

Dependencies


Explicit Requirement for initializing

May need a particular modules functions

Fail without crashing

Emphasizes the importance of explicit initializing

BUT we may be waiting on data processing or remote confirmation


Dependencies in Use


Each module declares their own dependencies 

The list of invoke is swept and dependencies are slowly skimmed off

You have to avoid interrelated dependencies 

Dependencies work with and around weighting

Regions


Hardcoded into the page and identified in the theme info

The Region is decoupled from its content

Allow for unlimited extension

Content within the region is also weighted. 


Regions Come Alive 


Fill a request to be added to a region within modules

Before display do a check on weighting to create order

Additionally, in this version we separate out template functions into module specific theme components

What do we have


Truly extensible system : any number of modules, regions, or content pieces

Arrangeable: template can be modified with messing with any other components (mostly)




Future Subjects


User system

Schema Generation

JavaScript Interaction Management

Validation

Pre and Post process Templates and Data management

CORey Kahler


Tag Creative Studio

Corey@tagcreativestudio.com

http://tagcreativestudio.com/drupal-summit

http://slid.es/coreytag/stealingfromcore

Stealing from the core and elsewhere

By coreytag

Stealing from the core and elsewhere

  • 1,202