Skip to content
This repository has been archived by the owner on Sep 25, 2023. It is now read-only.

Style and conventions

xy edited this page Oct 28, 2013 · 2 revisions

pomelo has its own style and conventions, a brief summary is presented as follows:

  • Pomelo is a framework, so all the code we write is used to configure the framework and define some callback function which will be invoked by the framework.

  • When developing with pomelo, Usually, we export a factory function rather than an object while implementing artifact such as component, handler, filter, admin module and remote. It is more flexible to use a factory function than an object because we can do context injected and pass some options to these artifacts when invoking factory function to create it.

  • Based on the principle "convention over configuration", we have some specifications on code orgnization. All the server-related code should be placed at "/game-server/app/servers/", which includes one or both of handler and remote, they are placed into separated different subdirectory of server directory called handler and remote. Therefore, directory structure is very important in development based on pomelo.

  • The naming style of pomelo is similar to Java, In general, use ClasNamesLikeThis, methodNamesLikeThis, CONSTANT_VALUES_LIKE_THIS, variableNamesLikeThis, etc. This style is very common in many programming languages.

  • There are also other rules and conventions in pomelo, you can summarize it and make a contribution, all your contributions is welcome.

Clone this wiki locally