Skip to content
This repository was archived by the owner on Dec 20, 2022. It is now read-only.

Code conventions

Günter Zöchbauer edited this page May 17, 2014 · 3 revisions

Directory structure

Naming conventions

Generic file naming rule

  • No dashes in file names. Dashes should be changed to underline characters in all file names.

Library name

  • .dart files of elements should have a library statement like [package].[element] (i.e. library polymer_elements.polymer_flex_layout;
  • .dart files of examples TODO
  • .dart files of example specific custom elements TODO

Elements

  • Each custom element is put in its distinct subdirectory in [package]/lib as it is in the JS polymer-elements/polymer-ui-elements.
  • Sometimes such a directory may contain additional custom elements if they are closely related as it's the case in some the JS polymer-elements.
  • All related source files (.dart, .html) and related asset files (.css, .png, ...) go into the elements subdirectory as well.
  • Shared assets go into the [package]/lib/asset directory.

Examples

  • The example pages for the custom elements go into the [package]/example directory.
  • Example pages are named like the elements they are for.
  • Supporting files go into a subdirectory in [package]/example/src/[element name]
  • TODO Library names for example page and supporting source files

Directories

  • [package]/example contains the main page for each example.
  • [package]/example/src[element name] contains supporting files for an example.
  • [package]/lib/asset contains assets shared between custom elements.
  • [package]/lib/[element name] contains all files (source, asset) for an element and if necessary also closely related custom elements.
  • [package]/test contains the main page for each test.
  • [package]/test/src/[element name] contains supporting files for a test for a custom element.
  • For directories not listed the generic Dart package layout conventions apply.

Code conventions

Use default Dart style guide for source code and dartdoc comments.

Dart code

Copyright header

If we change a file copied from JS SlickGrid we replace the file header to:

// Copyright (c) 2013, the bwu_datagrid project authors.  Please see 
// the AUTHORS file for details. All rights reserved. Use of this source code is 
// governed by a BSD-style license that can be found in the LICENSE file.
// This work is a port of the JavaScript SlickGrid component, 
// https://github.com/mleibman/SlickGrid. 

HTML

Copyright header

If we change a file copied from JS SlickGrid we replace the file header to:

<!-- 
Copyright (c) 2013, the bwu_datagrid project authors.  Please see
the AUTHORS file for details. All rights reserved. Use of this source code is 
governed by a BSD-style license that can be found in the LICENSE file. 
This work is a port of the JavaScript SlickGrid component, 
https://github.com/mleibman/SlickGrid. 
-->
Clone this wiki locally