Altabel Group's Blog

Posts Tagged ‘JavaScript

The competition in the server side programming department is getting tougher with each month, especially with the recent popularity of NodeJS. However let`s look how everything began.

PHP appeared about 20 years ago, in 1995 and ever since then it has been a number one language for back-end developers and has gathered a big community behind it. For a long time there wasn’t any good reason why not to use PHP: it`s rather easy to use PHP, it`s supported by the majority of hosting companies and it has become the most commonly used language in terms of number of websites powered by it.

NodeJS was created in 2009 and it was very unique to all the other back end languages. It`s an efficient and scalable software platform that can execute JavaScript code on a server. NodeJS uses event-loops rather than traditional threading, which makes it faster and less memory-intensive than traditional platforms. Thus the ability to use Javascript on both the client and the server and the ability of NodeJS to run asynchronously have undoubtedly lead to the rise of NodeJS and its popularity within developers and customers.

Of course, everyone has his own truth: one coder will praise the speed of NodeJS while the other will be devoted to the stability and long history of PHP. But let`s have a look at strong sides of both for you to decide whether to concern yourself with the so popular nowadays NodeJS or not.

PHP strong sides:

– Huge community and tons of materials for all programmers, from a beginner to an advanced coder.
– Deep code base. The most popular platforms for building websites (WordPress, Drupal, Joomla) are written in PHP. Not only are the platforms open source, but so are most of their plug-ins.
– Easy to find a hosting company. PHP has been the industry standard since the stone age and any hosting company still surviving is bound to be compatible with it. For Node.JS you still need to make a little research.
– Simplicity. PHP can be run inside of the same file as html.
– Speed of coding. For most developers, writing PHP for Web apps feels faster: no compilers, no deployment, no JAR files or preprocessors — just your favorite editor and some PHP files in a directory.
– Mixing code with content. You just open up PHP tags and start writing code. No need for templates, no need for extra files or elaborate architectures.
– No client app is needed. All of the talk about using the same language in the browser and on the server is nice, but what if you don’t need to use any language on the browser? PHP is a way out.

NodeJS strong sides:

– Speed. NodeJS is blazing fast compared to PHP. This is where Node really kicks assJ.
– Separation of Concerns. NodeJS separates fundamental components up giving a clear separation of concern across controllers / routes, models and views.
– New and fresh. It’s newer in comparison to PHP and has been developed by programmers who have full knowledge and understanding of modern web applications, from the server to the client, and that means more modern features.
– Modern syntax. Javascript isn’t perfect and it may drive developers crazy, but overall it’s a modern language that supports modern syntax such as closures, and you can easily extend Javascript and make any object configured to exactly how you need it.
– JSON. NodeJS is a powerhouse for JSON. Accessing SQL is possible and there’s plenty of plugins that make it possible, but JSON is the lingua franca for interacting with many of the latest NoSQL databases.
– Gridlock. NodeJS uses a callback structure to pass logic from one asynchronous call to the next meaning we never have to worry about spawning new threads or even considering the deadlock process. Almost no function in Node directly performs I/O, so the process never block which is a major implication for scalable systems.

That is a difficult decision when it comes up to decide which language or tool to choose. But NodeJS worth considering and it`s proved by the fact that Node is getting more and more popularity every day. And what is your opinion on NodeJS, is it the future of web?

Anna Kozik

Anna Kozik
Anna.Kozik@altabel.com 
Skype ID: kozik_anna
Business Development Manager (LI page)
Altabel Group – Professional Software Development

The big languages are popular for a reason: They offer a huge foundation of open source code, libraries, and frameworks that make finishing the job easier. Sometimes the vast resources of the popular, mainstream programming languages aren’t enough to solve your particular problem. Sometimes you have to look beyond the obvious to find the right language, where the right structure makes the difference while offering that extra feature to help your code run significantly faster without endless tweaking and optimizing. This language produces vastly more stable and accurate code because it prevents you from programming sloppy or wrong code.

The world is filled with thousands of clever languages that aren’t C#, Java, or JavaScript. Some are treasured by only a few, but many have flourishing communities connected by a common love for the language’s facility in solving certain problems. There may not be tens of millions of programmers, who know the syntax, but sometimes there is value in doing things a little different, as experimenting with any new language can pay significant dividends on future projects.

The following six languages should be on every programmer’s radar. They may not be the best for every job — many are aimed at specialized tasks. But they all offer upsides that are worth investigating and investing in. There may be a day when one of these languages proves to be exactly what your project — or boss — needs.

