Home      |      Products      |      Services      |      About      |      Portfolio
  • About
    Mission statement, culture, and background information.
  • Services
    extollIT provides specialized and targeted application software development services backed with support commitment.
  • Portfolio
    Interested in reviewing some of my work? Click here;
  • Contact
    Need to get in-touch with us? click here.

Decoupling Node.js from JavaScript

28-Feb-2012

After hours of working with Node.js, reading tutorials, posts, and other articles on Node.js and other JavaScript-driven web-servers (SilkJS) I am compelled to point-out some issues with Node.js and its marriage to JavaScript.

Firstly it's not actually a bad idea to use a web-server built on-top of a scripting language particularly if your application is just a mashup. And though I would prefer to use Python, server-side JavaScript has its advantages. However, the problem that Node.js intends to solve is better addressed by mature languages (Python) or even a language designed for concurrent programming (Erlang).  JavaScript is not mature and I will explain why later.

Here are the problems with Node.js and why you should steer clear of it at least until it has a few years to mature:

It Replaces Mature Web Servers?

Node.js and SilkJS have communities that hope to replace web servers altogether with Node.js or SilkJS. The rationale here is to aggressively promote one approach and throw away years of mature technology from a variety of vendors (IBM, Apache, Microsoft) and replace it with one singular immature technology that operates on a completely different paradigm (CPS).  These other vendors have had years of experience and large development teams patching holes and polishing rough edges in server technology whereas Node.js and SilkJS have neither.  The rationale here is to start-over from scratch and make all the same mistakes twice.  It is inevitable that Node.js and SilkJS are riddled with holes, which leads to my next point.

The Environment is Buggy

In Node.js, the tertiary operator (expression ? result1 : result2) is broken. In my own source code I had to work-around this issue using an if/else statement instead. Will the developers repair this problem? most likely, but how many more unpleasant surprises will a developer encounter? is it worth risking the potential impact this will have on end-users?  Why make all the same mistakes twice?

A Single-Threaded Web-Server Makes No Sense

Node.js intends to not only replace other web-servers but it also insists on running in a single thread. The sole reasoning behind this: to make the developer's life easy (and the end user's life more difficult). This is an extremely poor justification. A single threaded web-server does not take advantage of multi-processor server hardware.

Apparently Node.js in particular is coming-up with solutions to this problem, but this is reactive bottom-up design. Usually a top-down well-thought-out solution (preferably before a single line of code is even written) leads to a reliable product, and developers who are familiar with dead technologies and wasted time do not like to take risks with a technology that doesn't look like it has a long future in store.

More Reliance on Computers, Less Reliance on Brains

This is the most important oversight that many proponents of Node.js make. No computer is a good substitute for a well-trained mind.  Developers that insist on making the computer do more thinking rather than doing his own thinking tend to use advancements in computing technology like a crutch instead of the gift it is meant to be.  The end-result is a bloated product that had the potential to perform much better.  This pattern is evident among young developers who opt for technologies with a low barrier to entry (JavaScript) rather than taking the time and energy to invest in a mature web-technology (e.g. JavaEE / ASP.NET). This doesn't benefit anyone.  The developer doesn't learn and the end-user's experience is mediocre and could have been much better.  I suppose throw-away web-applications written using Node.js makes some sense, but that gets expensive pretty quick.

Why JavaScript?

The reasoning behind using JavaScript for a server-backend is two-fold: Firstly, it requires less knowledge to build one solution end-to-end in one language.  A good developer knows that different languages are suited to different problems and knows how to apply them in an efficient manner that actually saves him more time in the long-run. C++ is suitable for performance, Haskel is suitable for writing mathematical algorithms, Python is suitable for scripting and automation, Erlang is an excellent choice for concurrency and mashups.  A contractor knows how to use a wide variety of tools to build a house, and so also a developer should know how to use a wide variety of tools to build an application.  Use the best tool for the job that will result in the best experience for the end-user, your enjoyment as a developer should not supersede that.

JavaScript is ill-suited for complex applications such as Node.js because it is still stuck in the dark ages.  It has been over a decade since JavaScript underwent a major face-lift with ES3.  Presently it is still non-modular, completely late-bound, offers no type safety, and lacks proper types such as map, set, int, float, double.  Writing web applications in bash scripts would be comparable except with bash scripts you do have some degree of modularity.  If it were based on JavaScript ES4+, Dart, or even CoffeeScript then I would feel more confident in Node.js or SilkJS.

"It's Not PHP"

