Code convention, coding standarts

Asked by Anton Feoktistov

Hi,

has Sikuli java classes some document how to format code? As example, Sun/Oracle java code convention:
http://www.oracle.com/technetwork/java/codeconventions-150003.pdf

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
RaiMan
Solved:
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

If you use the Python/Jython level (Sikuli IDE), it is Python code you write - so it is Python conventions.

If you program on the Java level - ok, you know the answer ;-)

So nothing special with Sikuli.

Revision history for this message
Anton Feoktistov (anton-feoktistov) said :
#2

Thank RaiMan, but I mean code in Sikuli Script.

If I want to commit changes on github? For example, in org.sikuli.script.Region class, which style should I follow? I saw, fields start always from underscore, no javadoc in source, etc..

Revision history for this message
Best RaiMan (raimund-hocke) said :
#3

Ok, understood.

Good question, next question ;-)

There are no coding standards documented and if you dive deeper into the sources, you might get the impression, that there are possibly none at all (I am not one of the developers ;-)

The underscore though is a Python convention to mark variables as "private" (should not be accessed from outside directly).

So just make your changes in your fork and if you think it should be integrated in the next release, make a pull request. This will hopefully be checked by the developers and pulled.

But currently the development pauses somehow, so be happy with your own Sikuli version.

One comment on the Python layer:
This was stripped down to the really Python specifics with rc3 and further enhancements to the core classes like Region should be made on the Java level.

Look: https://blueprints.launchpad.net/sikuli/+spec/sikuli-revise-api-and-structure

Revision history for this message
Jacob Dorman (japhezbemeye) said :
#4

Having looked at the Java source for Sikuli and extended it a little on my own, I'd say that it "generally" follows Java object oriented standards. There seems to be a slight leaning toward making things protected, but the design mentality is to maximize easy of use it seems. The public interface is basically just the information that's useful, the work is hidden in the back for the most part.

I'm not sure if I explained anything useful, really.

Revision history for this message
Anton Feoktistov (anton-feoktistov) said :
#5

Thanks RaiMan, that solved my question.

Revision history for this message
Anton Feoktistov (anton-feoktistov) said :
#6

Thanks Jacob, I absolutely agree with you, public interface is great.

Hope, I will help with developing ;)