Javascript: A Practical Introduction

practical-introduction-to-javascript

Javascript is one of the most trending and highly paid language in the tech industry right now.In my early days of my career, I struggled with javascript and soon realized that knowledge of implementing a slider or a plugin is not enough and I have to improve my basics to play with javascript. This article nucleus is “Practical Introduction to Javascript“.

Let’s begin with the very basic.

Window vs Document
Window: In very simple words “every tab is a window”. For example, window.close works when we close the tab.
Document: Whatever user see inside the tab is a document. For example, document.ready works when the page is fully loaded.

Alert vs Console.log
One of the worst and irritating way of checking output and debugging is “alert”. Javascript has got “console.log” function which is used to output data in the console of the browser.It has following benefits:

  • doesn’t freeze web page, it is non-blocking
  • shows very large output easily
  • easy to understand and explore insight of javascript objects

Validation
Generally, first thought comes in a fresher mind after hearing validation is form validation but here I explain you about “Variable Validation“. A variable can store form value, a random string, an array, an object or any value. Consider a scenario where we have to validate a variable and confirm that it contains some string value then the process I prefer is follows:

  • check whether the variable value is undefined or not
  • check whether the variable value is null or not
  • check for string length

Below function will solve the above problem with ease.

Array vs Object

When i take interviews, 95% of freshers don’t know the difference between javascript arrays and objects and believe me these two are the most used data type in javascript while developing fronted of any application.
Arrays can be “single dimensional only” in javascript. Eg.

Looping

Adding values to array and object

Above I explained some of the practical tips of javascript which I thought every newbie must learn to grow and hope these will be helpful for every developer thinking of learning javascript. Got any question, ask me now.

Best PHP RESTful Micro Frameworks

php-micro-frameworks

What are Micro Frameworks?

Before discussing which are the “Best PHP RESTful Micro Frameworks” let begin with the concept of micro-framework. Micro Frameworks is a term used to represent a small set of code and modules that are designed to do only basic tasks and functionality and at the same time they are highly extensible.These frameworks comes with less components than full stack framework but they have several libraries and patterns which are required to make a project of good quality and scalable.
Don’t think that “micro” represent for small projects, it only means “Framework bundled with less components”.

Best PHP RESTful Micro Frameworks

1. Silex

  • One of the fastest micro-framework
  • Built on top of Symphony components
  • Great documentation and community support
  • Good for large projects
  • Follows Symfony2 HTTP conditions
  • Automated functional tests

2. Slim

  • Super fast and extremely light-weight
  • Good documentation
  • Great community
  • Lots of tutorials on YouTube and on other websites
  • Lazy loading with 3rd party implementation
  • Bundled with middleware, caching, encryption of cookies

3. Lumen

  • Zero configuration
  • Excellent documentation
  • Ultra-fast micro framework
  • Good 3rd party support
  • Easily upgradable to laravel
  • Bundled with encryption, middleware, unit testing, caching,queuing and sql-nosql support

4. Phalcon

  • Blazing fast
  • Provides very high performance
  • Written in C-language
  • Compiled for better performance
  • Can handle more requests per second

5.Bullet PHP

  • Little learning
  • Unlimited flexibility
  • Flexible routing
  • Nested closure routing system

That’s all for today folks, try one of the above frameworks and do share your experience with me.

What’s new in PHP 7

Finally the most awaited version of php ie. PHP 7 is officially released.It’s been a long journey to make it bug free and efficient, 8 release cnadidates and finally it’s available to deploy.php-7

PHP 7 bundled with some massive improvements in speed and memory consumption, to be precise twice fast from php 5.6. I would like to congratulate the contribution team for their great effort.

PHP 7.0.0 comes with a new version of the Zend Engine, numerous improvements and new features such as

  • Improved performance: PHP 7 is up to twice as fast as PHP 5.6
  • Significantly reduced memory usage
  • Abstract Syntax Tree
  • Consistent 64-bit support
  • Improved Exception hierarchy
  • Many fatal errors converted to Exceptions
  • Secure random number generator
  • Removed old and unsupported SAPIs and extensions
  • The null coalescing operator (??)
  • Return and Scalar Type Declarations
  • Anonymous Classes
  • Zero cost asserts

PHP revolution begins now with the fastest version of php, get ready to explore the new things with great speed.
Check the complete list of features at php.net