Development on Various Platforms
11.7K views | +2 today
Follow
Development on Various Platforms
Your new post is loading...
Your new post is loading...
Rescooped by Ertunç Efeoğlu from JavaScript for Line of Business Applications
Scoop.it!

Explorations In Automatically Fixing JavaScript Linting-errors

Explorations In Automatically Fixing JavaScript Linting-errors | Development on Various Platforms | Scoop.it

FixMyJS (by Josh Perez) was created to try solving this problem. It aims to automatically fix linting errors in a non-destructive way. To an extent, it achieves this goal.

Under the hood the module uses Esprima for source parsing and Escodegen (from the Mozilla Parser API AST) to generate it back. While any form of automation code transformation should be approached with a healthy dose of skepticism, FixMyJS is able to handle fixing basic JSHint errors fairly well. Some of what it supports includes:

Adding missing semicolonsEnforcing camelCase and snake_case conventionsAdding curly braces to statementsRemoving debugger statementsEnforcing single and double quite stylesAdding the radix parameter to parseIntDot notation conversionHandling extra trailing commas

and a few other common linting issues.


Via Jan Hesse
more...
No comment yet.
Rescooped by Ertunç Efeoğlu from JavaScript for Line of Business Applications
Scoop.it!

JavaScript has a Unicode problem

JavaScript has a Unicode problem | Development on Various Platforms | Scoop.it

The way JavaScript handles Unicode is… surprising, to say the least. This write-up explains the pain points associated with Unicode in JavaScript, provides solutions for common problems, and explains how the upcoming ECMAScript 6 will improve the situation.


Via Jan Hesse
more...
No comment yet.
Rescooped by Ertunç Efeoğlu from JavaScript for Line of Business Applications
Scoop.it!

Axel Rauschmayer: JavaScript inheritance: beyond the basics

After giving a brief overview of JavaScript inheritance basics, this talk delves into advanced topics and answers questions such as the following ones:

* What is the difference between constructor inheritance and instance inheritance?
* What is the property `constructor` about?
* How does the `instanceof` operator really work?
* How does one reference a super-property in JavaScript?
* What is the `__proto__` property? Does it have a future?
* Will JavaScript ever have classes? How would they work?
* How do I implement a type via an object instead of via a constructor function?


Via Jan Hesse
more...
No comment yet.
Rescooped by Ertunç Efeoğlu from JavaScript for Line of Business Applications
Scoop.it!

A Look Into How Parameters Are Passed In JavaScript

A Look Into How Parameters Are Passed In JavaScript | Development on Various Platforms | Scoop.it

I recently came across a question on StackOverflow about how JavaScript handles parameters, if they are passed by value or by reference. There seemed to be a lot of confusion and misinformation about what is actually happening behind the scenes.

TLDR; All arguments are passed by value in JavaScript, however, when dealing with non-primitive datatypes like objects and arrays a variable is created that points to the location of the object memory that is then is passed into the function. This means that changes to the variable inside the function will affect the original object's values. Once the argument is reassigned (e.g. arg = {} ) the variable now has the location of the new object in it so the original variable is no longer changed when the value changes.


Via Jan Hesse
more...
No comment yet.
Rescooped by Ertunç Efeoğlu from JavaScript for Line of Business Applications
Scoop.it!

Functional Refactoring in JavaScript

Functional Refactoring in JavaScript | Development on Various Platforms | Scoop.it

When discussing functional programming we often talk about the machinery, and not the core principles. Functional programming is not about monads, monoids, or zippers. It is primarily about writing programs by composing generic reusable functions. This article is about applying functional thinking when refactoring JavaScript code.


Via Jan Hesse
more...
No comment yet.
Rescooped by Ertunç Efeoğlu from JavaScript for Line of Business Applications
Scoop.it!

Javascript Modules, AMD, and the road ahead.

Javascript Modules, AMD, and the road ahead. | Development on Various Platforms | Scoop.it

There are many design patterns used in Javascript and I would recommend taking a look at Javascript Patterns by Stoyan Stefanov for a full introduction to the most widely used patterns. Of the design patterns available, the Module pattern has gotten the most recognition in the past few years thanks in part to the maturation of the module pattern via commonjs as well as the wild success of node.js.

 

