#1357 Fan source files location (Tales / Convention)

tcolar Tue 7 Dec 2010

In my Netbeans plugin I currently assume Fantom sources will be in the "fan" folder (or subfolders) ... this seem to be the way it is for all Fantom sources anyway.

In Tales some sources are in the Fantom folder but there are also some in other folders (ie: model)

Now I think probably I should make a project properties panel where you can pick multiple source folders (configurable) as done for Java projects.

But I was wondering whether having all Fantom sources in the "fan" folder was a convention or not (I always assumed that by convention Fantom sources go in "fan", JavaScript in "jscript" and so on).

Is that a convention or not ?

If it is, then maybe Tales models should be in project/fan/model/ rather than project/model

brian Tue 7 Dec 2010

Yes the convention is all Fantom files go under "fan/" and all tests (also Fantom files) go under "test/".

See Compilation Units:

podxyz/
  +- fan/       // ".fan" source files
  +- java/      // ".java" Java native peers
  +- js/        // ".js" JavaScript native peers
  +- dotnet/    // ".cs" C# native peers
  +- res/       // resources to bundle with pod
  +- locale/    // localization files
  +- test/      // ".fan" unit tests
  +- build.fan  // build script for pod
  +- pod.fandoc // pod level documentation

So I would suggest using "fan/model/" as the directory

kaushik Wed 8 Dec 2010

Alirght,

I will change tales default folder structure like this

fan/
	api/
	app/
	conf/
	model/
	sql/
html/
res/
test/

Make sense because Tales production mode is just a pod running by itself. Wondering if we need to put "html/" inside "res/". Whatever in "html/" is a type of resource to bundle with pod however isn't public. Currently the convention is to make whatever put in "res/" public-downloadable from server. May be we need to create "/res/public" and "/res/html". What's your suggestion?

tcolar Wed 8 Dec 2010

Thanks Kaushik ,sorry for the change.

qualidafial Wed 8 Dec 2010

Kaushik, I've been taking a look at tales and it's really impressive.

I'd say the html folder is distinct because it (usually) consists of templates that get transformed by the corresponding class in fan/app/, whereas the files in /res/ are served up as is.

kaushik Wed 8 Dec 2010

@tcolar, No problem! What's your suggestion on putting "html/" folder inside "res/" or just as a top level directory? Or does it not make a difference from IDE perspective?

kaushik Wed 8 Dec 2010

@qualidafial thanks!. True. We can keep html folder top level. @tcolar, you're ok with that?

brian Wed 8 Dec 2010

I do think we should stick with conventions on "fan/". On the resources I don't think sticking things under "res/" consistently is that big a deal since it exposes itself in the fan: URIs. For example in icons we didn't use that convention. With a framework like Tales it may make more sense to have its own resources conventions is that works its way into the web framework's URI structure.

kaushik Thu 9 Dec 2010

Changed this. I am actually beginning to like the change. anything in fan/ is for developers and anything in html/ and res/ is shared with designers.

Thanks.

tcolar Thu 9 Dec 2010

Cool, thanks.

florin Thu 9 Dec 2010

kaushik, tcolar,

Thanks for the hard work on tales support.

rajmahendra Thu 30 Dec 2010

Maybe, i am again giving a new suggestion.. :)

why not we adopt Maven style of structure

my-app |-- src

|-- main
|   |-- java
|   |   (all java files)
|   `-- fan
|   |   (all java files)
|   `-- conf
|   |
|   `-- model
|   |
|   etc.....
|   
|   
`-- test
    `-- java
    |
    `-- fan

something like this.. http://maven.apache.org/guides/introduction/introduction-to-the-standard-directory-layout.html

Login or Signup to reply.