Hey Folks!
For those of you wanting to know what's happening with Nitrogen 3.0, here are the latest developments. Some of these I've shared in the Nitrogen Slack Channel (#nitrogen at https://erlef.org/slack-invite/erlef) already, but for those of you that haven't here are the big updates. But first, if you want to experiment with Nitrogen 3 functionality, there is a `rebar3` branch in nitrogen/nitrogen, nitrogen/nitrogen_core, and nitrogen/NitrogenProject.com.
Build Process
The biggest and most fundamental part of Nitrogen 3 is the upgrade to rebar3 as the official build tool (as you may have inferred from the branch name). The process right now is almost the same, except I'm putting more emphasis on using `make` instead of relying on non-standard modifications to rebar-generated scripts (as Nitrogen 2.0 originally did).
Creating a new project from the nitrogen directory now can be as simple as `make build` - this is a new terminal-based menu for creating a project. You can still do things like `make slim_yaws PROJECT=my_awesome_app` but `make build` eliminates the need to remember the arcana.
This rework has also simplified the deployment and upgrade processes. For example, starting a production-ready release is now:
`make run_release`
Then when changes have been done to the codebase or dependencies, you can run:
`make upgrade_release`
That upgrade_release will generate all the release upgrade (relup) files, do all the work of deploying and performing a hot-upgrade.
And it has all the benefits of using rebar3: following a standard Erlang application structure, getting relx built in (over reltool, which is far trickier to get right), and being able to rely on hex.pm for packages. This build process has simplified building an environment on Windows as well, as a little perk.
Vessels
New Session Handler
Nitrogen 3 will now, by default, use a new session handler based on a new application called Canister (https://github.com/nitrogen/canister). Canister is an mnesia-based distributed session server that aims for "eventually consistent." All copies of data exist in all nodes in the cluster, and the session info being in mnesia ensures durability after a node or cluster restart. This represents a big improvement over the Nitrogen 2 default simple_session_handler, as session info didn't survive a node restart, and could lead to some pretty serious split-brain problems if data ended up on two different nodes in the cluster. You can see the new handler here: https://github.com/nitrogen/nitrogen_core/blob/rebar3/src/handlers/session/canister_session_handler.erl The original simple_session_handler will remain in the system available to use if you prefer that. Websocket Overloading
Nitrogen 3 is introducing websocket overloading. Basically, this allows you to use the already-established websocket connection in Nitrogen to send and receive messages that aren't just postbacks or postback responses. Along with that is a new websocket handler, which further allows you to deviate from even this already modified websocket behavior.
This functionality can allow for easier implementing of high-message-count applications like games, since those messages won't have the same overhead as the usual postback or "comet" messages.
jQuery
Work has started in attempting to remove jQuery as a core dependency. It's not yet complete, and likely won't be finished for the full Nitrogen 3.0, but still the work has begun and will likely be a slow update.
jQuery Mobile has not yet been removed, but will be removed and split into its own plugin project shortly. So if you do actually still use jQuery mobile, it will still be possible to upgrade to Nitrogen 3. That said, no work is planned beyond that for jQuery Mobile.
Handlers
If you followed in slack, you'd know I was doing some handler-system experiements and reworks. My work there proved fruitless for any real performance improvements. The <1% improvement I saw did not justify the added complexity of the code, so that work has been largely scrapped.
That said, I have a few new handlers planned:
The validation system is slated to be gutted and reworked as a validation system, allowing stripping out liveValidation and replacing with your own custom validation system, if so desire.
A modal handler is planned for dynamically launching a modal window. And a a confirm/prompt handler is planned for making your own popups. This would allow reimplementing popups as either javascript "alert" or javascript "confirm" popups, doing something with bootstrap or other JS library, or implementing your own functionality. I'm undecided on if those will be two different handlers or not. Likely, my plan is to have the "confirm/prompt" handler rely on the "modal" handler for the default setup.
I'm also planning a "notification" handler, which just controls little corner-style popups.
Performance Improvements
While the handler experiment yielded no fruit, I did manage to find some performance improvements elsewhere in the rendering engine, so I consider it a win. For example, I managed to reduce the "reduction" count and total memory used for handling a request and rendering the /downloads page in NitrogenProject.com by about half. Redundant Classes
As many of you would have noticed, Nitrogen 2.x (and maybe even going back to Nitrogen 1), there is a redundancy in the classes of elements. For example: #textbox{} would produce <input type=text class="textbox wfid_temp123123">. That whole "class=textbox" is largely redundant. By default, Nitrogen 3 will no longer have these for the basic elements (compound elements are different). If, however, you have a lot of CSS that relies on these elements, there will be a section in rebar.config that will enable that functionality for you. This should help with integration with CSS and JS libraries where there are terminology conflicts, such as "class=label" having a specific meaning.
Upgrading to Nitrogen 3 and Backwards Compatibility
While Nitrogen 3 represents a major version increase, as usual, I'm taking extra special care to ensure backwards compatibility. I want upgrading to N3 to be pretty straightforward.
Further, I've tested the Nitrogen 3 branch in a Nitrogen 2-generated project, and it passed all tests, which means you could continue to use rebar2 instead of rebar3, along with the old directory structure, with minimal problems. Not that I recommend it, but that's a demonstration of the commitment to backwards compatibility.
What's left before Nitrogen 3 is released?
As mentioned, I have a few other handlers I want to rework, and a little more work on removing jquery (again, it jquery will almost certainly still be in N3, but it's being phased out). I also plan to add few more elements, actions, and functions, and of course, a bunch of new documentation still has to be written (a lot has been done, but more still to go).
Also, while grid 960 was cool in 2008, the built-in grid system needs to be reworked to be responsive. I'm still a little on the fence on the direction to go with that.
Further, the Nitrogen homepage is getting a much needed redesign.
Release ETA?
While I've been saying "Nitrogen 3 should be ready in a few months," that remains the answer. I'm still working on Nitrogen 3 mostly in my after-hours time, and I'm rapidly entering my busy season for work.
So while I'd like to have the release ready within a month, more realistically, it may be end of summer or early fall.
But given that nitrogen_core for N3 works in a N2-generated application, I plan on merging the rebar3 branches into the master branches pretty soon. I just need to be careful with that because I don't want folks following the Nitrogen Book (builditwithnitrogen.com) or the online tutorials to be stuck because the master branch no longer works with older documentation.