Semantic

Semantic is a set of standards designed to make front end development less arbitrary.

Just the details
Tell me everything

What is Semantic?

Semantic has two parts. The semantic standard, and the semantic library.

The standard

The semantic standard attempts to create a standard design pattern for describing static UI components (UI elements), and dynamic UI components or behavioral definitions (Javascript modules).

Static elements: menus, columns, grids, tables, buttons, forms.

Dynamic components: popups, modals, chat rooms.

Behavioral components: form validation, state management, history.

Defining UI

Semantic creates an exchange format for UI, by defining a consistent HTML structure and set of class names for representing UI elements.

Sharing a structural standard for UI releases the burden from developers at being a naming authorities in their own projects.

If, as a community we can agree on consistent UI definitions, then we can freely share variations of element designs without having to modify our site's codebase to match any declarative expectations by other developers, and interface designs can be freely exchanged between projects and teams.

What's in an element

UI elements definitions are made of 4 parts:

  1. An ideal form of an element (A bunny has two long ears and is furry)
  2. A list of states which the element can exist. (A bunny can either be hopping, eating or sitting still)
  3. A definition of the relationship between a plural and singular instance of an element (Three white bunnies are each white)
  4. A definition of possible variations of the element (A bunny can be large or small and can be spotted or fuzzy)

UI elements can be thought of as nouns, and variations as adjectives. Variations are written in a way which only describe the innate features of that variation in the context of the noun. For example, in english, a large planet has a different meaning than a large chair, but both are the same variant "largeness".

Variations can be used together without negating each other unless used in a pardoxical way (A large small bunny).

I don't know what you're talking about just show me the code

If you'd like to shortcut any more explanation, check out the standard definition for a UI button for a live example.

UI Button Spec

Defining Modules

The Semantic modules standard is created primarily to accomplish two things:

  1. Provide conveniences for module authors so that they can be written faster and without clutter.
  2. Add features which make understanding and debugging other developers' modules simpler

Why use Semantic Modules?

  1. Puts accessibility first. Although Coffeescript is beautiful, and Angular is smart, Semantic has a different agenda: to be easy to use, and opinionless. Semantic can be thought of more as the Aaron Copland of programming libraries. It only requires an understanding of jQuery and Javascript to begin writing code. If you're stuck there are also plenty of examples to help you get started.
  2. Is self documenting. Instead of reading through inline comments to determine what a developer is intending, semantic allows developers to pass meaningful debug data where its most useful: the javascript console. This allows you to see the sequence of events that occur in a module , along with useful debug information, like the value of significant variables. If you're in the source code, debug statements also read similarly to code comments which provide context. Show me
  3. Designed to separate the arbitrary bits from the core logic of your module. Ever scroll through an unfimiliar library looking for the line of code where they define the ID tag for an expected html structure? Semantic keeps you from ever having to do that again. Developer decisions like metadata, classnames, selectors, and messages are separated from the less arbitrary parts of code. Show me
  4. Lets you access anything, and change everything. Methods defined as part of module definitions are all invokable. Semantic also maps from dot notation to their appropriate locations inside the module, allowing developers not to only make flat modules. Settings can be changed at initialization, or after. Module defaults can be changed whenever. Show me
  5. Plays nice with other libraries. Modules have teardown methods which will remove any bound events or initialized code. Modules also use namespaced events so you can have more flexibility over defining and clearing them
  6. Patterns for every need. Semantic has patterns that work well both as a widget factory, and as a single entity.

You really like to talk. Lets see some code

For a complete definition of the specification check to annotated source:

Single Instance / Behavioral
Many Instances

The Libraries

To semantic library is a set of UI elements and javascript modules that provides an example implementation of the Semantic standard. The purpose is to be useful in their own right for developers, but also to provide a guide for how the standard can be used.

The UI Library

The aim is to release pieces of the library on a schedule over the course of the next few months.

UI Release Calendar

The module library

Javascript modules.