Coding style

7 views
Skip to first unread message

Victor Kazarinov

unread,
Jan 13, 2012, 3:31:25 AM1/13/12
to Kairos Webmail
Hello,

I found in Cappuccino this document: http://cappuccino.org/contribute/coding-style.php
and in section "Names" in section "5" it says that "_" is used for
member variables in Cappuccino itself, applications based on
cappuccino should not use that "_".
So, should we use prefix _ in member variables in kairos or not?

vincent richomme

unread,
Jan 13, 2012, 4:02:05 AM1/13/12
to kairos-...@googlegroups.com
Yes I prefer the _, look at some other  projects written in cappuccino (they are not part of cappuccino) :
https://github.com/cacaodev/Sequel-J/blob/master/client/SJHTTPRequest.j (actually this project is a very bad example because sometimes it uses a _ and sometimes it doesn't) 


I mean this is the same problem with objective-c, some developers uses _ and some other uses self.
Personnaly I prefer the _ because I come from a c#, c++ background and this is how we generally identify a 
member variable and it's less keystrokes than writing self.

Personally I don't mind if you want to use the following coding style:
_ for member variable except for @accessors  and @outlet

Now if you prefer to use self, I don't mind either.
To be honest I don't care as long as it works at the end.

I also found that google recommends to append a _ to member variable when using objective-c, ex foo_

I think I will also create a branch to use java or groovy++(really like syntax and very close to java so anyone can use it) because yesterday I lost 1 hour to just declare
a class with three different constructors. Indeed I wanted to create a class that is similar to the tcpclient in .net world and
wanted to declare  constructors that have different parameters but it's not possible, it means I need to rething totally the way
to write code and I cannot afford it.

To me groovy++ seems to be a better java with some functional paradigm.


Reply all
Reply to author
Forward
0 new messages