- Mikael Olenfalk <mikael@olenfalk.se>
I started this project because I wanted to play with C++ and I wanted to create a smallish server-side applications which allows somebody to upload small C++ snippets and have them compiled on a wide range of compilers in order to test what code each compiler generates and how they handle certain constructs.
The easiest way to get started is by using Eclipse on a *NIX-like system (Mac or Linux).
I use the following plugins:
- Eclipse CDT 8
- Eclipse GIT
- Eclipse Mylyn (with Github Connectors)
Once you have installed all these plugins you can use the following Project Set File to quickly setup your workspace perform the following steps:
- Choose:
File > Import...
- Then select:
Team > Team Project Set
- In the URI field enter the following URL:
https://raw.github.com/mauve/the-farm/master/projectset.psf
(the above does not work while this repo is private, you need to get a URL which contains an access token, therefore just browse to the above file and select RAW view and then copy the URL)
Soonishly I will make this code build with Visual Studio 2011 aswell, I am however reluctant in accepting other build systems and IDEs.
To the project uses GNU Make on *NIX-like system and the Eclipse project uses the Make builder to build so the only thing you need to edit in order to build stuff is Makefile
. The Makefile
uses common.mk
which is a private project of mine which makes it possible to use Automake
-like syntax in makefiles.
If you have disabled Automatic Build, just click Project > Build All to build. The default target to build is all-Debug
which builds all targets in Debug.
To build just write:
$ make all-Debug
To get some help with the Make system just write:
$ make manual-toc | less -R
$ make manual | less -R
The idea is to have one or more management nodes and agents which connect to these management nodes, the nodes all talk to each other with custom message passing protocol which supports request-response and subscriptions (in both directions).
The code base is largely divided in three subdirectories: src/farm
, src/network
and src/util
. The src/farm
contains really application specific logic and types, src/network
contains completely application-agnostic networking code (it also contains a specific serialization which I want to replace with Boost.Serialize some time soon) and last but not least src/util
contains – as the name suggests – a pretty large utility library.
There is no really defined code-standard, but there is are some big guidelines I usually follow for all my code:
- application-specific classes use
CamelCase
, e.g.farm::jobs::JobOrder
- agnostic classes and types use
standard_naming_convention
, e.g.util::buffer::appendable_buffer
- I really like namespaces, e.g.
farm::jobs::JobOrder
, I still have to decide if I want that class to be namedfarm::jobs::Order
however - namespaces match directories, e.g.
farm::jobs::JobOrder
is located insrc/farm/jobs/job_order.hpp
- file-names use
standard_naming_convention
, e.g.src/farm/jobs/job_order.hpp
- I do not like
using namespace
, but I preferusing
instead, sometimesusing namespace
is useful though - stuff that is not supposed to be used outside of a module is put in a
_detail
subfolder - unit-tests are named
filename_tests.cpp
and are located just next tofilename.cpp
- some test-related utilities may be located in a
_test
subdirectory, those are usually special stuff - mocks are named
mock_filename.cpp
and are located just next tofilename.cpp
- I use tabs for everything and I usually never align, just indent, tab-size is set to 4
- inclusion guards are named
__DIR_SUBDIR_FILE_NAME_HPP__
- C++ source files are named
.cpp
and header files are named.hpp
- Stuff which has nothing in particular to do with the code in
src/farm
orsrc/network
is supposed to land in a fitting subdirectory ofsrc/util
with accompanying tests.
Copyright © 2012, All rights reserved, Mikael Olenfalk <mikael@olenfalk.se>
And yes I am evil (therefore the above copyright).