/codex

Good and bad practices from life experience.

Creative Commons Attribution 4.0 InternationalCC-BY-4.0

codex

Good and bad practices from life experience.

Content

  1. Introduction — few words about the Codex.
  2. Naming — a section about naming stuff.

Introduction

codex is a handbook about code, architecture and things in-between.

Want to contribute? Read the short guide before you do.

Naming

Some examples of odd and bad class naming from one project:

/*
`RichComboBoxComboBox` is a class, that represents `ComboBox` DOM element.
*/
class RichComboBoxComboBox extends ComboBox { /* ... */ }

/*
`RichComboBox` is a class, that represents form input with validation
and other logic.
*/
class RichComboBox extends CompositeFormInputEl {
  constructor() {
    // Composition: `RichComboBoxComboBox` inside `RichComboBox` to control the
    // visual representation with client logic.
    this.comboBox = new RichComboBoxComboBox();
  }

/*
Later, class was renamed `RichComboBoxComboBox` -> `LoaderComboBox`,
because it uses lazy loading, provided by `Loader`.
*/
/*
View (representation, DOM element) of `FormOptionSet` for items of type `Options`.
*/
class FormOptionSetOptionView extends FormItemView { /* ... */ }