[forge-issues] [JBoss JIRA] (FORGE-1271) Adding code conventions to scaffolded code

Antonio Goncalves (JIRA) issues at jboss.org
Thu Sep 10 16:58:00 EDT 2015


     [ https://issues.jboss.org/browse/FORGE-1271?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Antonio Goncalves updated FORGE-1271:
-------------------------------------
    Fix Version/s:     (was: 2.x Future)


> Adding code conventions to scaffolded code
> ------------------------------------------
>
>                 Key: FORGE-1271
>                 URL: https://issues.jboss.org/browse/FORGE-1271
>             Project: Forge
>          Issue Type: Sub-task
>          Components: Resources, Scaffold
>    Affects Versions: 2.0.0.Alpha14
>            Reporter: Antonio Goncalves
>             Fix For: 3.x Future
>
>
> Discussion on : https://community.jboss.org/message/842429
> Developers look at Forge as the "way to write Java EE code" or if you like "if those guys write code like this, then we should".
> I am digging into some details of the generated code (I am writing a blog about several architectural styles starting with Forge) and I feel coding convention should be homogenized. I know extensions are written by different individuals, but some basic coding conventions should be applied. For example, when you generate a web app with REST and Faces scaffolding, you get some difference : 
> * Faces Backing Bean use query builder (e.g {{getAll}} method is {{entityManager.createQuery(criteria.select(criteria.from(Book.class))).getResultList();}} and 
> * REST Endpoint use dynamic queries (the {{listAll}} method is {{"SELECT DISTINCT b FROM Book b ORDER BY b.id"))}}
> Method names are different and do the same : 
> * JSF : {{getAll}}
> * REST : {{listAll}}
> Attributes
> * {{private EntityManager em;}}
> * {{private EntityManager entityManager;}}  // em would be better
> Or the use of {{this}} keyword (JSF beans use {{this.entityManager}} instead of directly {{em}} in REST)
> And there are several examples like this. If Forge is seen as "the way of writing code" maybe something should be created to get homogenized code. PMD, Checkstyle, human review and so one..... 



--
This message was sent by Atlassian JIRA
(v6.4.11#64026)


More information about the forge-issues mailing list