Hi, this is not really official so its done when its done, but last friday
I have started to pick up my work regarding the
reimplementation of jsf.js for myfaces in typescript which I started a
while ago but put on hiatus due to more pressing issues.

The problem was, our old codebase is now around 10 years old.
I already de-junked some parts of it by removing the code for old browsers,
with IE11 being our main baseline.
But a lot has changed in those 10 years. In other words the code still is
outdated and ugly so time for a change.
What has changed  in the last 10 years?

First of all typescript, which is really a nice language and compiles into
various variants of ecmascript

Secondly the build system, node and webpack are a perfect combination which
remove a load of work

Third frameworks and browsers. Given that jsf.js is a library I dont have
the luxury of being able
to use third party libs like jquery, but fortunately many constructs are
either baked in into IE11+ variants
of browsers already or can be minimally shimmed without having to pull node
dependencies in.

The idea was to basically have a small set of core libs in the base which
easy the handling of node.querySelectorAll
have something streamlike and also optional, or in other words, reduce code
bloat by going functional
where it makes sence but omit it where it does not make sense at all. I
rely here on another project of mine
which started as tinkering into small functional variantes over core
functionality and a set of shims needed.
I do not want to pull a full dom query engine in given the browsers support
querying anyway.

Fourth: Functional patterns have become mainstream. Face it for things like
querying a dom tree, asynchronouse processing, which we do a lot
or handling deeply nested configurations etc.. functional patterns are
superior. I would not want to apply them over everything
but there are things where it makes absolutely sense to apply them, just
the right tool for the job and the good stuff is the browsers
have already core functionality baked in for many of those tasks.

Fifth testing: Javascript nowadays has a set of really well working and
nice testing frameworks.
So far I use a combination of mocha, sinon and chai and they are powerful
enough that
i can basically use unit testing on micro level aka, really on the method
entry points within the implementations by
dynamically mocking interfaces and objects.

So far I have about 57-58 testcases with about 30% of the entire
implementation covered.

Nothing except the tests is working yet, but I am making good progress:

I am doing this for now on a scratchpad project on github, you can follow
the progress there.
When I am ready I will merge the code into myfaces for the time being as
optional implementation which can
be turned on via a config parameter and once we know that everything is
stable enough we can relegate
the new impl as default (myfaces 3.0 maybe?)

Either way here is a sneak peek:

https://github.com/werpu/jsfs_js_ts/blob/master/src/main/typescript/impl/Impl.ts

and also here is the link to the temporary scratchpad project:

https://github.com/werpu/jsfs_js_ts/

Reply via email to