The Module Pattern

In a nutshell the module pattern allows you to create code that can expose a public API while safe guarding private variables and methods behind a pseudo blackbox.

 

The future looks bright

We’ve looked at the basic Module pattern and seen how to use it to create some really powerful Javascript. We then took a look at how AMD works and how we could easily change our code to build our modules following the Commonjs specification for asynchronous modules, lastly we took a look at the bleeding edge harmony modules specification. I find that it is easy to see the beauty of where ECMAscript 6 is heading, with respect to modules, when you take a look back at where we’ve already been and how we’ve evolved up to this point.


Via Jan Hesse
more...
No comment yet.
Rescooped by Ertunç Efeoğlu from JavaScript for Line of Business Applications
Scoop.it!

JavaScript FUNdamentals

JavaScript FUNdamentals | Development on Various Platforms | Scoop.it

Programming languages like BASIC, Python, C has boring machine-like nature which requires developers to write extra code that’s not directly related to the solution itself. Think about line numbers in BASIC or interfaces, classes and patterns in Java.

On the other hand JavaScript inherits the best traits of pure mathematics, LISP, C# which lead to a great deal of expressiveness (and fun!).

JavaScript allows programmers to focus on the solution/problem rather that to jump through hoops and API docs.

* Loose Typing
* Object Literal Notation
* Functions
* Arrays
* Prototypal Nature
* Conventions
* Modules
* “this” Keyword
* Pitfalls
* Further Learning

 


Via Jan Hesse
more...
No comment yet.
Rescooped by Ertunç Efeoğlu from JavaScript for Line of Business Applications
Scoop.it!

Implementing a cross-browser event handling system

Implementing a cross-browser event handling system | Development on Various Platforms | Scoop.it

JavaScript, in the browser, is an event-driven programming language – with no consistent event handling support. While adding and removing listeners might work in almost all JavaScript-enabled browsers, triggering events, to this data, has been a nightmare for many JavaScripters out there and I’m no exception.

While I’ve been working on Hilo a few months ago, I had to deal with this situation. And the thing which I came up with only worked in a few modern browsers. It did not work in Internet Explorer, no wonder. Even after a few days of peeking into other libraries I could not implement a consistent system, whatever the reason might be. Recently I started rewriting Hilo all over again. And as before, I had to deal with those events. As I already had a pretty bad experience implementing an event handling system, this time I wanted to do it the right way and the modern way whatsoever.

I went on and made addEvent and removeEvent methods which are pretty easy to do and then I wrote this code and started at it for more than 60 seconds…


Via Jan Hesse
more...
No comment yet.
Rescooped by Ertunç Efeoğlu from JavaScript for Line of Business Applications
Scoop.it!

ECMA5 approach to building JavaScript frameworks

ECMA5 has given JavaScript a number of new ways to define and manipulate objects. In this session, attendees will learn how to combine Require.js and ECMA5’s object manipulation functions to create an inheritance model similar to class-based languages.


Via Jan Hesse
more...
No comment yet.
Rescooped by Ertunç Efeoğlu from JavaScript for Line of Business Applications
Scoop.it!

Scaling Isomorphic Javascript Code

Scaling Isomorphic Javascript Code | Development on Various Platforms | Scoop.it

Design patterns are the bread and butter of application development. They encapsulate and outline the concerns of the application and the environment of the in which it exists. Between the browser and the server these concerns can vary widely:
* Is the view ephemeral (e.g. on the server) or long-lived (e.g. in the browser)?
* Is the view reusable across different use-cases or scenarios?
* Should the view be annotated with application-specific tags or markup?
* Where should the bulk of the business logic reside? (in the model? in the controller?)
* How is the application state persisted or accessed?
Lets explore some of the existing patterns and how they answer these questions:
* Model-View-Controller
* Model2
* Model-View Presenter and Model-View-ViewModel
* Modern Javascript Implementations
* Real-time Implications
* tl;dr? Introducing Resource-View-Presenter
* Conclusion


