# Changes for page Best Practices

<
From version
edited by Vincent Massol
on 2012/11/17
To version
edited by Vincent Massol
on 2014/01/05
>
Change comment: There is no comment for this version

## Details

Page properties
Content
 ... ... @@ -1,7 +1,11 @@ 1 +{{box cssClass="floatinginfobox" title="**Contents**"}} 1 1 {{toc/}} 3 +{{/box}} 4 + 2 2 = Where to put code? = 3 3 4 -Since xwiki allows to put code both in wiki pages and in Java you might wonder where you should put your code. Here's some general guidelines: 7 +Since xwiki allows you to put code both in wiki pages and in Java you might wonder where you should put your code. Here are some general guidelines: 8 + 5 5 * Don't put "business logic" code in wiki pages. Use Java for that. This gives you nice IDEs, the ability to easily debug the code and the ability to write automated unit tests. Generally speaking it makes it easy on maintenance. 6 6 * In general put the minimum amount of scripts in your wiki pages since that makes it harder to maintain. 7 7 * The only scripts that you may put in wiki pages are "presentation logic" code. ... ... @@ -10,7 +10,7 @@ 10 10 11 11 = XWiki Application Organization = 12 12 13 -This [[Best Practices document>>Best Practices XWiki Application Organization]] explains how to best organize an XWiki Application. 17 +Check the [[Application Development Best Practices document>>ApplicationDevelopmentBestPractices]]. 14 14 15 15 = Check for Object existence in Class Sheets documents = 16 16 ... ... @@ -28,7 +28,7 @@ 28 28 {{/code}} 29 29 30 30 {{info}} 31 -The 'if' tests first for the non existence. This is so that XWiki extract the title from the //1 User Sheet//, which is a proper title to display when viewsing the sheet page, instead of the computed name which will usually display something wrong. 35 +The 'if' tests first for the non existence. This is so that XWiki can extract the title from the //1 User Sheet//, which is a proper title to display when viewsing the sheet page, instead of the computed name which will usually display something wrong. 32 32 {{/info}} 33 33 34 34 = Handling errors when using xredirect for non-Javascript UIs =