While there are several ways to do this, I would prefer (and suggest) something a little more tangible than standardizing by convention (i.e. what is generated by Forge). It would be good to highlight the coding convention in a separate (maven) project, presumably residing inside the reactor.

I would suggest something like:

<dependency>
    <groupId>se.jguru.nazgul.tools.codestyle</groupId>
    <artifactId>nazgul-codestyle</artifactId>
    <version>2.0.9</version>
</dependency>

This will - in turn - be used by all plugins defined in the reactor parent pom, and by IDEs integrating in Forge. Also, the codestyle would be useable for other developers in other projects. In my opinion, this is a matter of usability for developers wanting to use Forge properly, as well as developers working on the Forge codebase itself. Currently, one is more or less required to use Eclipse to have some notion of getting a codestyle which is similar or identical to the style used by the other Forge developers.
So ... long story made short. I would suggest formalizing the codestyle - for use in generated code, for use within the Forge reactor and for simple inclusion in other reactors as well.
2013/10/21 Lincoln Baxter, III <lincolnbaxter@gmail.com>
Hey Antonio!

You are absolutely correct. We really need to standardize (and improve in general) most of the code that Forge generates. Really it works, but I think that we can do much better to set a good example.

These are good issues to track :)

~Lincoln


On Sun, Oct 20, 2013 at 10:29 PM, George Gastaldi <ggastald@redhat.com> wrote:
Hi Antonio!

Thanks for your feedback! We'll consider your suggestions for the Forge 2 REST code generation and the scaffold. In the meanwhile could you file a JIRA feature request so we don't lose track of this?

Thank you very much!

George Gastaldi

Em 20/10/2013, às 14:51, Antonio Goncalves <antonio.mailing@gmail.com> escreveu:

Hi all,

I love Forge because it generates code. And that's why my customers start to love it too. Basically, they 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 list all 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..... 

Just wondering....


--
Antonio Goncalves 
Software architect and Java Champion

Web site | Twitter | LinkedIn | Paris JUG | Devoxx France
_______________________________________________
forge-dev mailing list
forge-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/forge-dev

_______________________________________________
forge-dev mailing list
forge-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/forge-dev



--
Lincoln Baxter, III
http://ocpsoft.org
"Simpler is better."

_______________________________________________
forge-dev mailing list
forge-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/forge-dev



--
--
+==============================+
| Bästa hälsningar,
| [sw. "Best regards"]
|
| Lennart Jörelid
| EAI Architect & Integrator
|
| jGuru Europe AB
| Mölnlycke - Kista
|
| Email: lj@jguru.se
| URL:   www.jguru.se
| Phone
| (skype):    jgurueurope
| (intl):     +46 708 507 603
| (domestic): 0708 - 507 603
+==============================+