svn commit: r1564675 - /struts/site/trunk/content/markdown/coding-standards.md
Author: lukaszlenart Date: Wed Feb 5 08:52:05 2014 New Revision: 1564675 URL: http://svn.apache.org/r1564675 Log: Adds new coding guideline page Added: struts/site/trunk/content/markdown/coding-standards.md Added: struts/site/trunk/content/markdown/coding-standards.md URL: http://svn.apache.org/viewvc/struts/site/trunk/content/markdown/coding-standards.md?rev=1564675&view=auto == --- struts/site/trunk/content/markdown/coding-standards.md (added) +++ struts/site/trunk/content/markdown/coding-standards.md Wed Feb 5 08:52:05 2014 @@ -0,0 +1,83 @@ +Coding standards + +# In the first place + +Please remember that most of the time others will read your code. Focusing on that allow you to gain required perspective +about how code should look like. Defaults, margins, convention doesn't matter if what you write is hard to read. + +**Readability is the first rule!** + +## Separation of concern + +If you want to reformat given file, part of class, etc do it in a dedicated commit. Never ever mix bug fixing, +new feature implementation with code reformatting. Thus only confuses people reviewing your code. + +**Reformat different than coding!** + +## Ask! + +If something isn't clear, you have doubts and anything else - ask! Maybe during materialising your thoughts as text +you will gain the answer - Rubber Duck effect :-) Anyway, instead spending time on looking for solution - ask. + +The best place to ask question is Struts Developers List [d...@struts.apache.org](mailto:d...@struts.apache.org) + +## WIP + +If you have any idea how to improve this guideline, don't hesitate to send them to us! Any help is welcome! + +# Examples + +Below examples shows how you should proceed when adjusting given part of source code via reformatting, extracting +or improving. + +## From defaults to extractions + +The original source code: + +// Hidden input section +a = new Attributes(); +a.add("type", "hidden") +.add("id", "__multiselect_" + StringUtils.defaultString(StringEscapeUtils.escapeHtml4(id))) +.add("name", "__multiselect_" + StringUtils.defaultString(StringEscapeUtils.escapeHtml4(name))) +.add("value", "").addIfTrue("disabled", disabled); +start("input", a); +end("input"); + +After applying default reformatting (80 columns margin): + +// Hidden input section +a = new Attributes(); +a.add("type", "hidden") +.add("id", +"__multiselect_" ++ StringUtils +.defaultString(StringEscapeUtils +.escapeHtml4(id))) +.add("name", +"__multiselect_" ++ StringUtils +.defaultString(StringEscapeUtils +.escapeHtml4(name))) +.add("value", "").addIfTrue("disabled", disabled); +start("input", a); +end("input"); + +Some suggestions how to improve the code: + +- use static imports + +a.add("type", "hidden") + .add("id", "__multiselect_" + defaultString(escapeHtml4(id))); + +- use dedicated method + +a.add("type", "hidden") + .add("id", "__multiselect_" + safeId(id)); + +- use builder + +a.add("type", "hidden") + .add("id", HtmlID.with("__multiselect_").withSafeId(id).create()); + +As you can see, reformatting a code is just the beginning, you shouldn't stop there and think *how can I improve +readability* and follow that path to the end.
svn commit: r896488 - /websites/staging/struts/trunk/content/
Author: buildbot Date: Wed Feb 5 08:52:22 2014 New Revision: 896488 Log: Staging update by buildbot for struts Added: websites/staging/struts/trunk/content/coding-standards.html Modified: websites/staging/struts/trunk/content/ (props changed) websites/staging/struts/trunk/content/announce-2002.html websites/staging/struts/trunk/content/announce-2003.html websites/staging/struts/trunk/content/announce-2004.html websites/staging/struts/trunk/content/announce-2005.html websites/staging/struts/trunk/content/announce-2006.html websites/staging/struts/trunk/content/announce-2007.html websites/staging/struts/trunk/content/announce-2008.html websites/staging/struts/trunk/content/announce-2009.html websites/staging/struts/trunk/content/announce-2010.html websites/staging/struts/trunk/content/announce-2011.html websites/staging/struts/trunk/content/announce-2012.html websites/staging/struts/trunk/content/announce.html websites/staging/struts/trunk/content/birdseye.html websites/staging/struts/trunk/content/builds.html websites/staging/struts/trunk/content/bylaws.html websites/staging/struts/trunk/content/dev-mail.html websites/staging/struts/trunk/content/download.html websites/staging/struts/trunk/content/downloads.html websites/staging/struts/trunk/content/faqs.html websites/staging/struts/trunk/content/git-for-struts.html websites/staging/struts/trunk/content/helping.html websites/staging/struts/trunk/content/index.html websites/staging/struts/trunk/content/javadoc.html websites/staging/struts/trunk/content/kickstart.html websites/staging/struts/trunk/content/mail.html websites/staging/struts/trunk/content/primer.html websites/staging/struts/trunk/content/release-checklist.html websites/staging/struts/trunk/content/releases.html websites/staging/struts/trunk/content/roadmap.html websites/staging/struts/trunk/content/security.html websites/staging/struts/trunk/content/struts1eol-announcement.html websites/staging/struts/trunk/content/struts1eol-press.html websites/staging/struts/trunk/content/volunteers.html websites/staging/struts/trunk/content/youatstruts.html Propchange: websites/staging/struts/trunk/content/ -- --- cms:source-revision (original) +++ cms:source-revision Wed Feb 5 08:52:22 2014 @@ -1 +1 @@ -1562370 +1564675 Modified: websites/staging/struts/trunk/content/announce-2002.html == --- websites/staging/struts/trunk/content/announce-2002.html (original) +++ websites/staging/struts/trunk/content/announce-2002.html Wed Feb 5 08:52:22 2014 @@ -1,13 +1,13 @@ http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en"> - + Announcements - 2002 and prior @@ -164,7 +164,7 @@ - Last Published: 2014-01-29 + Last Published: 2014-02-05 Modified: websites/staging/struts/trunk/content/announce-2003.html == --- websites/staging/struts/trunk/content/announce-2003.html (original) +++ websites/staging/struts/trunk/content/announce-2003.html Wed Feb 5 08:52:22 2014 @@ -1,13 +1,13 @@ http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en"> - + Announcements - 2003 @@ -164,7 +164,7 @@ - Last Published: 2014-01-29 + Last Published: 2014-02-05 Modified: websites/staging/struts/trunk/content/announce-2004.html == --- websites/staging/struts/trunk/content/announce-2004.html (original) +++ websites/staging/struts/trunk/content/announce-2004.html Wed Feb 5 08:52:22 2014 @@ -1,13 +1,13 @@ http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en"> - + Announcements - 2004 @@ -164,7 +164,7 @@ - Last Published: 2014-01-29 + Last Published: 2014-02-05 Modified: websites/staging/struts/trunk/content/announce-2005.html == --- websites/staging/struts/trunk/content/announce-2005.html (original) +++ websites/staging/struts/trunk/content/announce-2005.html Wed Feb 5 08:52:22 2014 @@ -1,13 +1,13 @@ http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en"> - + Announcements - 2005 @@ -16
svn commit: r1564679 - /struts/site/trunk/content/site.xml
Author: lukaszlenart Date: Wed Feb 5 08:55:24 2014 New Revision: 1564679 URL: http://svn.apache.org/r1564679 Log: Adds Coding standards to menu Modified: struts/site/trunk/content/site.xml Modified: struts/site/trunk/content/site.xml URL: http://svn.apache.org/viewvc/struts/site/trunk/content/site.xml?rev=1564679&r1=1564678&r2=1564679&view=diff == --- struts/site/trunk/content/site.xml (original) +++ struts/site/trunk/content/site.xml Wed Feb 5 08:55:24 2014 @@ -118,6 +118,10 @@ href="builds.html" /> +
svn commit: r896489 - /websites/staging/struts/trunk/content/
Author: buildbot Date: Wed Feb 5 08:55:37 2014 New Revision: 896489 Log: Staging update by buildbot for struts Modified: websites/staging/struts/trunk/content/ (props changed) websites/staging/struts/trunk/content/announce-2002.html websites/staging/struts/trunk/content/announce-2003.html websites/staging/struts/trunk/content/announce-2004.html websites/staging/struts/trunk/content/announce-2005.html websites/staging/struts/trunk/content/announce-2006.html websites/staging/struts/trunk/content/announce-2007.html websites/staging/struts/trunk/content/announce-2008.html websites/staging/struts/trunk/content/announce-2009.html websites/staging/struts/trunk/content/announce-2010.html websites/staging/struts/trunk/content/announce-2011.html websites/staging/struts/trunk/content/announce-2012.html websites/staging/struts/trunk/content/announce.html websites/staging/struts/trunk/content/birdseye.html websites/staging/struts/trunk/content/builds.html websites/staging/struts/trunk/content/bylaws.html websites/staging/struts/trunk/content/coding-standards.html websites/staging/struts/trunk/content/dev-mail.html websites/staging/struts/trunk/content/download.html websites/staging/struts/trunk/content/downloads.html websites/staging/struts/trunk/content/faqs.html websites/staging/struts/trunk/content/git-for-struts.html websites/staging/struts/trunk/content/helping.html websites/staging/struts/trunk/content/index.html websites/staging/struts/trunk/content/javadoc.html websites/staging/struts/trunk/content/kickstart.html websites/staging/struts/trunk/content/mail.html websites/staging/struts/trunk/content/primer.html websites/staging/struts/trunk/content/release-checklist.html websites/staging/struts/trunk/content/releases.html websites/staging/struts/trunk/content/roadmap.html websites/staging/struts/trunk/content/security.html websites/staging/struts/trunk/content/struts1eol-announcement.html websites/staging/struts/trunk/content/struts1eol-press.html websites/staging/struts/trunk/content/volunteers.html websites/staging/struts/trunk/content/youatstruts.html Propchange: websites/staging/struts/trunk/content/ -- --- cms:source-revision (original) +++ cms:source-revision Wed Feb 5 08:55:37 2014 @@ -1 +1 @@ -1564675 +1564679 Modified: websites/staging/struts/trunk/content/announce-2002.html == --- websites/staging/struts/trunk/content/announce-2002.html (original) +++ websites/staging/struts/trunk/content/announce-2002.html Wed Feb 5 08:55:37 2014 @@ -122,6 +122,9 @@ Source Code +Coding standards + + Release Guidelines Modified: websites/staging/struts/trunk/content/announce-2003.html == --- websites/staging/struts/trunk/content/announce-2003.html (original) +++ websites/staging/struts/trunk/content/announce-2003.html Wed Feb 5 08:55:37 2014 @@ -122,6 +122,9 @@ Source Code +Coding standards + + Release Guidelines Modified: websites/staging/struts/trunk/content/announce-2004.html == --- websites/staging/struts/trunk/content/announce-2004.html (original) +++ websites/staging/struts/trunk/content/announce-2004.html Wed Feb 5 08:55:37 2014 @@ -122,6 +122,9 @@ Source Code +Coding standards + + Release Guidelines Modified: websites/staging/struts/trunk/content/announce-2005.html == --- websites/staging/struts/trunk/content/announce-2005.html (original) +++ websites/staging/struts/trunk/content/announce-2005.html Wed Feb 5 08:55:37 2014 @@ -122,6 +122,9 @@ Source Code +Coding standards + + Release Guidelines Modified: websites/staging/struts/trunk/content/announce-2006.html == --- websites/staging/struts/trunk/content/announce-2006.html (original) +++ websites/staging/struts/trunk/content/announce-2006.html Wed Feb 5 08:55:37 2014 @@ -122,6 +122,9 @@ Source Code +
svn commit: r1564681 - /struts/site/trunk/content/markdown/coding-standards.md
Author: lukaszlenart Date: Wed Feb 5 08:59:01 2014 New Revision: 1564681 URL: http://svn.apache.org/r1564681 Log: Applies source code formatting Modified: struts/site/trunk/content/markdown/coding-standards.md Modified: struts/site/trunk/content/markdown/coding-standards.md URL: http://svn.apache.org/viewvc/struts/site/trunk/content/markdown/coding-standards.md?rev=1564681&r1=1564680&r2=1564681&view=diff == --- struts/site/trunk/content/markdown/coding-standards.md (original) +++ struts/site/trunk/content/markdown/coding-standards.md Wed Feb 5 08:59:01 2014 @@ -66,18 +66,18 @@ Some suggestions how to improve the code - use static imports -a.add("type", "hidden") - .add("id", "__multiselect_" + defaultString(escapeHtml4(id))); +a.add("type", "hidden") + .add("id", "__multiselect_" + defaultString(escapeHtml4(id))); - use dedicated method -a.add("type", "hidden") - .add("id", "__multiselect_" + safeId(id)); +a.add("type", "hidden") + .add("id", "__multiselect_" + safeId(id)); - use builder -a.add("type", "hidden") - .add("id", HtmlID.with("__multiselect_").withSafeId(id).create()); +a.add("type", "hidden") + .add("id", HtmlID.with("__multiselect_").withSafeId(id).create()); As you can see, reformatting a code is just the beginning, you shouldn't stop there and think *how can I improve readability* and follow that path to the end.
svn commit: r896490 - in /websites/staging/struts/trunk/content: ./ coding-standards.html
Author: buildbot Date: Wed Feb 5 08:59:14 2014 New Revision: 896490 Log: Staging update by buildbot for struts Modified: websites/staging/struts/trunk/content/ (props changed) websites/staging/struts/trunk/content/coding-standards.html Propchange: websites/staging/struts/trunk/content/ -- --- cms:source-revision (original) +++ cms:source-revision Wed Feb 5 08:59:14 2014 @@ -1 +1 @@ -1564679 +1564681 Modified: websites/staging/struts/trunk/content/coding-standards.html == --- websites/staging/struts/trunk/content/coding-standards.html (original) +++ websites/staging/struts/trunk/content/coding-standards.html Wed Feb 5 08:59:14 2014 @@ -206,9 +206,18 @@ start("input", a); end("input"); Some suggestions how to improve the code: - use static importsa.add(type, hidden) .add(id, _multiselect + defaultString(escapeHtml4(id))); - use dedicated methoda.add(type, hidden) .add(id, _multiselect + safeId(id)); - use buildera.add(type, hidden) .add(id, HtmlID.with(_multiselect).withSafeId(id).create()); + use static imports + a.add("type", "hidden") + .add("id", "__multiselect_" + defaultString(escapeHtml4(id))); + + use dedicated method + a.add("type", "hidden") + .add("id", "__multiselect_" + safeId(id)); + + use builder + a.add("type", "hidden") + .add("id", HtmlID.with("__multiselect_").withSafeId(id).create()); + As you can see, reformatting a code is just the beginning, you shouldnt stop there and think *how can I improve readability* and follow that path to the end.
svn commit: r1564699 - /struts/site/trunk/content/site.xml
Author: lukaszlenart Date: Wed Feb 5 10:20:37 2014 New Revision: 1564699 URL: http://svn.apache.org/r1564699 Log: Corrects repo name at GitHub Modified: struts/site/trunk/content/site.xml Modified: struts/site/trunk/content/site.xml URL: http://svn.apache.org/viewvc/struts/site/trunk/content/site.xml?rev=1564699&r1=1564698&r2=1564699&view=diff == --- struts/site/trunk/content/site.xml (original) +++ struts/site/trunk/content/site.xml Wed Feb 5 10:20:37 2014 @@ -14,7 +14,7 @@ false true -apache/struts2 +apache/struts right darkblue
svn commit: r896501 - /websites/staging/struts/trunk/content/
Author: buildbot Date: Wed Feb 5 10:20:52 2014 New Revision: 896501 Log: Staging update by buildbot for struts Modified: websites/staging/struts/trunk/content/ (props changed) websites/staging/struts/trunk/content/announce-2002.html websites/staging/struts/trunk/content/announce-2003.html websites/staging/struts/trunk/content/announce-2004.html websites/staging/struts/trunk/content/announce-2005.html websites/staging/struts/trunk/content/announce-2006.html websites/staging/struts/trunk/content/announce-2007.html websites/staging/struts/trunk/content/announce-2008.html websites/staging/struts/trunk/content/announce-2009.html websites/staging/struts/trunk/content/announce-2010.html websites/staging/struts/trunk/content/announce-2011.html websites/staging/struts/trunk/content/announce-2012.html websites/staging/struts/trunk/content/announce.html websites/staging/struts/trunk/content/birdseye.html websites/staging/struts/trunk/content/builds.html websites/staging/struts/trunk/content/bylaws.html websites/staging/struts/trunk/content/coding-standards.html websites/staging/struts/trunk/content/dev-mail.html websites/staging/struts/trunk/content/download.html websites/staging/struts/trunk/content/downloads.html websites/staging/struts/trunk/content/faqs.html websites/staging/struts/trunk/content/git-for-struts.html websites/staging/struts/trunk/content/helping.html websites/staging/struts/trunk/content/index.html websites/staging/struts/trunk/content/javadoc.html websites/staging/struts/trunk/content/kickstart.html websites/staging/struts/trunk/content/mail.html websites/staging/struts/trunk/content/primer.html websites/staging/struts/trunk/content/release-checklist.html websites/staging/struts/trunk/content/releases.html websites/staging/struts/trunk/content/roadmap.html websites/staging/struts/trunk/content/security.html websites/staging/struts/trunk/content/struts1eol-announcement.html websites/staging/struts/trunk/content/struts1eol-press.html websites/staging/struts/trunk/content/volunteers.html websites/staging/struts/trunk/content/youatstruts.html Propchange: websites/staging/struts/trunk/content/ -- --- cms:source-revision (original) +++ cms:source-revision Wed Feb 5 10:20:52 2014 @@ -1 +1 @@ -1564681 +1564699 Modified: websites/staging/struts/trunk/content/announce-2002.html == --- websites/staging/struts/trunk/content/announce-2002.html (original) +++ websites/staging/struts/trunk/content/announce-2002.html Wed Feb 5 10:20:52 2014 @@ -27,7 +27,7 @@ -http://github.com/apache/struts2";> +http://github.com/apache/struts";> https://s3.amazonaws.com/github/ribbons/forkme_right_red_aa.png"; alt="Fork me on GitHub"> Modified: websites/staging/struts/trunk/content/announce-2003.html == --- websites/staging/struts/trunk/content/announce-2003.html (original) +++ websites/staging/struts/trunk/content/announce-2003.html Wed Feb 5 10:20:52 2014 @@ -27,7 +27,7 @@ -http://github.com/apache/struts2";> +http://github.com/apache/struts";> https://s3.amazonaws.com/github/ribbons/forkme_right_red_aa.png"; alt="Fork me on GitHub"> Modified: websites/staging/struts/trunk/content/announce-2004.html == --- websites/staging/struts/trunk/content/announce-2004.html (original) +++ websites/staging/struts/trunk/content/announce-2004.html Wed Feb 5 10:20:52 2014 @@ -27,7 +27,7 @@ -http://github.com/apache/struts2";> +http://github.com/apache/struts";> https://s3.amazonaws.com/github/ribbons/forkme_right_red_aa.png"; alt="Fork me on GitHub"> Modified: websites/staging/struts/trunk/content/announce-2005.html == --- websites/staging/struts/trunk/content/announce-2005.html (original) +++ websites/staging/struts/trunk/content/announce-2005.html Wed Feb 5 10:20:52 2014 @@ -27,7 +27,7 @@ -http://github.com/apache/struts2";> +http://github.com/apache/struts";> https://s3.amazonaws.com/github/ribbons/forkme_right_red_aa.png"; alt="Fork me on GitHub"> Modified: websites/staging/struts/trunk/content/announce-2006.html == --- websites/staging/struts/trunk/content/announce-2006.html (original) +++ websites/staging/struts/trunk/content/announce-2006.html Wed Feb 5 10:20:52 2014 @@ -27,7 +27,7 @@ -
[CONF] Confluence Changes in the last 24 hours
Confluence Changes in the last 24 hours Apache Camel Pages Page: Camel 2.13.0 Release edited by Claus Ibsen [10:16 AM] (View Changes) Apache Cloudstack Pages Page: Database High Availability (DB HA) edited by Damodar Reddy T [10:56 AM] (View Changes) Apache Hive Pages Page: WebHCat Reference Job edited by Lefty Leverenz [06:32 AM] (View Changes) Apache Kafka Pages Page: Powered By edited by Jay Kreps [11:56 PM] (View Changes) Page: Kafka 0.9 Consumer Rewrite Design edited by Guozhang Wang [03:18 AM] (View Changes) Apache Mesos Pages Page: Registrar Design Document edited by Benjamin Mahler [12:30 AM] (View Changes) OFBiz Project Administration Workspace Pages Page: New Features Roadmap - Living Document edited by Jacques Le Roux [11:49 AM] (View Changes) Apache Qpid Pages Page: ACL edited by Chuck Rolke [08:28 PM] (View Changes) This message was sent by Atlassian Confluence 5.0.3, Team Collaboration Software