Via Jan Hesse
more...
No comment yet.
Rescooped by Ertunç Efeoğlu from JavaScript for Line of Business Applications
Scoop.it!

Functional Programming Using JavaScript

Functional Programming Using JavaScript | Development on Various Platforms | Scoop.it

Programmers use different techniques to achieve abstraction and hide complexity e.g Object Oriented techniques does exactly that. They do so because programs grow at fast pace and they quickly become complex. Humans are intelligent but they can handle complexity to a particular level. So basically Functional programming is also used to hide complexity of programs using functions.

Here the word “functions” is important because you will be hiding complexity using functions. Now I will explain some important functional programming concepts. First you need to understand what’s Function Application?

In some pure functional languages, there’s no concept of function call. We actually apply a function to data instead of calling it. In JavaScript you can actually both call or apply a function. Let me give an example of that...


Via Jan Hesse
more...
No comment yet.
Rescooped by Ertunç Efeoğlu from JavaScript for Line of Business Applications
Scoop.it!

syringe - An ultra-lightweight dependency injection framework for JavaScript

syringe - An ultra-lightweight dependency injection framework for JavaScript | Development on Various Platforms | Scoop.it

Syringe is a teeny-tiny JavaScript dependency injection framework that allows you to dynamically assign data contracts to your functions and methods. No more worrying about passing information directly, indirectly, or relying on the lexical scope as Syringe can vaccinate your operations ahead of time!

Now, let's roll up our sleeves and begin shall we?


Via Jan Hesse
more...
No comment yet.
Rescooped by Ertunç Efeoğlu from JavaScript for Line of Business Applications
Scoop.it!

Testable JavaScript

Testable JavaScript | Development on Various Platforms | Scoop.it
Mark Ethan Trostler conducts a tutorial on getting started with JavaScript testing.

Via Jan Hesse
more...
No comment yet.
Rescooped by Ertunç Efeoğlu from JavaScript for Line of Business Applications
Scoop.it!

Avoiding The Quirks: Lessons From A JavaScript Code Review

Avoiding The Quirks: Lessons From A JavaScript Code Review | Development on Various Platforms | Scoop.it

Code reviews go hand-in-hand with maintaining strong coding standards. That said, standards don't usually prevent logical errors or misunderstandings about the quirks of a programming language. Even the most experienced developers can make these kinds of mistakes and code reviews can greatly assist with catching them.

Often the most challenging part of code reviews is actually finding an experienced developer you trust to complete the review and of course, learning to take on-board criticism of your code.

The first reaction most of us have to criticism is to defend ourselves (or in this case, our code) and possibly lash back. While criticism can be slightly demoralizing, think of it as a learning experience that can spur us to do better and improve ourselves because in many cases, once we've calmed down, it actually does.

It can also be useful to remember that no one is compelled to provide feedback on your work and that if the comments are in fact constructive, you should be grateful for the time spent on the input (regardless of whether you choose to use it or not).


Via Jan Hesse
more...
No comment yet.
Rescooped by Ertunç Efeoğlu from JavaScript for Line of Business Applications
Scoop.it!

JS VM Engineers

JS VM Engineers | Development on Various Platforms | Scoop.it

JavaScript VM Engineers playlist - talking about the core


Via Jan Hesse
more...
No comment yet.
Rescooped by Ertunç Efeoğlu from JavaScript for Line of Business Applications
Scoop.it!

jTypes - emulate classical inheritance where objects are defined by classes

jTypes - emulate classical inheritance where objects are defined by classes | Development on Various Platforms | Scoop.it
jTypes is the most comprehensive and robust JavaScript library for overcoming differential inheritance with prototype-based objects.

 

jTypes will provide you with the ability to develop robust, modular, and scalable application libraries in JavaScript using encapsulation, inheritance, and polymorphism. What exactly does that mean? You know all those keywords from languages such as C++ or C# that you started missing quite badly after you transitioned to JavaScript? You know what we're talking about; all those modifiers of classical inheritance such as virtual, abstract, and override or private, protected, and public that gave you so much more control and freedom with your libraries. Well jTypes lets you use those keywords in JavaScript, so you can develop extremely powerful and robust web applications using the principals of classical inheritance.


