Sunday, January 10, 2016

Coding introduction

Hello, welcome back to my blog about automated trading. Last week I have covered the actions which my system does through the day. Today I will introduce the technologe and system I am using for all my code. At the end of this article everyone will be able to download and compile first utility unit.

Technology stack

At first let's look what technology stack I am using. I prefer to be independent. Therefore my stack is very small and every item brings me the real big benefit. Please see the list below.
  • Java
  • Maven
  • Mercurial (TortoiseHg)
  • Bitbucket
  • NetBeans IDE
  • OpenShift
  • Tomcat
  • PostgreSQL
All these technologies are well documented so if you want know more, then just DuckDuckGo them. From now on I am expecting user knowledge of these.

One important item is Bitbucket, the online version control system. I have created open repository there to allow anyone clone and run accompanying source without need of any registration. Link is below.

https://bitbucket.org/radekhecl/trading-cloud-blog

Every article which has accompanying source code will have separate branch and I will will say the branch name and the changeset. The only required action is to update repository to that revision and build it by Maven (mvn clean package). There are no additional dependencies required (except Java and Maven). If you like IDE, then you can use whatever you want as far as it supports Maven projects (I like NetBeans).

Coding style

Now let's go through the coding style. I love to write small units which are consistent, stable, thread safe, reusable, testable and well documented. This is proven for me to be very efficient. Cost for this is that initial set up takes more time. So let's just live with that. I have 30 page document explaining everything in detail with examples. If you are interested, then let me know and I will share it. For this blog let me just point 6 most important rules in the simple form.
  • Separate objects into data holders and functional objects
  • Data holders used across multiple layers are unmodifiable
  • Data holders used across multiple layers have equals method comparing all fields
  • Functional objects are derived from interface
  • Functional object with not trivial logic has to be tested
  • Full objects has to be compared during tests
Later in the blog I will point to these rules by examples. Believe that should make it clear. If not, please ask question and I will make it clear. Now let's look on the repository.

First example

There is commit ready for you. Branch is called 1-coding-style, changeset is aa83170744cd. At this point project includes class DefaultHttpConnector together with test DefaultHttpConnectorTest. This is utility unit which performs http requests. It will be used later as a connectivity provider. So use Maven and compile it.

Rules for usage are very simple. Do whatever you want, but don't make me responsible if something goes wrong. There is no guarantee from me. Would be nice if anyone can write me a 'thank you' message.

That's it for today. Next week I am going to publish article about historical quotes. Thank you for reading!

No comments:

Post a Comment