Pair program with me! profile for carousel at Stack Overflow, Q&A for professional and enthusiast programmers

12/13/2012

Public API -s reference on the web


Today I found awesome website:

http://www.programmableweb.com/


It's a directory, a news source, a reference guide and a community.
So if you are a web-developer ( front or back ) - it is a great resource for exploring.

Happy coding.

12/11/2012

What is thick ( fat ) client ?


This is one of the things that all front-end web developers should know:
fat client (also called heavyrich, or thick client) is a computer (client) in client–server architecture or networks that typically provides rich functionality independent of the central server. Originally known as just a "client" or "thick client" the name is contrasted to thin client, which describes a computer heavily dependent on a server's applications.
A fat client still requires at least periodic connection to a network or central server, but is often characterised by the ability to perform many functions without that connection. In contrast, a thin client generally does as little processing as possible and relies on accessing the server each time input data needs to be processed or validated.

12/10/2012

Underscore.js

Underscore .js (_) is a small library of helper methods that deals with low level data-manipulaltion. It offers functions similar to some other languages ( Python, Ruby). Javascript lacks some of this methods, so it is really usefull to have them as a part of your toolset. Underscore is built in Jquery, so you are probably using some of these methods already ( $.extend(), $.map(),$.each()...).

Here's a quick demo how to use $.extend() method:


    var firstName = {first: "Mickey"}, // create a first object
         lastName = {last: "Mouse"}; // create a second object

    var E = $.extend(firstName, lastName); // call extend method /* with jquery, and pass objects to be merged. First one is target,and second one is a source of properties */


    dir(E); /* see new object in a chrome developer console ( or Firebug ).*/


If you want to use library outside of jquery, for a custom project you can download it here: http://underscorejs.org/

Note: you'll have to include jquery in your page, either from a local file or from CDN.

Happy Coding.

12/08/2012

Should web developers learn algorithms ?

Algorithms are a big puzzle to web-developers ( if they are not graduate CS ). There are lot of  online discussions about them. Should we learn it or not ? My opinion is that we shouldn't try to master them, cause that leads to frustration.
Algorithms can be very complex, and much of them are unnecessary in everyday web programming. Since web languages are mostly  scripting and interpreted, there is really no need to learn about complex memory allocation, garbage collection and other low-level things. Instead, we should adopt some of the major concepts that can be found in every programming language.
These concept deals with control flow, data manipulation and in general they can help you to think and code more productively and efficiently.
Nicholas Zakas has a page with implementation of classic computer science algorithms in Javascript. It's great because here you can find a collection of classic and well known algorithms, together with  great explanation and implementation.

http://www.nczonline.net/blog/tag/computer-science/

Happy coding.

12/04/2012

The role of functions in Javascript language

Mastering functions is very important skill for Javascript developer. Compared to other composite data types ( object and array ), functions in JS have a wide application and can be used in many ways. 

So functions can:

- be called and invoke a code inside of their body
- receive arguments
- treated as object ( with properties )
- tied to a variable and passed around 
- provide scope and privacy
- act like a constructor ( and create instance of object )
- provide a framework for procedural programming

It is important to mention that JS is class-less language, and lot of function behaviour is in the goal of providing  classical paradigms and concepts. For example, function as constructor is a concept directly inherited from a classical object-oriented paradigm. In JS you don't have to use constructors, but they are present. One more example is a way that JS deals with privacy. In classical OO languages, privacy is provided through classes, and all instances share same privacy state like their parent class ( mostly ). In JS privacy is provided through functions. Concept of closures, which are functions nested inside of another functions, is a very powerfull technique that is widelly used by a lot of developers. David Flanagan.

If you wanny learn more about functions and JS in general, I would recommend Javascript patterns, which is a book written by Stoyan Stefanov - Yahoo web-developer. And if you are total novice with language, definitely read Javascript: The Definitive Guide by David Flanagan.

Happy coding.

12/02/2012

Application architecture ( clarification )

So I was trying to figure out what is the difference between architecture and design in terms of programming ( and especially Javascript ).

Here is some clarification, that help me a lot:

Architecture is about bigger picture, and it stands on a higher level then design. Architecture is about structure, it provides framework, it is about strategy.Architecture answers to what and where questions.

In Javascript architecture is usually provided through objects and functions.
Object are containers that holds pieces of data together. You can put whole application in one object and create basic structure.
And functions can act like a architecture creation. For example, when working with jquery, it is common to wrap your code in an annonymous function ( and provide basic structure). Functions can provide more complex architecture frame, due to their nature of beeing both  - object and a function.

Architecture and design are closely tied, wherever you find some structure, you will find some functionallity which is the responsibillity of design.
More on design in the next post.
Here is one good link from stackoverfow that bring's a light on that topic: http://stackoverflow.com/questions/704855/software-design-vs-software-architecture

Happy coding.