add lexical cast and sstream notes to contributing docs

This commit is contained in:
Dane Springmeyer 2013-01-03 18:58:37 -08:00
parent e7f608c2fa
commit a7eaab9d07

View file

@ -2,11 +2,11 @@
## Community
Mapnik is an open source community creating a tool to enable to the craft of making beautiful maps. Working together collaboratively towards this goal is what makes it all possible and fun.
Mapnik is a creative community focused on making beautiful maps with beautiful software.
We host our code on github.com/mapnik and encourage anyone interested to fork the repository and provide pull requests or patches for things they want to see added.
We host our code on github.com/mapnik and encourage anyone interested to fork the repository and provide pull requests or patches for things they want to see added or fixed.
If you just have a question about the code, or a feature you want to discuss then feel free to create a new issue.
If you just have a question about the code, or a feature you want to discuss then feel free to create a new issue at github.com/mapnik-support.
## Code Philosophy
@ -15,10 +15,9 @@ Look through the code to get an idea, and do not hesitate to ask questions.
Also read the design philosophy page for the motivations that lead to code decisions.
Templates are good, within reason. We seek to use templates were possible for flexible code, but not in cases where functional
patterns would be just as concise and clear.
Templates are good, within reason. We seek to use templates where possible for flexible code, but not in cases where functional patterns would be just as concise and clear.
In general we use Boost, it makes more possible in C++. It is a big build time dependency (as in time to compile against and # of headers) but ultimately compiles to small object code and is very fast (particularly spirit). It also has no dependencies itself (it's really an extension to the C++ language) so requiring it is much easier than requiring a hard dependency that itself has other dependencies. This is a big reason that we prefer AGG to Cairo as our primary renderer. Also AGG, besides producing the best visual output, strikes an excellent balance between speed and thread safety by using very lightweight objects. Cairo not so much.
In general we use Boost, it makes more possible in C++. It is a big build time dependency (as in time to compile against and # of headers) but ultimately compiles to small object code and is very fast (particularly spirit). It also has no dependencies itself (it's really an extension to the C++ language) so requiring it is much easier than requiring a hard dependency that itself has other dependencies. This is a big reason that we prefer AGG to Cairo as our primary renderer. Also AGG produces the best visual output and strikes an excellent balance between speed and thread safety by using very lightweight objects. Cairo not so much.
You will also notice that we don't use many of the standard geo libraries when we could. For instance we don't use GDAL, OGR, or GEOS anywhere in core, and only leverage them in optional plugins. We feel we can often write code that is faster and more thread safe than these libraries but that still does the job. If this ever changes we can adapt and start using these libraries or others as dependencies - nothing is nicer than standing on the shoulders of giants when it makes sense.
@ -85,6 +84,15 @@ Mapnik is written in C++, and we try to follow general coding guidelines.
If you see bits of code around that do not follow these please don't hesitate to flag the issue or correct it yourself.
#### Avoid boost::lexical_cast
It's slow both to compile and at runtime.
#### Avoid sstream objects if possible
They should never be used in performance critical code because they trigger std::locale usage
which triggers locks
#### Spaces not tabs, and avoid trailing whitespace
#### Indentation is four spaces