Erlang: Functional programming for real-time systems

Erlang’s secret is the functional paradigm. Most of the code is forced to operate in its own little world where it can’t corrupt the rest of the system through side effects. The functions do all their work internally, running in little “processes” that act like sandboxes and only talk to each other through mail messages. You can’t merely grab a pointer and make a quick change to the state anywhere in the stack. You have to stay inside the call hierarchy. It may require a bit more thought, but mistakes are less likely to propagate.

The model also makes it simpler for runtime code to determine what can run at the same time. With concurrency so easy to detect, the runtime scheduler can take advantage of the very low overhead in setting up and ripping down a process. Erlang fans like to flourish about running 20 million “processes” at the same time on a Web server.

If you’re building a real-time system with no room for dropped data, such as a billing system for a mobile phone switch, then check out Erlang.

Go: Simple and dynamic

Google wasn’t the first organization to survey the collection of languages, only to find them cluttered, complex, and often slow. In 2009, the company released its solution: a statically typed language that looks like C but includes background intelligence to save programmers from having to specify types and juggle malloc calls. With Go, programmers can have the terseness and structure of compiled C, along with the ease of using a dynamic script language.

While Sun and Apple followed a similar path in creating Java and Swift, respectively, Google made one significantly different decision with Go: The language’s creators wanted to keep Go “simple enough to hold in one programmer’s head.Thus, there are few zippy extras like generics, type inheritance, or assertions, only clean, simple blocks of if-then-else code manipulating strings, arrays, and hash tables.

The language is reportedly well-established inside of Google’s vast empire and is gaining acceptance in other places where dynamic-language lovers of Python and Ruby can be coaxed into accepting some of the rigor that comes from a compiled language.

If you’re a startup trying to catch Google’s eye and need to build some server-side business logic, Go is a great place to start.

Groovy: Scripting goodness for Java

The Java world is surprisingly flexible. Say what you will about its belts-and-suspenders approach, like specifying the type for every variable, ending every line with a semicolon, and writing access methods for classes that simply return the value. But it looked at the dynamic languages gaining traction and built its own version that’s tightly integrated with Java.

Groovy offers programmers the ability to toss aside all the humdrum conventions of brackets and semicolons, to write simpler programs that can leverage all that existing Java code. Everything runs on the JVM. Not only that, everything links tightly to Java JARs, so you can enjoy your existing code. The Groovy code runs like a dynamically typed scripting language with full access to the data in statically typed Java objects. Groovy programmers think they have the best of both worlds. There’s all of the immense power of the Java code base with all of the fun of using closures, operator overloading, and polymorphic iteration.

Finally, all of the Java programmers who’ve envied the simplicity of dynamic languages can join the party without leaving the realm of Java.

CoffeeScript: JavaScript made clean and simple

Technically, CoffeeScript isn’t a language. It’s a preprocessor that converts what you write into JavaScript. But it looks different because it’s missing plenty of the punctuation. You might think it is Ruby or Python, though the guts behave like JavaScript.

CoffeeScript began when semicolon haters were forced to program in JavaScript because that was what Web browsers spoke. Changing the way the Web works would have been an overwhelming task, so they wrote their own preprocessor instead. The result? Programmers can write cleaner code and let CoffeeScript turn it back into the punctuation-heavy JavaScript Web browsers demand.

Missing semicolons are only the beginning. With CoffeeScript, you can define a function without typing function or wrapping it in curly brackets. In fact, curly brackets are pretty much nonexistent in CoffeeScript. The code is so much more concise that it looks like a modernist building compared to a Gothic cathedral. This is why many of the newest JavaScript frameworks are often written in CoffeeScript and compiled.

Haskell: Functional programming, pure and simple

For more than 20 years, the academics working on functional programming have been actively developing Haskell, a language designed to encapsulate their ideas about the evils of side effects. It is one of the purer expressions of the functional programming ideal, with a careful mechanism for handling I/O channels and other unavoidable side effects. The rest of the code, though, should be perfectly functional.

The community is very active, with more than a dozen variants of Haskell waiting for you to explore. Some are stand-alone, and others are integrated with more mainstream efforts like Java (Jaskell, Frege) or Python (Scotch). Most of the names seem to be references to Scotland, a hotbed of Haskell research, or philosopher/logicians who form the intellectual provenance for many of the ideas expressed in Haskell. If you believe that your data structures will be complex and full of many types, Haskell will help you keep them straight.