The justification for using JavaScript is because "it is not PHP." Proponents of Node.js and SilkJS tip their hands and demonstrate ignorance of the wide variety of tools available for building web-applications by positing that PHP is the only alternative to Node.js. So apparently ASP.NET, C#, ColdFusion, ISAPI, CGI, Python, JavaEE, Ruby, Erlang, Vert.x, Eventmachine simply don't exist.  Why don't some developers learn about other tools? Because reinventing the wheel is more fun?  What is the justification for this JavaScript fascism?  Why even choose to be fascist for a stagnant language?  I'm sure I've missed a few bazillion other web-technologies, and a question that haunts me in my sleep is often, "What technology am I unaware of that could make my application run better for my customers and bolster the bottom-line?"

Continuation-Passing Style, Messy in the Wrong Language

This is how a developer writes software to run under Node.js. It is an old approach to functional programming but JavaScript is ill-suited for CPS and a lot of boiler-plate code is necessary for even the simplest things (such as a for-loop) resulting in greater verbosity and a non-linear source that is difficult to read and follow. LISP or Erlang would be a better choice for CPS over JavaScript, but then this requires knowledge and experience with a variety of programming languages (see my previous point). I think CPS is a good idea to help mitigate risk of programmer error in concurrent programming, but the justifications are backwards. CPS should not necessitate the use of JavaScript, choose the best CPS language for the job.

"Node.js will kill Apache"

Yes the Node fanboys actually say this. So the true motivation behind Node.js isn't so much coming from a desire to improve the web, it looks like it's motivated by a kind of malevolent fascist mandate to dominate it with one language and one technology.  This blog goes further to imply that it will kill Microsoft and everything that isn't JavaScript.  Remind me to avoid developers who have no capacity to appreciate diversity in tools.

In Conclusion

A server built-on-top of a scripting language is a good idea, even a CPS event-driven language for constructing mash-ups has its advantages.  But the Node.js and SilkJS communities insist on using JavaScript to solve absolutely everything and I tire of the irrational justifications for doing so.

Mars Tycoon, The "Sandbox World" Strategy Game

09-Jun-2011

extollIT Enterprises is developing a new kind of innovative video game. We call this genre the Sandbox World game. There are three other games I know of that are similar to our concept, but only one can be credited with its inspiration:
  • Dwarf Fortress
  • Infiniminer
  • Minecraft
  • Roblox
If you haven't heard of these games, I suggest trying Minecraft or Roblox. Dwarf Fortress has inspired Mars Tycoon, but it is very difficult to get into if you are a novice gamer.

Our small team of three has been developing this game since the fall of 2008. You are a space-pioneer in the year 2492 and desire to escape the chaotic political climate of Earth to investigate a strange new mineral on Mars (and beyond) first discovered on a small asteroid that impacted Earth. Scientists have dubbed it with the name Loganite and although it's chemical signature has long been familiar to scientists it has never been found in nature let alone in vast quantities.

Loganite has significant commercial value as a nuclear fuel as well as having other peculiar benefits. Scientists are only just beginning to discover Loganite's value to mankind.

Your job is to establish a mining base on Mars, extract the Loganite, and compete against other nations scrambling for the mineral. You will have to defend your mining base from saboteurs, natural disasters, and skirmish attacks.

Launch of Mars Tycoon is scheduled for 2015. If you posses any of the following skills / experience / knowledge and would be interested in joining our team, please contact us using the About -> Contact Us menu at the top of the page:
  • 3D Modeling / Animation
  • 3D Programming Experience
  • Programming for CG, CUDA, PhysX
  • AI Programming Experience
  • Biochemical Engineering
  • Mechanical Engineering
  • Civil Engineering
  • Chemical Engineering
  • Geophysics
  • Horticulture
  • Astrobiology
  • Genetic Engineering
"Wait a sec! These are pretty steep qualifications!"
Actually not really. Although some of these "qualifications" demand post-doctoral work, you don't even need to have a post-secondary degree here. Self-directed study is very acceptable. For example, we are interested in people with Chemical Engineering knowledge to help us design a realistic Asimovian Sci-Fi experience.

We have a rich and comprehensive vision for Mars Tycoon in terms of both storyline and gameplay mechanics, so Mars Tycoon will be an introductory game into this universe. If it is successful, we plan to release sequels and prequels each sporting both an expanded storyline and new gameplay mechanics.

Computing Arc-Length of a Spline - Advanced

15-Jan-2010

Here is a snippet of my own software used in another project that computes the arc-length of a spline using the Gauss-Legendre quadrature (numeric method of integration) implemented with recursive template meta-programming in C++:

