[jira] [Commented] (OFBIZ-6783) Refactor the start component

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (OFBIZ-6783) Refactor the start component

Nicolas Malin (Jira)

    [ https://issues.apache.org/jira/browse/OFBIZ-6783?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15290599#comment-15290599 ]

Taher Alkhateeb commented on OFBIZ-6783:
----------------------------------------

Hi Jacques,

This code does not look good, you shouldn't put formatting stuff in main. The same is true with StartupException. I suggest to create a prettyPrint function somewhere to take care of this if you want to box it with =====. Otherwise, again we are mixing different levels of abstraction and making it extremely dependent on the device output. This means that if we ever decide to change the formatting of the help screen, then I have to go and change it everywhere you made the modifications to make it look pretty.

Also, I implemented commons-cli so that each command must be called multiple times if it takes multiple arguments. Look at the below examples
Example:         java -jar ofbiz.jar --load-data readers=seed --load-data delegator=default
another example: java -jar ofbiz.jar --test component=base --test suiteName=whatever

So my suggestion is to instead specify in the header or footer of the help menu that you must pass the commands multiple times and remove the ", ie 2 --testlist" which is confusing anyway.

My intention of this refactoring is to make Start.java and espeially main very short and clean. Your modifications for one thing makes the line width 175 characters wide in addition to having something very unimportant like formatting right there in main where the programmer should not be worried with such details.

Sorry for rambling for too long, but it is these small things over long time that made the code as fragile as it is right now. So please consider a pretty printer for your formatting and hide it away from main.

> Refactor the start component
> ----------------------------
>
>                 Key: OFBIZ-6783
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-6783
>             Project: OFBiz
>          Issue Type: Improvement
>          Components: framework
>    Affects Versions: Upcoming Branch
>            Reporter: Taher Alkhateeb
>            Assignee: Taher Alkhateeb
>              Labels: framework, main, refactoring, start
>         Attachments: OFBIZ-6783.patch, OFBIZ-6783.patch, OFBIZ-6783.patch, OFBIZ-6783.patch, OFBIZ-6783.patch, OFBIZ-6783.patch, OFBIZ-6783.patch, OFBIZ-6783.patch, OFBIZ-6783.patch, StartCommandUtil.java
>
>
> Looking at the main method and design of Start.java and the start component overall looks ugly. The things I would like to fix so far are:
> - the files are too long
> - some variables are not even needed (loaderArgs?)
> - the level of abstraction is wrong
> - main throws an exception!
> - the arguments processing logic is terrible, need to move it to commons-cli
> It's just so messy and ugly to look at. So for me refactoring starts at Start! Given that this is an important component, I will provide a patch to be reviewed by the community before committing just to be on the safe side.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)