Julia: Bringing speed to Python land

The world of scientific programming is filled with Python lovers who enjoy the simple syntax and the freedom to avoid thinking of gnarly details like pointers and bytes. For all its strengths, however, Python is often maddeningly slow, which can be a problem if you’re crunching large data sets as is common in the world of scientific computing. To speed up matters, many scientists turn to writing the most important routines at the core in C, which is much faster. But that saddles them with software written in two languages and is thus much harder to revise, fix, or extend.

Julia is a solution to this complexity. Its creators took the clean syntax adored by Python programmers and tweaked it so that the code can be compiled in the background. That way, you can set up a notebook or an interactive session like with Python, but any code you create will be compiled immediately.

The guts of Julia are fascinating. They provide a powerful type inference engine that can help ensure faster code. If you enjoy metaprogramming, the language is flexible enough to be extended. The most valuable additions, however, may be Julia’s simple mechanisms for distributing parallel algorithms across a cluster. A number of serious libraries already tackle many of the most common numerical algorithms for data analysis.

The best news, though, may be the high speeds. Many basic benchmarks run 30 times faster than Python and often run a bit faster than C code. If you have too much data but enjoy Python’s syntax, Julia is the next language to learn.

Polina Mikhan

Polina Mikhan
Polina.Mikhan@altabel.com 
Skype ID: poly1020
Business Development Manager (LI page)
Altabel Group – Professional Software Development

 

The IT sector is flourishing. If you’ve used a computer for at least a couple of times in the last few years, you’ve probably noticed this. I’ve noticed it myself even more after a business trip to Stockholm where I was lucky to attend some conferences and learnt more about Swedish IT industry tendencies. These tendencies reflect our life in general. Life changes rapidly with new technologies bursting into it. And when it comes to programming languages, we get a chance to see very different trendy styles. Programming languages which were popular some years ago are not useful today. And no one can exactly predict which programming language will be popular in future. That’s why a programmer who wants to stay in developer fields has to adopt the right programming language from time to time.

As the Swedish software maker Erik Starck pointed out, “programming is about managing complexities”. And it’s really so. An understanding of at least one programming language makes an impressive addition to any CV nowadays.

It is also very difficult to get the exact number of users for any programming language. Many of us use multiple programming languages. The more experience you have, the more programming languages you use. The more programs you write or work with, the chances of using more languages rise. The larger the company, the more languages you’re likely to use.

There are a number of ways to measure the popularity of a programming language, for example, based on the number of: 1) new applications written in the language; 2) existing applications written in the language; 3) developers that use the language primarily; 4) developers that use the language ever; 5) web searches; 6) available jobs that require skills in the language; 7) developers’ favorites, etc.

My survey attempts to rank which programming languages are most popular in Sweden, each using a different measure. So, they are the following:

1) Python

Python is an object-oriented programming language which allows developers to work quickly while integrating their systems more efficiently and effectively. Designed by Guido van Rossum in 1991, Python is one of the most easy to use programming languages.

Python is characterized by its use of indentation for readability, and its encouragement for elegant code by making developers do similar things in similar ways.

Top Employers: Amazon, Dell, Google, eBay, Instagram, Yahoo

2) Java

Java is a class-based, object-oriented programming language founded by Sun Microsystems in 1995. Java is one of the most in-demand programming languages today for many reasons. First of all, it is a well-organized language with a strong library of reusable software components. Secondly, programs written in Java can run on many different computer architectures and operating systems because of the use of the JVM (Java virtual machine).

Top Employers: Amazon, Deloitte, Sun, eBay, Symantec Corporation, Cisco Systems, Samsung

3) C++

C++ is a compiled, multi-paradigm language written as an update to C in 1979 by Bjarne Stroustrup.

Due to its high-level compatibility and object-orientation, C++ is used for developing a wide-range of applications and games which makes it a popular and sought after programming language by the employers.

Top Employers: Intel, the Math Works, Microsoft, Qualcomm, Amazon, Mozilla, Adobe, Volvo

4) Ruby

Ruby is an open source, dynamic programming language designed by Yukihiro Matsumoto in 1995 with a key focus on productivity and simplicity .It is one of the most object-oriented languages in the world.

Ruby is a mix of elegant syntax which is easy to read and write and hence it has attracted many organizations and developers.

