Opened 12 years ago

Closed 10 years ago

#711 closed defect (fixed)

BSD coding style

Reported by: mokhet Owned by: mokhet
Priority: highest Milestone:
Component: Xinha Core Version:
Severity: minor Keywords: bsd coding style
Cc:

Description

some parts of the code are really confusing and prevent some needed factorization. So i'm gonna try to standardize all the comments and use BSD coding style for my next update.

Change History (10)

comment:1 Changed 12 years ago by mokhet

  • Status changed from new to assigned

comment:2 Changed 12 years ago by mokhet

changeset:473 has made the file htmlarea.js totally compliant to BSD style coding. Much more work to go to fix all others files (plugins, etc.) and even probably more to comment correctly all the code :)

comment:3 Changed 12 years ago by mokhet

popupwin.js BSD style coding compliant in changeset:475

comment:4 Changed 12 years ago by kimss

Well, this is probably a very good thing, however I must say I'm no fan of this BSD style since it gives enormous amounts of lines and "whitespace".

Like theese 5 lines :
if(foo(bar)){

return true;

} else {

return false;

}

Becomes 8 lines, and lots of spaces :
if ( foo ( bar ) )
{

return true;

}
else
{

return false;

}

On the other hand, BSD style is much better than no style at all - just me who likes to boil down lines for easier reading.

Just had to add my 2 cents, :D

comment:5 Changed 12 years ago by kimss

That didnt come out right, go go wikistyle :

No BSD :
if(foo(bar)){

return true;

} else {

return false;

}

With BSD :
if ( foo ( bar ) )
{

return true;

} else {

return false;

}

comment:6 Changed 12 years ago by kimss

And for the last time, what did I smoke?
if ( foo ( bar ) )
{

return true;

}
else
{

return false;

}

comment:7 Changed 12 years ago by mokhet

Yes BSD style is making more whitespaces and lines, but it is helping a lot to read code. And javascript code needs absolutly to be human readable if you want to maintain it.

Once ticket #385 will be closed we will be able to propose a minimal version as suggested in #115.

I dont think the extra lines from BSD is a real issue to force us using another coding style.

comment:8 Changed 12 years ago by mokhet

  • Component changed from Documentation to Xinha Core
  • Summary changed from confusing code to BSD coding style

comment:9 Changed 11 years ago by ianb@…

I might suggest using a Javascript style guide, rather than BSD conventions which are intended for C code. Dojo has a style guide: http://dojotoolkit.org/js_style_guide.html -- I don't agree with all of it, but at least it is for Javascript.

Also, it may be more natural to use Java style than C. For instance, mixedCase is more common in Javascript (like Java), while under_scores are typical in C.

I also happen to actively dislike excessive vertical whitespace; but I'm trying to make my style opinions seem more objective ;) I'm a K&R kind of guy, I guess: http://en.wikipedia.org/wiki/Indent_style#K.26R_style

comment:10 Changed 10 years ago by ray

  • Resolution set to fixed
  • Status changed from assigned to closed
Note: See TracTickets for help on using tickets.