buildat/conventions.txt

65 lines
2.5 KiB
Plaintext
Raw Normal View History

2014-09-17 09:37:11 +03:00
Buildat conventions
===================
Coding style
------------
Look at the code. It is perfect and will be kept perfect. Requests to fix coding
style are not to be taken personally by the one requesting, nor the one being
2014-09-17 11:28:15 +03:00
requested to fix his style. If something is found to be missing from this
document, such additions shall be made.
2014-09-17 09:37:11 +03:00
2014-09-17 11:20:36 +03:00
The script (requires an unix shell and astyle):
Always run util/codestyle.sh before committing. It handles most whitespace
issues.
Identifiers:
- Class and struct names are CamelCase,
- All function names are lowercase_with_underscores,
- All variable names are lowercase_with_underscores,
2014-09-17 13:37:34 +03:00
- All member variables start with m_. If the struct in question is a stupid data
container, this does not need to be followed.
2014-09-17 11:20:36 +03:00
Never use "class", always use "struct".
2014-09-17 11:28:15 +03:00
Prefer lightweight interfaces with a creation function for the default
implementation, like "struct State" and "State* createState()". The default
implementation can be called "CState" in this case, if an obviously better name
does not exist.
Use std::unique_ptr and std::shared_ptr. (core/types.h: up_<> and sp_<>)
2014-09-17 13:37:34 +03:00
Function naming:
- Suffix _u: Unsafe, not included in public interface
2014-09-17 09:37:11 +03:00
Non-exception throwing and exception-throwing methods
-----------------------------------------------------
- get_x: Returns NULL or equivalent if not found
- check_x: Throws exception if not found
2014-09-17 11:24:54 +03:00
Directory structure
-------------------
├── 3rdparty << Bundled 3rd-party libraries
├── build << Build files; always mkdir build; cmake .. to keep things clean
├── cache << Runtime directory used by Buildat
├── share << Static files; installable in /usr/share/buildat
│   └── builtin << Built-in modules
├── src
│   ├── client << Client-specific code
│   ├── core << Core code (must be kept minimal but sufficient)
│   ├── impl << Interface implementations
│   ├── interface << Interface available to modules
│   └── server << Server-specific code
├── test << All kinds of stuff for testing
└── util << Miscellaneous development utilities
2014-09-17 09:44:09 +03:00
Commit messages
---------------
In present tense. Prepend a location to the message where possible. When adding
2014-09-17 11:20:36 +03:00
something, the "add" verb should be left out. Fine enough examples:
2014-09-17 09:44:09 +03:00
- interface::Server::check_module
- doc: conventions.txt, todo.txt
- Bind a socket but don't listen to it yet
- Remove Module::test_add
- client, 3rdparty/c55lib: Command-line parameters
- 3rdparty/cereal