First-off, you will need a constant 5x2 array of doubles to initialize the abscissae for, which is essentially a pre-computed table of the roots of the Legendre polynomials of order n. In this example I use order of 5, which was accurate enough for my purposes:
 const double ABSCISSAE_5[5][2] = {
-
0.90617984593866399280, 0.23692688505618908751,
-
0.53846931010568309104, 0.47862867049936646804,
0.0
, 0.56888888888888888889,
+
0.53846931010568309104, 0.47862867049936646804,
+
0.90617984593866399280, 0.23692688505618908751
};

Stub out an exception to generate runtime errors when incorrectly implementing the class:
 class CalcEx : public std::exception {};

Below the recursive class template is defined. It uses template-inheritance and since templates are interface-agnostic, you will need to define this method on your class: inline real f (const real t) const. It's essentially providing the implementation for an abstract method declared in the base class.
 template <typename T, typename Derived, int NN>
class
GaussLegendreInt
{

private
:
template
<int N> T abscissa (const unsigned int i, const unsigned int j) const
{

throw
CalcEx ();
}

template
<> T abscissa <5> (const unsigned int i, const unsigned int j) const
{

return
static_cast <T> (ABSCISSAE_5[i][j]);
}


template
<int N> T summate (const T val, const T a, const T b) const
{

return
val + summate <N - 1> (
abscissa <NN> (N - 1, 1) *
static_cast
<const Derived *> (this) -> f(
(
b + a) / 2 +
((
b - a) / 2) * abscissa <NN> (N - 1, 0)
),

a, b
);
}

template
<> T summate <0> (const T val, const T a, const T b) const { return val; }
public
:
inline
T compute (const T a, const T b) const
{

return
((b - a) / 2) * summate <NN> (0, a, b);
}
};


Now it's time to put our algorithm to use and build a class that takes a spline object (usually four points or two points and two tangents) and computes the arc-length using the Gauss-Legendre algorithm we've prepared:
template <typename Spline, typename real>
class
ArcLength : private GaussLegendreInt <real, ArcLength <Spline, real>, 5>
{

private
:
const
Spline & _spline;

public
:
inline
ArcLength(const Spline & spline)
:
_spline(spline) {}

inline
real f (const real t) const
{

return
MAGNITUDE(_spline.computeAt (t));
}


static inline
real calculate (const Spline & spline)
{

return
ArcLength(spline).compute(0, 1);
}
};

The spline object assumes a function called computeAt that returns a vector (2D, 3D or whatever) of which the function MAGNITUDE computes the vector magnitude of. You will define these yourself including your implementation of splines. There are plenty of examples on the Internet on how to implement splines. Some examples include Cubic B-Splines, Catmull-Rom Splines, and NURBS.


Emerging Cultural Acceptance of Video Games

21-Jul-2009

For decades now, video games have been evolving. And they are still evolving; the fat lady hasn't sung. One of the key things happening here is that video games are still searching for its primary role in society. Video games have proven themselves both financially and artistically, but still needs to gain cultural and social respect. Right now video games are experiencing the honeymoon of money-making and about to experience the hang-over as game development costs soar into the millions. We can't respect video games as a medium of communication making positive contributions to society. Games like Grand Theft Auto don't do much to instill confidence in moms and dads. Video games have earned a very tainted track record. It's no surprise why society rejects this medium.

Games like Grand Theft Auto or World of Warcraft are just the sort of games that sell and pay the bills. Beneficial and "socially acceptable" games employ realistic, and therefore unpopular, consequences; it's not easy to win, and you're not always the over-powered hero that traditional video games make you out to be. There are some positive side-effects to playing a game like World of Warcraft, but in general very little of the experience translates to the real world and so in terms of time the cost outweighs the benefit. When money is on the line, there is a strong voice that rejects any titles that do not elicit violence, hyper-sexualization, or ape-man thinking, a voice that the industry caters to almost exclusively. Let's get our minds off this one-track approach to games. And let's also do away with partisan anti-gaming rants using Doom or Wolfenstein 3D as examples. For one thing those games are ancient! get with the times! secondly, could they say the same about Sim City or The Sims? Yes, making my sim call-up a blind date will cause me to bring grenades to school on monday. I see the connection, no really.

Setting aside trigger-happy gaming for a moment, the Wii has managed to appeal to baby boomers and has advanced cultural and social acceptance of interactive entertainment more than anything else has in decades. People of all ages enjoy playing Wii fit, it's fun, and it stretches those creaky joints. The Sims, Civilization, Sim City, and other relatively tame simulation and strategy games are in-fact the best-selling PC games (2007 ESA survey). Guitar Hero fans have picked-up a real instrument with either aspirations of stardom or casual enjoyment. Simulation-type games have been used to help unemployed people learn about various industries and the results have been very effective in helping them find jobs they enjoy. We seldom hear about these, and even these barely scratch the surface of interactive media potential.

