Naming Conventions

From PowerUI
Jump to: navigation, search

What's with the member names in PowerUI?

Member names (methods, fields etc) seem to often randomly alternate between camelCase and PascalCase. It's particularly apparent in PowerUI 2. This is because PowerUI has two 'layers' of public methods - web and internals.


PowerUI public internals vs. the public web API

PowerUI is often very liberal with the 'public' keyword because we'd rather not hide functionality for people who really know what they're doing in order to expose a "web only" API. That would rather ironically go against everything PowerUI exists for - a UI framework based on web standards which is completely open to modifications.

So, the public web API which is typically accessed by Javascript follows the camelCase conventions. The public internals API follows C# conventions of PascalCase. This primarily has the nice benefit of consistency from the web point of view; document.getElementById("hello") is perfectly valid in .NET/C# and Javascript. If you want to convert Javascript to C# to squeeze out as much performance as you can, this consistency is extremely useful!

Vendor Prefixing

PowerUI uses two vendor prefixes:

  • -spark-

Used when adding unique functionality that is likely to collide with web standards

  • -moz-

Used when supporting W3C standards that are a work in progress and are likely found "in the wild"


We're also considering using -webkit- whenever some webkit specific functionality appears useful. For example, styling scrollbars in a consistent way; there's no standard for it and only webkit allows doing it at all, but styling scrollbars is rather important for UI's!