Top Employers: Spokes, VMware, Accenture, Cap Gemini, Siemens, BBC, NASA

5) JavaScript

JavaScript is an object-oriented scripting language founded in 1995 by Netscape.

Being a client-side language, it runs in the web browser on the client-side with a simplified set of commands, easier code and no need for compilation.  JavaScript is simple to learn and it is used in millions of web pages to authenticate forms, detect browsers and improve design.

Top Employers: Microsoft, Sales Force, IBM, Yahoo, Dell

6) C#

C# is a compiled, object-oriented language developed by Microsoft.

It is highly used on Windows platform and labelled as the premium language for Microsoft .NET framework. C# is known for strong typing, procedural and functional programming discipline which is the reason it has acquired so much popularity.

Top Employers: Microsoft, HP, Digi-Key Corporation, Allscripts, Intel

Those are the top 6 programming languages which are in great demand among Swedish developers.

And one more thing: remember that opinions are like noses, everyone has one and they all smell ;) If you disagree, please feel free to email me or write your own opinions in the comments.

Katerina Kviatkovskaya

Katerina Kviatkovskaya
Kate.Kviatkovskaya@altabel.com
Skype ID: kate.kviatkovskaya
Business Development Manager (LI page)
Altabel Group – Professional Software Development

Developers use JavaScript for a number of different web applications. If you continue adding more code to make it work in multiple browsers and use cases, it can quickly become a big mess. Hence you’d better use a framework to avoid this.

Frameworks like Angular, Backbone and Ember make your JavaScript code structured and keep it organized. Being all open source, they’re constantly improved by the community. They also save your time as they’re built on top of JQuery, a fast and powerful library that makes some of JavaScript’s complex operations easier to perform and more readable.

However, choosing your JavaScript framework isn’t such easy and could be challenging. Let’s try to understand how Angular, Backbone and Ember are different from each other and what their strengths and weaknesses are.

AngularJS

AngularJS is an open-source web application framework, maintained by Google and community, that assists with creating single-page applications, one-page web applications that only require HTML, CSS, and JavaScript on the client side. Its goal is to augment web applications with model–view–controller (MVC) capability, in an effort to make both development and testing easier.

AngularJS was originally developed in 2009, and it is the oldest of the three frameworks. It also has the largest community. In 2013, Angular was fourth in number of project contributors on GitHub and third in number of stars gain which testifies to its huge popularity. Moreover such well-known companies as Amazon, Google and Nike credit AngularJS as JavaScript framework. There are also a lot of news sites using AngularJS on their front pages, including the Guardian, the Huffington Post, and MSNBC. You may also check https://builtwith.angularjs.org/ to have a look at good examples of Angular apps and experiments.

Pros

  • Ideal for complex “client-side” applications, where the complexity is more in a way “components” of an application interacts with each other than in a way they synchronise and/or interact with backend
  • Very clear separation of concerns
  • Uses concepts that kind of look like the future of HTML/DOM (DOM templates, binding attributes).

Cons

  • A bit complicated to grasp. A lot of new concepts
  • jQuery or another dom parsing framework in directives may be painful to use because of the way angular compiles templates
  • Good for application with a big level of complexity on the client side, but you’ll have to learn a lot of new stuff.

On the whole, AngularJS is a robust and viable framework for building generic web apps. Whether it lives up to the expectations of being the most dominant JS framework for web development is yet to be seen.

Backbone.js

Backbone.js  is a JavaScript library with a RESTful JSON interface and is based on the model–view–presenter (MVP) application design paradigm. Backbone is known for being lightweight, as its only dependency is on one JavaScript library, Underscore.js. It is designed for developing single-page web applications and for keeping various parts of web applications (e.g. multiple clients and the server) synchronized.

Backbone came out in June 2010, and its community is nearly as large as Angular’s. Many popular applications such as Twitter, LinkedIn Mobile and Foursquare use Backbone framework. Also a number of music apps were built with Backbone, including well-known Pandora, Soundcloud and Pitchfork.

The download size of Backbone is very small compared to other frameworks which is its biggest advantage, since it only depends on one JavaScript library instead of several. Moreover, this framework is remarkably hands-off. This means experienced JavaScript developers can quickly get started. However less experienced developers might find themselves writing a lot of “boilerplate” (repetitive) code. If you’re having trouble Backbone has an especially active community rife where you could find free tutorials for getting started with the framework.

