Sonntag, 21. August 2016

Digging deeper into Oracle JET

Intro

After having my first experience with Oracle JET by creating a default app and deploying it to my smartphone, my plan was to understand why my app is behaving the way it is currently behaving.

To find out about that my plan was to take a look at the used Frameworks and also read something about Javascript Design Patterns and MVVM.


RequireJS

I would recommend taking a look at this framework the first, because it is keeping the whole application together, by defining the load order of the different Javascript libraries and telling which module needs which Javascript libraries. RequireJS is not necessarily needed, but it makes your application more robust. Take the time to learn the way it works and you will love it.

The most accurate question for me was, when should I use define() and when should I use require(). Checkout this stackoverflow, which has a great answer to the question.
http://stackoverflow.com/questions/9507606/when-should-i-use-require-and-when-to-use-define

Answer copied from the Stackoverflow link
The define() function accepts two optional parameters (a string that represent a module ID and an array of required modules) and one required parameter (a factory method).
The return of the factory method MUST return the implementation for your module (in the same way that the Module Pattern does).
The require() function doesn't have to return the implementation of a new module.
Using define() you are asking something like "run the function that I am passing as a parameter and assign whatever returns to the ID that I am passing but, before, check that these dependencies are loaded".
Using require() you are saying something like "the function that I pass has the following dependencies, check that these dependencies are loaded before running it".
The require() function is where you use your defined modules, in order to be sure that the modules are defined, but you are not defining new modules there.


Knockout

This was the next framework I was mostly interested in, because it allows me to do some great data-binding between the view and the viewmodel. Compared to RequireJS, the basic functionality of knockout is very easy to understand.

This page gave me a good documentation on the basics of Knockout. I am sure there is more to know for advanced developers, but for me this was all I needed to understand the generated Oracle JET application.
http://knockoutjs.com/documentation/observables.html


Other frameworks

I didn't take a closer look at the other frameworks used by Oracle JET, which are jQuery, jQueryUI and Hammer. The reason for this is, because I already had experience with jQuery and I didn't need Hammer, because I didn't plan to allow any gestures in the first version of my application.

Javascript Design Patterns

Since I had the feeling, that the Javscript development has been enhancing in the last couple years I wanted to catch up a little bit here. There is a lot of interesting literature out there. I can recommend the following link.
https://addyosmani.com/resources/essentialjsdesignpatterns/book/#modulepatternjavascript


Conclusion

I have to say, that I have been doing a lot of research and I start feeling more comfortable with Oracle JET. I didn't expect this when I was taking a look at the generated Oracle JET application the first time, but I start understanding, what most of the files are doing.

It's time to start the development of Tekki Duell with Oracle JET.

Keine Kommentare:

Kommentar veröffentlichen