I want to code for emesene HOWTO
Friday, January 18th, 2008This post is to encourage people who want to start coding for emesene and don’t know how, for this you must have some understanding of programming, not necessary python.
First, if you don’t know too much about python, start reading this:
http://diveintopython.org/toc/index.html
It’s translated into a lot of languages, just google it.
Then when you know something about python, read this:
http://www.python.org/dev/peps/pep-0008/
this describes how the code should be written, on emesene we are using this convention since some months, and the code is really better on that way, to resume some of the style guidelines:
* Classes are CamelCase (ClassNameLikeThis)
* Variable names are with underscore (variable_name_like_this)
* no space after of before a [,],(,),{ or }
* commas on parameters have a space after them “def foo(bar, arg, baz):”
* indentation is with 4 spaces
* the lines should be less than 80 characters
* use a space between operators “((1 + 2) * (2 / 4))”
and some others that i don’t remember if they are there:
* no black magic or one liners that no one understand, write more code if it make the code easier to read
* use descriptive variable, class and method names
* write docstrings for all methods, and for the module
* test what you write, a lot of times
Maybe i forgot some of the advises, but with this, now you can choose where you want to start (or how):
* Start reading the code and making questions on the forum
* Try to create a plugin, it doesn’t matter if it does nothing useful, just try it
* Try to enhance or fix a bug on a plugin
* Try doing enhancements on the modules without changing the functionality, just applying the above recommendations on the old code that doesn’t follow them, you will learn a lot.
* See on the forum if someone ask for something easy and ask how to do it yourself
* Try to add some feature you want (don’t start with video or audio support)
* Add error checking to places you think should have that.
Whit that you should start feeling more comfortable with the code, when you do something useful post the patch on the forum or the trac and be patient, if it’s not seen for a while post again on the same thread or ask, we are few devs and do it on our free time, so the forum posts are read really fast (at least by me).
I hope it helps.