If you’re working on a single-page application or widget and you’re comfortable with being a self-starter—Backbone is likely the right choice for you.

Pros

  • Very easy to start with
  • Very small
  • Free to use any templating engine
  • A lot of excellent documentation
  • Good Community Support
  • Very popular (According to Github, Stackoverflow statistics)
  • Very flexible in how you may want to use it
  • Minimalist library
  • Easy to learn

Cons

  • No two way data-binding
  • Dependency on different frameworks like jQuery and Underscore
  • No provision for handling nested views
  • More work required to build large scale applications as compared to Angular or Ember
  • Code can become messy
  • DOM manipulations are left to the developer
  • Performs slower than AngularJS

Ember

Ember.js is an open-source client-side JavaScript web application framework based on the model-view-controller (MVC) software architectural pattern. It allows developers to create scalable single-page applications by incorporating common idioms and best practices into a framework that provides a rich object model, declarative two-way data binding, computed properties, automatically-updating templates powered by Handlebars.js, and a router for managing application state.

Ember is the newest of the three, but it’s already making waves. LivingSocial, Groupon, Zendesk, Discourse and Square are some of the most well-known applications that have adopted Ember. Ember’s creators say it’s easy to see when a site is using Ember because of its loading speed.

At 69K minified and zipped, Ember is the largest framework of the three. Ember’s larger library size partly explains why it’s the largest download of the three Javascript frameworks. Another reason for it is that Ember comes with a lot of built-in support for standard code features.

Ember’s library size and support network are its two greatest strengths, but if you’re only trying to create a small widget or single-page app, it might be overkill for you. If you’re working on a multipage, navigational, long-term project, Ember might be the right choice for you.

Pros

  • Good for long running and complex applications with deep nested view hierarchies
  • Aggregates model data changes and update the DOM late in the RunLoop
  • Well defined models and computed properties
  • Use HandleBars as templating which is flexible
  • Provides auto updating computed properties
  • Test driven

Cons

  • Relatively new framework
  • Steepest learning curve out of the three
  • Payload is the largest out of all three
  • Dependency on jQuery and Handlebars
  • Poor performance as compared to AngularJS
  • Documentation is not very good
  • Two way bindings are not implemented well

As I could see from a number of forums about JavaScript frameworks, many love AngularJS. What about you? Which one framework is your favorite one and why? Please feel free to share your thoughts/experience in the comments below :)

Yuliya Tolkach

Yuliya Tolkach
Yulia.Tolkach@altabel.com
Skype ID: yuliya_tolkach
Business Development Manager (LI page)
Altabel Group – Professional Software Development

Even if you only build websites using CMSs, you’ve probably heard the word “framework” before. You’ve probably also heard of a few famous web frameworks, including Ruby on Rails, Django and Bootstrap. Many experienced web developers build websites using frameworks and often find them easier and enjoyable to use.

In this article, we’re going to explain what a framework is, and when you might use a framework.

If you are currently doing one of the  Coding Training classes, this information will prove especially useful to you. If you are just using a CMS, this post will still contain some valuable insights, as many CMS systems can and are built using frameworks. For example, Drupal 8 is currently being built on Symfony and Joomla 3 is using the CSS framework Bootstrap.

What is Framework?

The goal of a framework is to allow designers and developers to focus on building the unique features for their project, rather than re-inventing the wheel by coding common, familiar features found across many websites and web applications.

A framework can be considered a pre-built that handles most of the repetitive or common features. As a result, unlike a CMS, a framework will probably not have a template/structure user interface (although this is not always the case, as Django provides an administration interface). Most of the activity will be done by writing code and interacting with different parts of the framework itself through code.

Often frameworks take a while to learn, but once you’re familiar with them, they should speed up your development time.

