[Dhis2-devs-core] JSDoc

2014-10-09 Thread Morten Olav Hansen
Hi everyone

Just wanted to tell you about JSDoc [1], its a documentation format for
documenting JavaScript code, I'm already using it in dhis2.period.js, and
it has many benefits.

The most obvious benefit is proper autocompletion and also type handling,
as an example, please consider this:

function hello(a,b,c) {}
hello(1,2,3);

The JS compiler/evaluator have no idea how to interpret the parameters to
this function since JS is not type aware by default. So it will just accept
anything.

Then please consider this:

/**
  * @param {String} a String parameter
  * @param {Number} a number
  * @param {Number} Another number
  */
function hello(a,b,c) {}
hello(1,2,3);

Now the IDE will say that the first argument is wrong, since it expected a
string to be passed, but argument 2 and 3 is correct.

I can only vouch for IntelliJ's handling of this, but I'm going to assume
Eclipse have similar mechanics in place.

For our D2js library, we will be using JSDoc all over the place, which will
make it a lot easier to use within an IDE.

[1] http://usejsdoc.org/

--
Morten
-- 
Mailing list: https://launchpad.net/~dhis2-devs-core
Post to : dhis2-devs-core@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs-core
More help   : https://help.launchpad.net/ListHelp


Re: [Dhis2-devs-core] JSDoc

2014-10-09 Thread Lars Helge Øverland
Tutorial? ;)

On Thu, Oct 9, 2014 at 3:22 PM, Morten Olav Hansen morte...@gmail.com
wrote:

 Hi everyone

 Just wanted to tell you about JSDoc [1], its a documentation format for
 documenting JavaScript code, I'm already using it in dhis2.period.js, and
 it has many benefits.

 The most obvious benefit is proper autocompletion and also type handling,
 as an example, please consider this:

 function hello(a,b,c) {}
 hello(1,2,3);

 The JS compiler/evaluator have no idea how to interpret the parameters to
 this function since JS is not type aware by default. So it will just accept
 anything.

 Then please consider this:

 /**
   * @param {String} a String parameter
   * @param {Number} a number
   * @param {Number} Another number
   */
 function hello(a,b,c) {}
 hello(1,2,3);

 Now the IDE will say that the first argument is wrong, since it expected a
 string to be passed, but argument 2 and 3 is correct.

 I can only vouch for IntelliJ's handling of this, but I'm going to assume
 Eclipse have similar mechanics in place.

 For our D2js library, we will be using JSDoc all over the place, which
 will make it a lot easier to use within an IDE.

 [1] http://usejsdoc.org/

 --
 Morten

 --
 Mailing list: https://launchpad.net/~dhis2-devs-core
 Post to : dhis2-devs-core@lists.launchpad.net
 Unsubscribe : https://launchpad.net/~dhis2-devs-core
 More help   : https://help.launchpad.net/ListHelp


-- 
Mailing list: https://launchpad.net/~dhis2-devs-core
Post to : dhis2-devs-core@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs-core
More help   : https://help.launchpad.net/ListHelp


Re: [Dhis2-devs-core] JSDoc

2014-10-09 Thread Morten Olav Hansen
Adding back dev-core.

Yes, I agree. Honestly, for me.. I care less about about the html output..
we can use whatever. But I use IntelliJ for my web dev (actually all dev),
and using jsdoc helps me *alot*, simple things like type verification /
auto-completion.

--
Morten

On Thu, Oct 9, 2014 at 9:19 PM, Mark Polak mar...@ifi.uio.no wrote:

 Agreed. I believe we should create the core D2JS as a JS library that
 D2.angular.js is build on top of.

 Which would mean that what i now created as d2js would be d2.angular.js
 and “the real d2js” would include more “portable” things that are not
 framework specific but more “services” that you can use which could then be
 exposed to angular though d2.angular.js.

 Note: Still does not mean we can’t use dgeni for normal d2js as well. As
 it is just pretty much a parser for your JSDoc.

 Kind regards,

 Mark Polak
 m...@thedutchies.com
 mar...@ifi.uio.no
 +47 970 36 752

 On 09 Oct 2014, at 16:13, Morten Olav Hansen morte...@gmail.com wrote:

 I'm not convinced we should limit ourselves to AngularJS in D2js. We
 should definetely have d2.anguar.js, but should we only rely on AJS, I'm
 not sure..

 This is why i tried to push a D2js on our last call. I would hate seeing
 us become a AJS shop only, we definitely want to make it nice for AJS
 developers, but it also feels limiting.

 I tried to push this a bit on our Oslo meeting, maybe I didn't push enough
 (disclaimer, I'm a big fan of AngularJS). But as you all know, there will
 always be a next-big-thing in JavaScript, and I feel we might be limiting
 ourselves if we only care about AJS (internally it makes sense, but
 externally..)

 --
 Morten

 On Thu, Oct 9, 2014 at 9:10 PM, Mark Polak mar...@ifi.uio.no wrote:

 Hey Morten and JS people,

 Since we will be building in AngularJS we should be using
 https://github.com/angular/dgeni  it is pretty much an extension for
 JSDoc. I created a repository with the packages as well. Which is available
 through NPM. (Which might be out of sync with the most current version of
 dgeni atm)

 What something like that will result into looks like
 http://markionium.github.io/d2-docs/ (The top menu should work fine but
 the navigation is a bit wonky as Github pages does not support AngularJS
 html5mode as that needs server support (Which might also be a thing we have
 to look at if that would be important for our apps.)

 Anyways as for D2 (https://github.com/Markionium/d2). What it is right
 now is pretty much just a collection of services and directive that i was
 creating while working on apps. A lot of it will need cleaning up and
 refactoring.

 For example the thing we mentioned earlier about the bootstrapping. (I
 will look at that sometime next week hopefully).

 Kind regards,

 Mark Polak
 m...@thedutchies.com
 mar...@ifi.uio.no
 +47 970 36 752

 On 09 Oct 2014, at 15:22, Morten Olav Hansen morte...@gmail.com wrote:

 Hi everyone

 Just wanted to tell you about JSDoc [1], its a documentation format for
 documenting JavaScript code, I'm already using it in dhis2.period.js, and
 it has many benefits.

 The most obvious benefit is proper autocompletion and also type handling,
 as an example, please consider this:

 function hello(a,b,c) {}
 hello(1,2,3);

 The JS compiler/evaluator have no idea how to interpret the parameters to
 this function since JS is not type aware by default. So it will just accept
 anything.

 Then please consider this:

 /**
   * @param {String} a String parameter
   * @param {Number} a number
   * @param {Number} Another number
   */
 function hello(a,b,c) {}
 hello(1,2,3);

 Now the IDE will say that the first argument is wrong, since it expected
 a string to be passed, but argument 2 and 3 is correct.

 I can only vouch for IntelliJ's handling of this, but I'm going to assume
 Eclipse have similar mechanics in place.

 For our D2js library, we will be using JSDoc all over the place, which
 will make it a lot easier to use within an IDE.

 [1] http://usejsdoc.org/

 --
 Morten
  --
 Mailing list: https://launchpad.net/~dhis2-devs-core
 Post to : dhis2-devs-core@lists.launchpad.net
 Unsubscribe : https://launchpad.net/~dhis2-devs-core
 More help   : https://help.launchpad.net/ListHelp





-- 
Mailing list: https://launchpad.net/~dhis2-devs-core
Post to : dhis2-devs-core@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs-core
More help   : https://help.launchpad.net/ListHelp