Via Jan Hesse
more...
No comment yet.
Rescooped by Ertunç Efeoğlu from JavaScript for Line of Business Applications
Scoop.it!

Applicative Programming In JavaScript With lodash.js

Applicative Programming In JavaScript With lodash.js | Development on Various Platforms | Scoop.it

n general, applicative programming is the pattern of defining a function that takes a function and then invokes that function for each element in a collection/list. To apply this definition of applicative programming to JavaScript, you will need to know a little something about first-class functions before we dive in. So, let's start there.

JavaScript has first class functions. This means that instances of the Function constructor can go and do anything any value in the language can do because functions in JavaScript are values.


Via Jan Hesse
more...
No comment yet.
Rescooped by Ertunç Efeoğlu from JavaScript for Line of Business Applications
Scoop.it!

Most Useful JavaScript Tips And Tricks For JavaScript developers

Most Useful JavaScript Tips And Tricks For JavaScript developers | Development on Various Platforms | Scoop.it

Here I collected some JavaScript Tips And Tricks and JavaScript Best Practices which can be used in our daily projects or bookmark it for reference purpose.

This includes some useful JavaScript snippets too.

* [] is better than “new Array();”
* Append an array to existing Array in JavaScript
* Check If An Object Is Array in JavaScript
* Truncate array in JavaScript
* JavaScript array to CSV
* Remove array element by Index or value in JavaScript
* Capture browser close Event
* Redirect webpage in JavaScript
* Declare Variables Outside of the For Statement
* Shorten the JavaScript Code snippets
* Conditional Operator in JavaScript
* Use OR (“||”) operator and AND(“&&”) operators in JavaScript


Via Jan Hesse
more...
No comment yet.
Rescooped by Ertunç Efeoğlu from JavaScript for Line of Business Applications
Scoop.it!

Learning from Javascript Libraries

Learning from Javascript Libraries | Development on Various Platforms | Scoop.it
Learning from Javascript libraries by Trevor Landau is a talk on interesting patterns that popular libraries like jQuery, Backbone, Angular, and more use to solve problems.

jQuery runs on approximately 50% of all websites and is the de facto standard for DOM manipulation. Most front end developers use it, but how well do they understand what’s happening when they use the API? How does a library take on the problems it solves? What are the reasons behind some of the techniques it uses? Observing the code under the hood of a library/framework is a fantastic way to become a better developer and thereby user of that library/framework. Better understanding of design patterns in some of the most popular libraries can open opportunities to contribute and be a better open source citizen.


Via Jan Hesse
more...
No comment yet.
Rescooped by Ertunç Efeoğlu from JavaScript for Line of Business Applications
Scoop.it!

Searching using Array.prototype.reduce

Searching using Array.prototype.reduce | Development on Various Platforms | Scoop.it

Searching for a particular element in a JavaScript array is often carried out using a typical iteration. In some cases, forEach and some can be used as well. What is often overlooked is the potential use of Array.prototype.reduce to perform such an operation.

Let’s take a look at the following problem: find the longest string in an array of strings. An imperative solution looks something like the following code (usingforEach may simplify the loop but the idea remains the same): ...

A version which relies on reduce is a single statement: ...


Via Jan Hesse
more...
No comment yet.
Rescooped by Ertunç Efeoğlu from JavaScript for Line of Business Applications
Scoop.it!

Partial Application in JavaScript

Partial Application in JavaScript | Development on Various Platforms | Scoop.it

Unless you've used a functional programming language such as ML or Haskell, concepts such as partial application and currying may be foreign to you. Since JavaScript supports first-class functions, once you understand these concepts, you can put them to use in your code.

Whether writing code just for yourself or presenting an API to your users, it's often helpful to create a more specialized function as a "wrapper" to a more generalized function if you expect to be performing a task repetitively. One way to do this would be to just define the functions manually.


Via Jan Hesse
more...
Mickael Ruau's curator insight, October 9, 2013 5:28 AM

Concepts de programmation  fonctionnelle utilisables en javascript.