5 advantages to using a framework:

  1. Open-source: Most of the popular frameworks in many languages are open-source (or available to use for free). They also come with licensing that isn’t restrictive and allows you to build commercial products using such frameworks
  2. Documentation and support: Although this can vary (if the language being used is popular and the framework has a lot of developers using it), you can expect that the framework will either have good documentation, good support or both at the same time. It is worth mentioning that “good support” is a subjective issue at times. Typically, paid support will almost always be faster and more concise, but this also depends on the level of activity within the framework – as a framework like Ruby on Rails demonstrates with a massive community, which is renowned for its welcoming nature and good support too.
  3. Efficiency: This could be considered the most vital reason why frameworks exist. They eliminate the need to write a lot of repetitive code that you will find being used in many different applications. These include, for example, user-authentication and commenting systems. On average (if you have sufficient knowledge using a certain framework) you can expect to build a project in much less time than would be achieved writing code without a framework
  4. Security: Typically, a framework is developed and tested by many different developers. It is extremely likely that many security risks are addressed and tested when the framework is being built. New security risks can also be addressed and fixed quickly. However, security can also be considered a con, as will be mentioned in that section
  5. Integration: If you are building almost any type of application (including a website) and you want to store some data, you will typically use a database. Just like a database, there also exists many other tools that link to web development. Many frameworks will thus make it easier to link to these tools and also communicate with them (for example, when “talking to” a database is abstracted away in a certain framework, making communication with the database much easier)

5 disadvantages to using a framework:

  1. Limitations: Generally, you will not be able to do almost anything with a single framework. They are all restricted in some way, from coding paradigms to database designs and everything in between. A good way to work around this is to see what the framework is being used for by other developers in the community, as this will give you an idea of what you can achieve
  2. Performance: With the popularity of client-side JavaScript MVC frameworks like AngularJS, EmberJS and BackboneJS growing since 2012, performance can also be considered a factor. Although performance issues did exist before, they weren’t as relevant as today, where an entire application is loaded through JavaScript, using a framework as the tool for building that application. Whereas you might not feel the impact of loading a 75kb compressed-framework .js file on your PC (with high speeds), this .js file will definitely impact mobile users (who may have slower speeds on their smartphones or tablets)
  3. Learning bias: If you decide to learn how to use any framework from some programming language you are familiar with, chances are that what you learn will be somewhat different to the language itself. This is due to the fact that a lot of those repetitive tasks have been created in custom functions and other parts, which is why you will learn such things that may not have existed in the language lessons itself. Apart from that, you may also learn a lot of things that may be irrelevant to you whilst using the framework in real-life, but are necessary to grasp how the framework works
  4. Steep learning curve: Although this isn’t always the case, most frameworks can be difficult to learn and even more difficult to master. After some simple research into this matter, a university professor said that it will take about 2 years (with no programming background) to become familiar and comfortable using a language (Ruby) combined with a framework (Rails). This may not be the case when being self-taught or having years of programming experience, but I would say that even with experience, at least 3-6 months will be needed to become confident using any framework (based on continuous learning and practice)
  5. Cost: Frameworks require more development expertise and experience than most CMSs. As a result, it can be more costly to hire reliable framework developers than reliable CMS developers. As the experience shows, the average project built with a framework is more expensive than a similar project built with a CMS.

Examples of popular frameworks

Below are some popular web frameworks (in no particular order) for different web languages. This is not an extensive list, as there exists many more options out there.

PHP: 1.Yii; 2.CodeIgniter; 3.CakePHP; 4.Zend; 5.Symfony; 6. Laravel

Ruby: 1.Rails; 2.Sinatra; 3.Padrino;

Python: 1.Django; 2.Web2py; 3.TurboGears; 4.Flask

JavaScript: 1.AngularJS; 2.EmberJS; 3.BackboneJS;4.KnockoutJS

Design/CSS frameworks: 1.Bootstrap; 2.Foundation

Over to you?

Have you built any websites using a framework instead of a CMS?

What were the advantages and disadvantages of going with a framework?

Share your feedback or any other experiences below.

Polina Mikhan

Polina Mikhan
Polina.Mikhan@altabel.com 
Skype ID: poly1020
Business Development Manager (LI page)
Altabel Group – Professional Software Development

Almost everyone involved in web development knows jQuery or at least heard of it. Being simple and concise, it makes web developers’ life much simpler. But could it be a solution to every problem? Unfortunately not.  Once you decided to create more complex web apps, you are to face a problem, as there is no easy way to make your UI and data communicate with each other dynamically. And you need a library which will provide you with a more sophisticated way of communication between your UI and the underlying data model. And here is where Knockout (KO) could help.

What is Knockout?
Knockout is a JavaScript library which helps to create rich, desktop-like web UIs. It was developed and is maintained by Steve Sanderson, a Microsoft employee. KO simplifies user interactions and makes interfaces fully responsive to any data source changes. It provides a simple two-way binding mechanism to link a data model to an UI, thus making synchronization between them very easy.

 Pros:

–     Dependency Tracking
 The right parts of your UI are automatically updated whenever your data model changes. This is achieved by the two way bindings and a special type of variables called observables. You don’t have to worry about adding event handlers and listeners for dependency tracking.

