You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@freemarker.apache.org by Siegfried Goeschl <si...@gmail.com> on 2020/07/08 05:41:52 UTC

[freemarker-cli] Naming of Tools and DataSources in FreeMarker Data Model

HI folks,

I'm using now a map for the tools, e.g.

FreeMarker CLI Tools
------------------------------------------------------------------------------
<#list tools?keys?sort as name>
- ${name?right_pad(20)} : ${tools[name]}
</#list>

FreeMarker CLI Tools
------------------------------------------------------------------------------
- csv                  : Process CSV files using Apache Commons CSV (see https://commons.apache.org/proper/commons-csv/)
- dataframe            : Bridge to [nRo/DataFrame](https://github.com/nRo/DataFrame)
- excel                : Process Excels files (XLS, XLSX) using Apache POI (see https://poi.apache.org)
- exec                 : Execute command line tools using Apache Commons Exec (see https://commons.apache.org/proper/commons-exec/)
- freemarker           : Expose advanced Apache FreeMarker classes
- grok                 : Process text files using Grok expressions (see https://github.com/thekrakken/java-grok)
- gson                 : Process JSON files using GSON (see https://github.com/google/gson)
- jsonpath             : Process JSON files using Java JSON Path (see https://github.com/json-path/JsonPath)
- jsoup                : Process  HTML files using Jsoup (see https://jsoup.org)
- properties           : Process JDK properties files
- system               : Expose System-related utility methods
- uuid                 : Create UUIDs
- xml                  : Process XML files using Apache FreeMarker (see https://freemarker.apache.org/docs/xgui.html)
- yaml                 : Process YAML files using SnakeYAML(see https://bitbucket.org/asomov/snakeyaml/wiki/Home)


And also renamed "DataSources" to "dataSources"

FreeMarker CLI DataSources
------------------------------------------------------------------------------
<#list dataSources.list as dataSource>
[#${dataSource?counter}]: name=${dataSource.name}, group=${dataSource.group}, mimeType=${dataSource.mimetype}, charset=${dataSource.charset}, length=${dataSource.length} Bytes
URI : ${dataSource.uri}
</#list>
FreeMarker CLI DataSources
------------------------------------------------------------------------------
[#1]: name=github-users.json, group=default, mimeType=application/json, charset=UTF-8, length=7,168 Bytes
URI : file:/Users/sgoeschl/work/github/apache/freemarker-generator/freemarker-generator-cli/examples/data/json/github-users.json
[#2]: name=contract.csv, group=default, mimeType=text/csv, charset=UTF-8, length=6,328 Bytes
URI : file:/Users/sgoeschl/work/github/apache/freemarker-generator/freemarker-generator-cli/examples/data/csv/contract.csv
[#3]: name=foo, group=bar, mimeType=text/csv, charset=UTF-8, length=6,328 Bytes
URI : file:/Users/sgoeschl/work/github/apache/freemarker-generator/freemarker-generator-cli/examples/data/csv/contract.csv

Shall we stick to the "dataSources" or rename to "datasources"? I hate this camel-case but would to like to settle my doubts

Thanks in advance, 

Siegfried Goeschl


Re: [freemarker-cli] Naming of Tools and DataSources in FreeMarker Data Model

Posted by Daniel Dekany <da...@gmail.com>.
Of course we should use the same convention everywhere. Choosing the sane
variant of camel case (i.e., yaml, and not YAML) is a pretty obvious choice.
Also, it's freemarker in that convention, not freeMarker, since it's one
word. (Yeah, it's quite a bad product name for a few reasons... but we
can't change history.)

On Wed, Jul 8, 2020 at 7:41 PM Siegfried Goeschl <
siegfried.goeschl@gmail.com> wrote:

> Hi Daniel,
>
> Aligned the naming but for the tools it is probably over the top ...
>
> We currently have
>
> - csv
> - dataframe
> - excel
> - exec
> - freemarker
> - grok
> - gson
> - jsonpath
> - jsoup
> - properties
> - system
> - uuid
> - xml
> - yaml
>
> Which would change to
>
> - csv
> - dataFrame
> - excel
> - exec
> - freeMarker
> - grok
> - gson
> - jsonPath
> - jsoup
> - properties
> - system
> - uuid
> - xml
> - yaml
>
> or
>
> - CSV
> - dataFrame
> - excel
> - exec
> - freeMarker
> - grok
> - gson
> - jsonPath
> - jsoup
> - properties
> - system
> - UUID
> - XML
> - YAML
>
> Thanks in advance,
>
> Siegfried Goeschl
>
>
>
> > On 08.07.2020, at 10:44, Daniel Dekany <da...@gmail.com> wrote:
> >
> > As in plain English it's rather "data source" than "datasource", thus the
> > variable name should stay "dataSource". Whether one aesthetically likes
> it
> > or not, that's the convention in Java circles. For same reason it should
> be
> > tools.dataFrame (instead of tools.dataframe), and dataSource.mimeType
> > (instead of dataSource.mimetype). (Actually, if we follow the incorrect
> > variant of camel case that Java officially uses, then it's
> > dataSource.MIMEType, but that's too much even for me... :) and most
> > importantly, people use both the official and correct camel case with
> Java
> > API-s, so it won't surprise.)
> >
> > BTW, for some reason I don't know, traditionally, FTL uses snake-case
> (like
> > s?upper_case), and then some all-lower-case (like <#elseif x>). So that's
> > unfortunate, as the variables it will see, and the Java API-s templates
> > call, certainly use camel case. But for a good while, you can also opt
> for
> > camel case in FTL, and write things like s?upperCase, <#elseIf x>, etc.
> No
> > configuration needed, and it's enforced that the whole template uses the
> > same convention consistently, for the FTL parts.
> >
> >
> > On Wed, Jul 8, 2020 at 7:42 AM Siegfried Goeschl <
> > siegfried.goeschl@gmail.com> wrote:
> >
> >> HI folks,
> >>
> >> I'm using now a map for the tools, e.g.
> >>
> >> FreeMarker CLI Tools
> >>
> >>
> ------------------------------------------------------------------------------
> >> <#list tools?keys?sort as name>
> >> - ${name?right_pad(20)} : ${tools[name]}
> >> </#list>
> >>
> >> FreeMarker CLI Tools
> >>
> >>
> ------------------------------------------------------------------------------
> >> - csv                  : Process CSV files using Apache Commons CSV (see
> >> https://commons.apache.org/proper/commons-csv/)
> >> - dataframe            : Bridge to [nRo/DataFrame](
> >> https://github.com/nRo/DataFrame)
> >> - excel                : Process Excels files (XLS, XLSX) using Apache
> POI
> >> (see https://poi.apache.org)
> >> - exec                 : Execute command line tools using Apache Commons
> >> Exec (see https://commons.apache.org/proper/commons-exec/)
> >> - freemarker           : Expose advanced Apache FreeMarker classes
> >> - grok                 : Process text files using Grok expressions (see
> >> https://github.com/thekrakken/java-grok)
> >> - gson                 : Process JSON files using GSON (see
> >> https://github.com/google/gson)
> >> - jsonpath             : Process JSON files using Java JSON Path (see
> >> https://github.com/json-path/JsonPath)
> >> - jsoup                : Process  HTML files using Jsoup (see
> >> https://jsoup.org)
> >> - properties           : Process JDK properties files
> >> - system               : Expose System-related utility methods
> >> - uuid                 : Create UUIDs
> >> - xml                  : Process XML files using Apache FreeMarker (see
> >> https://freemarker.apache.org/docs/xgui.html)
> >> - yaml                 : Process YAML files using SnakeYAML(see
> >> https://bitbucket.org/asomov/snakeyaml/wiki/Home)
> >>
> >>
> >> And also renamed "DataSources" to "dataSources"
> >>
> >> FreeMarker CLI DataSources
> >>
> >>
> ------------------------------------------------------------------------------
> >> <#list dataSources.list as dataSource>
> >> [#${dataSource?counter}]: name=${dataSource.name},
> >> group=${dataSource.group}, mimeType=${dataSource.mimetype},
> >> charset=${dataSource.charset}, length=${dataSource.length} Bytes
> >> URI : ${dataSource.uri}
> >> </#list>
> >> FreeMarker CLI DataSources
> >>
> >>
> ------------------------------------------------------------------------------
> >> [#1]: name=github-users.json, group=default, mimeType=application/json,
> >> charset=UTF-8, length=7,168 Bytes
> >> URI :
> >>
> file:/Users/sgoeschl/work/github/apache/freemarker-generator/freemarker-generator-cli/examples/data/json/github-users.json
> >> [#2]: name=contract.csv, group=default, mimeType=text/csv,
> charset=UTF-8,
> >> length=6,328 Bytes
> >> URI :
> >>
> file:/Users/sgoeschl/work/github/apache/freemarker-generator/freemarker-generator-cli/examples/data/csv/contract.csv
> >> [#3]: name=foo, group=bar, mimeType=text/csv, charset=UTF-8,
> length=6,328
> >> Bytes
> >> URI :
> >>
> file:/Users/sgoeschl/work/github/apache/freemarker-generator/freemarker-generator-cli/examples/data/csv/contract.csv
> >>
> >> Shall we stick to the "dataSources" or rename to "datasources"? I hate
> >> this camel-case but would to like to settle my doubts
> >>
> >> Thanks in advance,
> >>
> >> Siegfried Goeschl
> >>
> >>
> >
> > --
> > Best regards,
> > Daniel Dekany
>
>

-- 
Best regards,
Daniel Dekany

Re: [freemarker-cli] Naming of Tools and DataSources in FreeMarker Data Model

Posted by Siegfried Goeschl <si...@gmail.com>.
Hi Daniel,

Aligned the naming but for the tools it is probably over the top ...

We currently have

- csv       
- dataframe 
- excel     
- exec      
- freemarker
- grok      
- gson      
- jsonpath  
- jsoup     
- properties
- system    
- uuid      
- xml       
- yaml 

Which would change to

- csv       
- dataFrame 
- excel     
- exec      
- freeMarker
- grok      
- gson      
- jsonPath  
- jsoup     
- properties
- system    
- uuid
- xml      
- yaml

or

- CSV       
- dataFrame 
- excel     
- exec      
- freeMarker
- grok      
- gson      
- jsonPath  
- jsoup     
- properties
- system    
- UUID
- XML      
- YAML

Thanks in advance, 

Siegfried Goeschl



> On 08.07.2020, at 10:44, Daniel Dekany <da...@gmail.com> wrote:
> 
> As in plain English it's rather "data source" than "datasource", thus the
> variable name should stay "dataSource". Whether one aesthetically likes it
> or not, that's the convention in Java circles. For same reason it should be
> tools.dataFrame (instead of tools.dataframe), and dataSource.mimeType
> (instead of dataSource.mimetype). (Actually, if we follow the incorrect
> variant of camel case that Java officially uses, then it's
> dataSource.MIMEType, but that's too much even for me... :) and most
> importantly, people use both the official and correct camel case with Java
> API-s, so it won't surprise.)
> 
> BTW, for some reason I don't know, traditionally, FTL uses snake-case (like
> s?upper_case), and then some all-lower-case (like <#elseif x>). So that's
> unfortunate, as the variables it will see, and the Java API-s templates
> call, certainly use camel case. But for a good while, you can also opt for
> camel case in FTL, and write things like s?upperCase, <#elseIf x>, etc. No
> configuration needed, and it's enforced that the whole template uses the
> same convention consistently, for the FTL parts.
> 
> 
> On Wed, Jul 8, 2020 at 7:42 AM Siegfried Goeschl <
> siegfried.goeschl@gmail.com> wrote:
> 
>> HI folks,
>> 
>> I'm using now a map for the tools, e.g.
>> 
>> FreeMarker CLI Tools
>> 
>> ------------------------------------------------------------------------------
>> <#list tools?keys?sort as name>
>> - ${name?right_pad(20)} : ${tools[name]}
>> </#list>
>> 
>> FreeMarker CLI Tools
>> 
>> ------------------------------------------------------------------------------
>> - csv                  : Process CSV files using Apache Commons CSV (see
>> https://commons.apache.org/proper/commons-csv/)
>> - dataframe            : Bridge to [nRo/DataFrame](
>> https://github.com/nRo/DataFrame)
>> - excel                : Process Excels files (XLS, XLSX) using Apache POI
>> (see https://poi.apache.org)
>> - exec                 : Execute command line tools using Apache Commons
>> Exec (see https://commons.apache.org/proper/commons-exec/)
>> - freemarker           : Expose advanced Apache FreeMarker classes
>> - grok                 : Process text files using Grok expressions (see
>> https://github.com/thekrakken/java-grok)
>> - gson                 : Process JSON files using GSON (see
>> https://github.com/google/gson)
>> - jsonpath             : Process JSON files using Java JSON Path (see
>> https://github.com/json-path/JsonPath)
>> - jsoup                : Process  HTML files using Jsoup (see
>> https://jsoup.org)
>> - properties           : Process JDK properties files
>> - system               : Expose System-related utility methods
>> - uuid                 : Create UUIDs
>> - xml                  : Process XML files using Apache FreeMarker (see
>> https://freemarker.apache.org/docs/xgui.html)
>> - yaml                 : Process YAML files using SnakeYAML(see
>> https://bitbucket.org/asomov/snakeyaml/wiki/Home)
>> 
>> 
>> And also renamed "DataSources" to "dataSources"
>> 
>> FreeMarker CLI DataSources
>> 
>> ------------------------------------------------------------------------------
>> <#list dataSources.list as dataSource>
>> [#${dataSource?counter}]: name=${dataSource.name},
>> group=${dataSource.group}, mimeType=${dataSource.mimetype},
>> charset=${dataSource.charset}, length=${dataSource.length} Bytes
>> URI : ${dataSource.uri}
>> </#list>
>> FreeMarker CLI DataSources
>> 
>> ------------------------------------------------------------------------------
>> [#1]: name=github-users.json, group=default, mimeType=application/json,
>> charset=UTF-8, length=7,168 Bytes
>> URI :
>> file:/Users/sgoeschl/work/github/apache/freemarker-generator/freemarker-generator-cli/examples/data/json/github-users.json
>> [#2]: name=contract.csv, group=default, mimeType=text/csv, charset=UTF-8,
>> length=6,328 Bytes
>> URI :
>> file:/Users/sgoeschl/work/github/apache/freemarker-generator/freemarker-generator-cli/examples/data/csv/contract.csv
>> [#3]: name=foo, group=bar, mimeType=text/csv, charset=UTF-8, length=6,328
>> Bytes
>> URI :
>> file:/Users/sgoeschl/work/github/apache/freemarker-generator/freemarker-generator-cli/examples/data/csv/contract.csv
>> 
>> Shall we stick to the "dataSources" or rename to "datasources"? I hate
>> this camel-case but would to like to settle my doubts
>> 
>> Thanks in advance,
>> 
>> Siegfried Goeschl
>> 
>> 
> 
> -- 
> Best regards,
> Daniel Dekany


Re: [freemarker-cli] Naming of Tools and DataSources in FreeMarker Data Model

Posted by Daniel Dekany <da...@gmail.com>.
As in plain English it's rather "data source" than "datasource", thus the
variable name should stay "dataSource". Whether one aesthetically likes it
or not, that's the convention in Java circles. For same reason it should be
tools.dataFrame (instead of tools.dataframe), and dataSource.mimeType
(instead of dataSource.mimetype). (Actually, if we follow the incorrect
variant of camel case that Java officially uses, then it's
dataSource.MIMEType, but that's too much even for me... :) and most
importantly, people use both the official and correct camel case with Java
API-s, so it won't surprise.)

BTW, for some reason I don't know, traditionally, FTL uses snake-case (like
s?upper_case), and then some all-lower-case (like <#elseif x>). So that's
unfortunate, as the variables it will see, and the Java API-s templates
call, certainly use camel case. But for a good while, you can also opt for
camel case in FTL, and write things like s?upperCase, <#elseIf x>, etc. No
configuration needed, and it's enforced that the whole template uses the
same convention consistently, for the FTL parts.


On Wed, Jul 8, 2020 at 7:42 AM Siegfried Goeschl <
siegfried.goeschl@gmail.com> wrote:

> HI folks,
>
> I'm using now a map for the tools, e.g.
>
> FreeMarker CLI Tools
>
> ------------------------------------------------------------------------------
> <#list tools?keys?sort as name>
> - ${name?right_pad(20)} : ${tools[name]}
> </#list>
>
> FreeMarker CLI Tools
>
> ------------------------------------------------------------------------------
> - csv                  : Process CSV files using Apache Commons CSV (see
> https://commons.apache.org/proper/commons-csv/)
> - dataframe            : Bridge to [nRo/DataFrame](
> https://github.com/nRo/DataFrame)
> - excel                : Process Excels files (XLS, XLSX) using Apache POI
> (see https://poi.apache.org)
> - exec                 : Execute command line tools using Apache Commons
> Exec (see https://commons.apache.org/proper/commons-exec/)
> - freemarker           : Expose advanced Apache FreeMarker classes
> - grok                 : Process text files using Grok expressions (see
> https://github.com/thekrakken/java-grok)
> - gson                 : Process JSON files using GSON (see
> https://github.com/google/gson)
> - jsonpath             : Process JSON files using Java JSON Path (see
> https://github.com/json-path/JsonPath)
> - jsoup                : Process  HTML files using Jsoup (see
> https://jsoup.org)
> - properties           : Process JDK properties files
> - system               : Expose System-related utility methods
> - uuid                 : Create UUIDs
> - xml                  : Process XML files using Apache FreeMarker (see
> https://freemarker.apache.org/docs/xgui.html)
> - yaml                 : Process YAML files using SnakeYAML(see
> https://bitbucket.org/asomov/snakeyaml/wiki/Home)
>
>
> And also renamed "DataSources" to "dataSources"
>
> FreeMarker CLI DataSources
>
> ------------------------------------------------------------------------------
> <#list dataSources.list as dataSource>
> [#${dataSource?counter}]: name=${dataSource.name},
> group=${dataSource.group}, mimeType=${dataSource.mimetype},
> charset=${dataSource.charset}, length=${dataSource.length} Bytes
> URI : ${dataSource.uri}
> </#list>
> FreeMarker CLI DataSources
>
> ------------------------------------------------------------------------------
> [#1]: name=github-users.json, group=default, mimeType=application/json,
> charset=UTF-8, length=7,168 Bytes
> URI :
> file:/Users/sgoeschl/work/github/apache/freemarker-generator/freemarker-generator-cli/examples/data/json/github-users.json
> [#2]: name=contract.csv, group=default, mimeType=text/csv, charset=UTF-8,
> length=6,328 Bytes
> URI :
> file:/Users/sgoeschl/work/github/apache/freemarker-generator/freemarker-generator-cli/examples/data/csv/contract.csv
> [#3]: name=foo, group=bar, mimeType=text/csv, charset=UTF-8, length=6,328
> Bytes
> URI :
> file:/Users/sgoeschl/work/github/apache/freemarker-generator/freemarker-generator-cli/examples/data/csv/contract.csv
>
> Shall we stick to the "dataSources" or rename to "datasources"? I hate
> this camel-case but would to like to settle my doubts
>
> Thanks in advance,
>
> Siegfried Goeschl
>
>

-- 
Best regards,
Daniel Dekany