mauve / the-farm

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

the-farm

Authors:

  • Mikael Olenfalk <mikael@olenfalk.se>

About

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.

Getting Started with Development

The easiest way to get started is by using Eclipse on a *NIX-like system (Mac or Linux).

Setting up Eclipse

I use the following plugins:

  1. Eclipse CDT 8
  2. Eclipse GIT
  3. 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:

  1. Choose: File > Import...
  2. Then select: Team > Team Project Set
  3. 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.

Building

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.

Building in Eclipse

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.

Building on the Command Line (NIX)

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

Architecture

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.

Code Standard

There is no really defined code-standard, but there is are some big guidelines I usually follow for all my code:

  1. application-specific classes use CamelCase, e.g. farm::jobs::JobOrder
  2. agnostic classes and types use standard_naming_convention, e.g. util::buffer::appendable_buffer
  3. I really like namespaces, e.g. farm::jobs::JobOrder, I still have to decide if I want that class to be named farm::jobs::Order however
  4. namespaces match directories, e.g. farm::jobs::JobOrder is located in src/farm/jobs/job_order.hpp
  5. file-names use standard_naming_convention, e.g. src/farm/jobs/job_order.hpp
  6. I do not like using namespace, but I prefer using instead, sometimes using namespace is useful though
  7. stuff that is not supposed to be used outside of a module is put in a _detail subfolder
  8. unit-tests are named filename_tests.cpp and are located just next to filename.cpp
  9. some test-related utilities may be located in a _test subdirectory, those are usually special stuff
  10. mocks are named mock_filename.cpp and are located just next to filename.cpp
  11. I use tabs for everything and I usually never align, just indent, tab-size is set to 4
  12. inclusion guards are named __DIR_SUBDIR_FILE_NAME_HPP__
  13. C++ source files are named .cpp and header files are named .hpp
  14. Stuff which has nothing in particular to do with the code in src/farm or src/network is supposed to land in a fitting subdirectory of src/util with accompanying tests.

Copyright

Copyright © 2012, All rights reserved, Mikael Olenfalk <mikael@olenfalk.se>

And yes I am evil (therefore the above copyright).

About


Languages

Language:C++ 100.0%