–     Declarative Bindings
 This allows you to bind the elements of UI to the data model in a simple and convenient way. When you use JavaScript to manipulate DOM, this may cause broken code if you later change the DOM hierarchy or element IDs. But with declarative bindings even if you change the DOM – then all bound elements stay connected. You can bind data to a DOM by simply including a data-bind attribute to any DOM element.

–     Templating
 This becomes useful when your application becomes more complex and you need a way to display a rich structure of view model data, thus keeping your code simple. Knockout can use alternative template engines for its template binding. It has a native, built-in template engine which can be used right away.

–     Compatibility and Extensibility
 Knockout is compatible with any back-end technology and on the front-end it does as much or as little as you decide. It leaves many decisions to you to make, thus letting pick the best tool to meet your specific needs. Knockout doesn’t care about how you communicate with the server or how you choose to do routing, but there are several third party libraries that do a fine job of these things (like sammy.js for routing and upshot.js for data-access). It goes without mentioning that it works fine next to jQuery. Knockout is also easily extensible. To modify or extend the default functionality, it offers features like custom bindings, and custom functions. There are also several plugins already written for KO.

–     Ease of Learning and Use
 The documentation for knockout is probably the best have ever been seen. It has an amazing interactive tutorial system, live examples, and the documentation is extremely comprehensive and easy to understand. For most developers already familiar with JavaScript it should not take more than a few days to pick it up and start using.

Some additional benefits are the following:
•          KO is a pure JavaScript library – so it works with any server or client-side technology
•          It can be added on top of your existing web application without requiring major architectural changes
•          It’s compact – around 13kb after gzipping
•          It works on any mainstream browser (IE 6+, Firefox 2+, Chrome, Safari, others)
•          Comprehensive suite of specifications (developed BDD-style) means its correct functioning can easily be verified on new browsers and platforms

Cons
 –              All JavaScript variables and arrays are functions (also known as KO observables) as opposed to Angular. This can be a little confusing at first for some people. But it should be noted that all native JavaScript array functions like splice(), indexOf(), push() etc. are implemented by Knockout and may be used on KO observables.
–              HTML views can get messy as declarative bindings increase. This can be weakened to some extent through the use of custom bindings, computed observables and by attaching events to the DOM using jQuery instead of using the data-bind attribute.
–              Additional functionality like data-access and url-routing are not included. If you are looking for an end to end solution that offers a complete toolbox of common web-app functionality, you should probably check out such frameworks as Angular or Ember.

Knockout VS jQuery

Knockout.js is not a replacement of jQuery (as well as of Prototype, or MooTools). It doesn’t attempt to provide animation, generic event handling, or AJAX functionality (however, Knockout.js can parse the data received from an AJAX call). Knockout.js is focused only on designing scalable and data-driven UI.

Moreover Knockout.js is compatible with any other client-side and server-side technology. It also acts as a supplement to the other web technologies like jQuery and MooTools.

Although you will need to use Knockout with jQuery at the same time, in some cases like animated transitions, Knockout itself doesn’t depend on it. Another thing you need to understand is that Knockout doesn’t compete with jQuery – they both do excellent job; each one in its own direction. And if you want to get the most benefits you should use them together.

Knockout is the simplest of all the frameworks as well as one of the smallest. It does not claim to be able to solve all your problems, but it does claim to do a few useful things and do it better than the alternatives. In the words of Knockout creator Steve Sanderson, it is “low risk” because its uses are focused and it is compatible with any other technologies you are using and you can use it in a very small part of your application or your entire application. For someone who wants to take their project to the next level without too much risk, knockout is a great choice.

Hope you found the information in this article useful. Your valuable feedback, question, or comments about this article are always welcome! :)

Yuliya Tolkach

Yuliya Tolkach
Yulia.Tolkach@altabel.com
Skype ID: yuliya_tolkach
Business Development Manager (LI page)
Altabel Group – Professional Software Development

There is no doubt that mobile industry is one of the most intensely growing nowadays. Any product that earlier used to be desktop or web is moving towards going mobile. Everyone is taking designing experiences for smaller screens seriously. As for the web, we’re seeing swarms of recently updated sites that are employing responsive design or more mobile-friendly layouts. This is quite critical, especially when you consider that accessing the web from mobile devices is on track to surpass desktop usage in a just a year or two.

