Friday, 31 October 2014

The Notion of Time in Programming

In colloquial terms programs are the stories told to the machines. But somehow because a machine cannot understand exactly what we speak, we tend to stick to something which is understandable. In the process of telling a machine what needs to be carried out, we have also constrained ourselves with our expectations. As we cannot hangout with a machine and tell what exactly to do, we just hang a few things out of context and say, doing this would still do!

Up until now, when i used to hear the word time with programming, my mind wondered in the land of efficiency made up of some theorems, analysis and relations to find the time taken by the algorithm. And there's been quite a round of circus to improve time.

Okay. Where else could time fit in? "no where else" would look like most appealing and legitimate answer. One important reason for the consideration being, the models we developed before we programmed also had least consideration for time. It was not in design model and hence it is not propagated to program.

Time definitely needs to be associated with every step event in programming. In fact it can be also a method to prove the correctness of the program as well, which is usually ignored, though is heart of the program.

In other understandable term, we don't say
"x" made a transition to "y" with input "u"

Instead we start saying,
"x" made a transition to "y" with input "u" at time "t"

Well, yes, it needs a thinking right from the bottom, to restructure the whole of what we did so far.

Wednesday, 29 October 2014

I ask for an “x” and

The programmer’s dilemma?? Well, I would call it so.  Not that I am jumping to the conclusion without reasoning.

Look at the scenario. The problem was simple with a too simple solution. I wanted the value of ‘x’ and I ask for an ‘x’. Either I get back the value of it or an answer ‘unknown’. The scenario is not the same any more. Why is it not the same?

Programmer now needs to handle way more than expected number of conditions. We ask for an ‘x’ and we get back the value or no value, is the routine thinking. Now added to that are few more things, which a programmers needs to exhaust while he obtains the result.

What if you are asked to wait! The value is being computed and there is a delay. Or it’s coming over the network and there is a delay.  Is your code ready to wait? If yes, for how long?

What if you get blocked? And result is never returned? Neither have you got an error status nor an exception. The request is blocked and there is no permission. Are you ready to throw a suitable message? And realize that you were blocked?
What if you go dangling? And get a 404 error. What if the computation to get ‘x’ was pushed somewhere else?

What if you have got the result with some disturbance? There could be a positive or negative deviation in the result obtained. Will you ask a few more times and take an average? If yes, how many times? Is there a threshold?

The challenges are many. A programmer has to become an exhaustive web programmer! Or would there be a language which would inline the thinking towards the direction?  

Saturday, 4 October 2014

JavaScript Animation Libraries - Quick Survey

[Image Reference:]

JavaScript is so much powerful that everything can be animated with ease amongst numerous available libraries. Being tried with a few libraries, here is a small survey. The list is never ending. There are 100's with specific properties. Here are a few which i have used!

1. Collie
  • Can create highly optimized animations and games using HTML 5
  • Collie runs on both PC and mobile using HTML 5 canvas and DOM
  • Optimized for mobile application development
  • Collie can stably process multiple objects using rendering pipelines
  • Supports useful features including sprite animation and user events
  • Stably supports iOS and Android, and renders with an optimized method for each platform
Reach: Collie

2. Processsing
  • Makes your data visualizations, digital art, interactive animations, educational graphs, video games, etc
  • Adhers to web standards and without any plug-ins
  • We can write code using the Processing language, include it in web page, and Processing.js does the rest
  • Processing.js uses JavaScript to render 2D and 3D content on the HTML canvas element
Reach: Processing

3. TweenJS
  • The TweenJS Javascript library provides a simple butpowerful tweening interface
  • It supports tweening of both numeric object properties & CSS style properties, and allows to chain tweens and actions together to create complex sequences
  • Tweenjs requires a ticker function, which is included in EaselJS
  • If we are not using EaselJS, we must build your own ticker function that calls tick on the tweens.
Reach: TweenJS

5. Animo
  • Powerful little tool for managing CSS animations
  • It includes features like stack animations, create cross-browser blurring, set callbacks on animation completion
  • Limited Functionalities
Reach: Animo

6. SVG
  • Creates interactive, resolution-independent vector graphics that will look great on any size screen
  • And the Snap.svg JavaScript library makes working with SVG assets as easy as jQuery makes working with the DOM
  • Snap.svg is designed for modern browsers and therefore supports the newest SVG features like masking, clipping, patterns, full gradients, groups, and more
Reach: SVG

7. jsAnim
  • jsAnim is easy to include in websites and easy to animate with
  • Popular for its mushroom experiments
  • Easy to add mediocre animations to websites
Reach: jsAnim

8. Favicon
  • To add badges, images, or even video to your favicons
  • Favico.js makes it simple to add animated badges for your favicon
  • Easy creation of a favicon on the fly from an image, video, or even a live image from visitor’s webcam
Reach: Favicon

9. Motio
  • Small JavaScript library for simple but powerful sprite based animations and panning.
  • Motio has no dependencies, but there is an optional Motio jQuery plugin version available
Reach:  Motio

10. Headroom
  • A  lightweight, high-performance JS widget
  • Allows to react to the user's scroll
  • It slides out of view when scrolling down and slides back in when scrolling up
Reach: Headroom