Changes for page Best Practices

Last modified by Vincent Massol on 2017/09/05

<
From version < 5.2 >
edited by Eduard Moraru
on 2012/05/24
To version < 7.1 >
edited by Vincent Massol
on 2014/01/05
>
Change comment: There is no comment for this version

Summary

Details

Page properties
Author
... ... @@ -1,1 +1,1 @@
1 -XWiki.enygma
1 +XWiki.VincentMassol
Content
... ... @@ -1,8 +1,20 @@
1 +{{box cssClass="floatinginfobox" title="**Contents**"}}
1 1  {{toc/}}
3 +{{/box}}
2 2  
5 += Where to put code? =
6 +
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 +
9 +* 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.
10 +* In general put the minimum amount of scripts in your wiki pages since that makes it harder to maintain.
11 +* The only scripts that you may put in wiki pages are "presentation logic" code.
12 +
13 +Said differently you should use the [[MVC>>http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller]] approach by separating your Model (what we called "business logic" above) from your View (what we called "presentation logic" above).
14 +
3 3  = XWiki Application Organization =
4 4  
5 -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]].
6 6  
7 7  = Check for Object existence in Class Sheets documents =
8 8  
... ... @@ -20,7 +20,7 @@
20 20  {{/code}}
21 21  
22 22  {{info}}
23 -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.
24 24  {{/info}}
25 25  
26 26  = Handling errors when using xredirect for non-Javascript UIs =

Get Connected