There is woefully little serious video game research being conducted. We just simply haven't discovered what games are capable of. We just don't know. There are some obvious facts: games are serious having the capacity to enslave the mind, but so do a myriad of other things, but we don't throw them out as altogether innately evil. They must be treated with care but not necessarily rejected just as a credit card with no limit must be treated the same. Video game addiction is not psychotropic drug addiction, there are no chemicals involved other than entirely natural dopamine produced by the brain. It is not enough to simply blame video games and be done with it just as so many people need a devil to blame their problems on. The individual has complete control here. The gamer needs a little self-discipline with this powerful medium and learn to use it instead of allowing himself to become used by it. And consider this: what's to prevent a young gamer from escaping to video games to cope with confused and detached parents fearful about him playing video games?

There is some research and evidence in support of video games. They stimulate neural growth especially at young ages. They foster complex problem solving skills, quicken reflexes and hand-eye coordination. Better hand-eye coordination can lead to increased enjoyment of playing sports contrary to the popular belief that video games lead to a sedentary lifestyle. This 2005 survey of 200~ college students indicates that video games are forging very capable and competent leaders able to think outside the box and tackle problems aggressively and proactively. One caveat: it alters one's way of thinking that is unpopular with educators and not very compatible with traditional methods of education. Consequently gamers typically have lower grades than non-gamers. Overall there is strong evidence that playing video games can have a very positive impact on the individual.

If you have a problem with gaming then here's an invitation for you to get acquainted. Pick-up a game and discipline yourself to play it everyday for one week. During this exercise focus on wrapping your head around how a typical gamer thinks. If you understand how gamers think, you will better know how to help them see things from your point of view. Otherwise without having a clear and balanced perspective, one will only contribute to the frustration and confusion. Eventually gamers will out-number non-gamers and we will see gamers, who are socially responsible and lead balanced lifestyles, move into positions of power. Eventually we will figure out what this interactive medium is capable of and learn all about the human relationship with interactive media.

Innovation 101 for the Perfectionist

30-Jun-2009

To innovate is to introduce something new to the public that is usable and meets a perceived need. This article will dispel some common misconceptions that the perfectionist may have with his approach to design. Since women are perfect anyway and have this area covered, I will only use masculine pronouns. Actually it's for the sake of brevity. As someone who IS a perfectionist, this article is written for other perfectionists just getting his or her feet wet with this stuff. I suppose you could say that a perfect design goes hand-in-hand with proven innovation. But as the perfectionist I cannot say I've always shared this perspective and it's difficult to get over it. Hopefully this article can dispel some of the myths holding the typical perfectionist back from greater success.

MYTH: Perfection in design is necessary.

The fundamental reason perfectionism fails as a good approach to software design is because perfectionism does not factor human error into code design. Human error is inevitable and "nobody's perfect". To expect consistent and perpetual perfection from yourself, your team, or even your customer's requirements is unrealistic. Therefore, the perfectionist must accept human error as a valid and acceptable factor in the design process. It is haphazard to turn a blind-eye to this variable. Expect loose-ends to come from anywhere. Probably the most dangerous assumption to make is that the customer has a good understanding of his or her business challenge. In the end trial and error is inevitable to evolve and refine a product.

MYTH: Perfectly designed software leads to a quality product

How do you measure the quality of a product? Simply by how accurately it accomplishes its original purpose, which is defined by the customer's requirements. But how often are those requirements written in stone? How often can we say that they everyone understands those requirements perfectly? The perfectionist operates with these assumptions. Furthermore, it takes too long to develop a product that is perfect. Since software requirements change quite frequently, the result can be a lot of wasted time on a polished but irrelevant design. If you can't get it out the door, if it's incomplete, then it is far from perfect. One key characteristic shared by all of the most successful products out there is that they each do exactly one thing very very well and that has been attained through multiple iterations of trial and error.

MYTH: A perfectly designed product is highly maintainable.

Since details of implementation are often up to one individual programmer, his perception of perfection may be way-off the mark to someone else. Furthermore, code that conforms to standard OO design patterns religiously is not maintainable because it proves to be an overwhelming task to trace program flow through a deluge of, however highly cohesive and decoupled, unfamiliar classes. An experienced developer knows that any algorithm that can fit conveniently into various design patterns is common-place and more than likely already in a reusable framework somewhere anyhow. For the rest of your intellectual property, you yourself know that it doesn't fit conveniently into standard design patterns. Moreover, you know that your product isn't innovative because it is common-place. And so it becomes necessary to bend the rules while ironically keeping in mind other developers who might have to look at it later.

Home  |  Contact  |  About  |  Services  |  Products  |  Clientele  |  Portfolio  |