Node handles all your system calls and Chromium handles all the user interface elements and the majority of data processing. When you build you project it is turned into an executable. This executable contains a node server, a web browser and your web application. Note that the Node server is only accessible to your application.
This means that your app essentially lives inside a browser. This browser however has no user interface elements of its own and so looks and behaves more like a traditional desktop application.
Watch this video to find out more:
So when one of my mates brought up Electron and the preceding the conversation when a little like this:
So it's like Java?
Well yes, no and sort of.
Yes, like Java you write your application once and it's capable of running on the 3 major desktop operating systems; Windows, Mac OS and Linux.
No. With Electron you must compile your application for each platform you want to run it on. When you compile an electron project it compiles your code into a program which contains a browser and a node server. This compiled program hosts your web code. With Java, you compile Java Virtual Machine (JVM) bytecode. The Bytecode is then run in the JVM. The JVM acts as a middleman between Java bytecode and the Operating System.
Sort of. It's like Java in the sense that the browser element of Eelectron performs a similar task to the Java Virtual Machine. Just like Java, electron apps aren't as quick as applications that are compiled to executable machine code. Electron based programs are web applications disguise as a desktop programs.
What are the benefits or using Electron?
You can use HTML and CSS to quickly and easily build a GUI. It's open source so it's always getting updates and bug fixes. Just because it's open source doesn't mean you can't use your Electron program commercially. But it is always best to check licenses with a legal professional if you're ever unsure of how your specific usage of copyrighted material is covered.
What might prevent you from considering switching to electron?
Electron's documentation; at the moment, isn't all up to date. Often times the Node documentation is leagues better than electrons. I would definitely recommend looking at a few node tutorials before starting your first electron project. There are also a lot of electron tutorials that are based on older versions and may things shown in them have drastically changed.
Licensing your product can be a little tricky. While many open source licences are compatible with each other there are some that aren't. Before adding a library to your project you need to check that all the licences that you are using are compatible with one another and that licence you're selling your software under is compatible with all the third-party technologies your project uses.
There are four types of people those who:
While I at first didn't like Node, it does grow on you after a while.
Node certainly isn't perfect and it can be flawed at times; particularly if you don't understand some of Nodes fundamental design choices. It's a bit of a love hate relationship for me at the moment. I like it because it's quick to pick up and relatively easy to learn. I dislike it because Node is clearly designed to run as server and when using Node to interact with an operating system it can be frustrating at times. Node is also a little harder to get going on Windows than it is on Linux or Mac OS.
So give electron a look and decide if it's suitable for you.
How can I learn more about electron? Visit http://electron.atom.io/
How do I get started? See the quick start guide https://github.com/electron/electron-quick-start
Zach Radloff lives on the Gold Coast and is studying IT and Multimedia at university, and is also a qualified Live Production, Theatre and Events Technician.
Zach Radloff's previous articles may be viewed at www.pressserviceinternational.org/zach-radloff.html