Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "E4/Search Console/Coding Guidelines"

m
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
=== General coding guidelines in Search Console<br> ===
+
=== Productive code ===
  
==== Productive code  ====
+
*There must be clear separation between business and user interface logic. The search console makes use of the [http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93presenter Model-view-presenter pattern] where the user interface is a passive component managed by a controller.The following sequence diagram demonstrates an example interaction
  
*There must be clear separation between business and user interface logic. The search console makes use of the [http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93presenter Model-view-presenter pattern] where the user interface is a passive component managed by a controller.
+
[[Image:SearchConsoleMVP.png]]
*Good coding practices must be followed:  
+
 
*[http://en.wikipedia.org/wiki/Solid_%28object-oriented_design%29 SOLID ]principles
+
*Good coding practices must be followed:
 +
 
 +
:*[http://en.wikipedia.org/wiki/Solid_%28object-oriented_design%29 SOLID] principles
  
 
:*Code duplication is avoided ([http://en.wikipedia.org/wiki/Don%27t_repeat_yourself DRY principle])
 
:*Code duplication is avoided ([http://en.wikipedia.org/wiki/Don%27t_repeat_yourself DRY principle])
Line 20: Line 22:
 
*Test driven development is the preferred implementation style
 
*Test driven development is the preferred implementation style
  
==== Test code<br>  ====
+
=== Test code<br>  ===
  
 
*All tests must be automated  
 
*All tests must be automated  
Line 28: Line 30:
  
 
:*Use SwtBot to simulate user interaction  
 
:*Use SwtBot to simulate user interaction  
:*Make use of the [http://code.google.com/p/selenium/wiki/PageObjects page object paradigm] in order to isolate test implementation from the UI test framework (SwtBot). See package org.eclipse.platform.discovery.ui.test.comp.internal.pageobjects for examples of page objects  
+
:*Make use of the [http://code.google.com/p/selenium/wiki/PageObjects page object paradigm] in order to isolate test implementation from the UI test framework (SwtBot). See package ''org.eclipse.platform.discovery.ui.test.comp.internal.pageobjects'' for examples of page objects  
 
:*Use a dedicated test shell to embed the user interface under test
 
:*Use a dedicated test shell to embed the user interface under test
  
 
*Productive code guidelines have to be kept for test code as well<br><br>
 
*Productive code guidelines have to be kept for test code as well<br><br>

Latest revision as of 08:47, 26 January 2012

Productive code

  • There must be clear separation between business and user interface logic. The search console makes use of the Model-view-presenter pattern where the user interface is a passive component managed by a controller.The following sequence diagram demonstrates an example interaction

SearchConsoleMVP.png

  • Good coding practices must be followed:
  • Names of methods, classes and interfaces describe the intended behavior; code is self-documented and readable
  • Classes are recommended to communicate with each other via interfaces. This results in loose coupling and makes testing easier
  • Javadoc for public API is mandatory
  • Each feature must be complemented by automated tests which provide code coverage of above 70% (the more, the better)
  • Test driven development is the preferred implementation style

Test code

  • All tests must be automated
  • Tests are isolated (prefer unit tests over integration tests)
  • Mocking frameworks are used when implementing tests. Existing tests use Jmock 1.2, EasyMock, Mockito (all available in Orbit). Having experience with all these three frameworks, we recommend Mockito
  • User interface tests
  • Use SwtBot to simulate user interaction
  • Make use of the page object paradigm in order to isolate test implementation from the UI test framework (SwtBot). See package org.eclipse.platform.discovery.ui.test.comp.internal.pageobjects for examples of page objects
  • Use a dedicated test shell to embed the user interface under test
  • Productive code guidelines have to be kept for test code as well

Back to the top