Jan Hesse's curator insight, October 12, 2013 4:39 AM

more current post at: http://benalman.com/news/2012/09/partial-application-in-javascript/

Oriol Lluch's curator insight, October 15, 2013 4:19 PM

Great Article to understand the concept behind functions in Javascript

Rescooped by Ertunç Efeoğlu from JavaScript for Line of Business Applications
Scoop.it!

Have Javascript Frameworks Made Developers Dumber?

Have Javascript Frameworks Made Developers Dumber? | Development on Various Platforms | Scoop.it

You can’t argue that Javascript frameworks have been an incredibly massive help in the Javascript community. Thanks to John Resig and jQuery, we have many things to be grateful for including helping standardise annoying browser quirks and abstracting complicated methods of which require tens of lines of code. As much as Javascript frameworks have helped, have they made developers dumber?

If you are only learning the framework, are you learning the language it is built on-top of? You kind of are, I mean jQuery doesn’t completely replace Javascript with its own methods and ways of doing things, you still set arrays like you normally would, you still set variables, setTimeout and setIntervals, closures and other things in standard Javascript syntax, but is it enough? I am willing to bet there are web developers out there right now who wouldn’t be able to read half the things in the jQuery source code.


Via Jan Hesse
more...
No comment yet.
Rescooped by Ertunç Efeoğlu from JavaScript for Line of Business Applications
Scoop.it!

Tips for using window in JavaScript

Tips for using window in JavaScript | Development on Various Platforms | Scoop.it

In web browsers, window refers to an object that contains the global variables. This blog post explains how it works and when to use it.

* The global object and window
* Use cases for window
* The future of global variables
* Conclusion

 

We have seen several use cases for window. But you can normally achieve the same result by treating a global variable as a variable and not as a property of window. This is the recommended way of doing it, because your code becomes slightly more flexible and because the global scope will become less used in the future.


Via Jan Hesse
more...
No comment yet.
Rescooped by Ertunç Efeoğlu from JavaScript for Line of Business Applications
Scoop.it!

How To Use .call(), .apply() and .bind() In Javascript

Back in March I wrote a post "Understanding Constructor Functions in Javascript and This keyword" in which, while explaining the concept of this in Javascript, I stated that it is impossible to tell what the this keyword references by just looking at the function definition. You only get to decide or know what the this keyword refers to, by the way the function is called. Call the function one way, and have this refer to one object, call it another way and you can have it refer to a totally different object. Showing that in Javascript, this is a context-indicator.

I mentioned that normal calling of a function (i.e. have a function fx, call it via fx()) and calling with the new keyword i.e. (new fx()) are some of the various ways to call a Javascript function and have the this keyword switch context.

There are 3 other ways a Javascript function can be called with the ability to determine what this keyword references. call, apply and bind. To be technically specific:Function.prototype.call, Function.prototype.apply, and Function.prototype.bind.


Via Jan Hesse
more...
No comment yet.
Rescooped by Ertunç Efeoğlu from JavaScript for Line of Business Applications
Scoop.it!

Classless JavaScript

As JavaScript developers, or even web developers as a whole, we seem terrified by the thought of direct usage. No technique or idea seems to be considered “legit” until it has been abstracted by several layers of syntactic sugar and, potentially useless, fluff.

One of the common abstractions is the addition of “classes” to JavaScript; prototypical inheritance isn’t good enough for us lot by the looks of things. We seem to crave the features of other languages when our language of choice isn’t really built for them, it’s built in a different way and probably shouldn’t have classical inheritance principals forced down its VM / throat.

So what if we worked with JavaScript in a more natural way? First, what would be more natural? Personally I believe that, like the underlying language, everything should revolve around objects; we create and manipulate these malleable entities instead of trying to lock things down and restrict our data.

This idea lends its self exceptionally well to functional programming and the actual VM, which no longer needs to mess with prototype chains or any other form of inheritance for that matter. It’s as raw as JavaScript usage can get, it’s kind of like C structs (although nothing like them at the same time) and I think it’s pretty elegant.


Via Jan Hesse
more...
No comment yet.