With so many mobile apps/sites out there you have to do all it takes to deliver a good mobile product that will be competitive on the market. The key input for success here often is conditioned by the convenience of mobile services. You have to start predicting what the customer wants to see when they try a mobile application or website. The use of mobile context in delivering mobile experience is just one of the big challenges that application developers face. Here’s a number of the most important challenges we see.

1. Mobile Context

There has always been emphasis on context – the idea of being sensitive to where users might be and what they might be doing at the same time that they’re using your app/site. Is a user in line at the grocery store or on the living-room couch? Is a user connected to the Internet via Wi-Fi access, with fast page loads, or an infuriatingly weak Internet connection? Are both of the user’s hands holding the device in landscape orientation, or is the user using only the right thumb to navigate the interface in portrait mode? We have to think about all of this. Basically the customer’s mobile context consists of:

Preferences: the history and personal decisions the customer has shared with you or with social networks.
Situation: the current location, of course, but other relevant factors could include the altitude, environmental conditions and even speed the customer is experiencing.
Attitude: the feelings or emotions implied by the customer’s actions and logistics.

Getting a good contextual awareness will require collecting information from many sources. For instance it could be mobile device itself, the local context of devices and sensors around them an extended network of things they care about and the historical context of their preferences. Gathering this data is a major challenge because it will be stored on multiple systems of record to which your app will need to connect.

2. Device Proliferation

Another challenge facing mobile developers is device proliferation. It looked like mobile app development process was pretty well defined: build your app, make sure it looks pretty on a 4-inch smartphone and a 10-inch tablet, then submit it to an app store. Most app developers prioritized a few popular devices, such as the iPhone, the Samsung Galaxy S III and the iPad.

It’s not quite that easy now, and it’ll be much tougher in the near future. Picking the most popular devices will become more of a challenge as device types and platforms proliferate. Google and Apple already support tablets of different sizes and, with Windows 8 now shipping, developers can expect to find a whole range of larger touch-sensitive devices, such as Hewlett-Packard’s Envy series.

3. Voice rather than Touch

There are a lot of situations where you would want to build voice input into your app today. For a running or fitness app, a phone is likely to be strapped to a person’s sweaty arm. The same is true while driving. Modern applications are to let people use their devices while keeping their eyes and hands off it.

4. Hybrid Applications

With each release, popular mobile operating systems get better at supporting HTML5 and its attendant APIs. That capability will let companies reuse more code across multiple devices, which will be important in keeping app development costs down taking into account the proliferation of connected devices and form factors.

As a result we could expect that more companies will turn to web technologies with a centralized code base for core components of their connected applications. That centralized code is likely to be a combination of HTML, JavaScript and CSS, because the vast majority of devices will support it. Much of this HTML5 will be delivered as hybrid apps, which mix HTML code into a native container and use native code for navigation and platform specific integration. These hybrid apps will get more sophisticated and capable as a result. We’re already seeing compelling enterprise applications built with the hybrid approach.

5. Cloud Powered Mobile Applications

With the power of the cloud, the mobile application market is about to change radically. Several industry analysts predict that mobile applications will gradually move to the cloud and move away from being installed and run directly from the handsets themselves. Instead, cloud powered mobile applications are accessed and executed directly from the cloud through a mobile web browser interface and several technologies facilitating this change are already available. HTML5, for example, is necessary for enabling caching on the handset, so that users will experience uninterrupted service levels despite fluctuations in network service delivery.

Cloud powered mobile applications are not limiting their choice to one platform. Application developers also have real advantages from mobile cloud computing. The largest benefit is that it allows them to have access to a larger market. This means developers will have a much wider market which means they can bypass the restrictions created by mobile operating systems. But with greater developers’ power comes greater responsibility for security and performance. Expect more developers to be on call for application support in the new model, using triage to handle defects and investigate degradation to production services. Those tasks have traditional been the domain of systems administrators. Expect IT operations personnel to become integrated into development teams and to start their work at the inception of an idea.

I think the challenges mentioned are some of the most important ones. What are the challenges you have already faced in the mobile development? Even more interesting to hear about the challenges you are envisaging for the near future! As usual many thanks for sharing your thoughts!

Aliona Kavalevich

Aliona Kavalevich
Aliona.Kavalevich@altabel.com
Skype ID: aliona_kavalevich
Business Development Manager (LI page)
Altabel Group – Professional Software Development


%d bloggers like this: