Javascript Creation Patterns

Javascript Object Creation Patterns

I’ve taken a long break due to consulting work and a few lazy summer days. I’ve also taken a long break from writing any PHP but I’m itching to getting back to writing more PHP related articles. I just haven’t seen anything new with PHP lately except for some frameworks I haven’t dabbled with yet like Laravel, CodeIgniter and others. Perhaps I’ll find interest in these at a later time – it might worth dissecting these architectures, there’s always something new to learn.

Continue reading “Javascript Creation Patterns”

Object.create vs the new operator in Javascript

Object.create() vs the new operator in Javascript

One of the more advanced topics in Javascript is the distinction between the Object.create() and the new operator when constructing new objects. More than that, Javascript being a client side language – is unlike other server side languages, compiled or interpreted.

As a result Javascript has some weird parts to it putting off some developers to some other more less dynamics languages but drawing in more curious developers to Javascript land. These weird parts shouldn’t be seen as a disadvantage though if you thoroughly spend quality time getting to know Javascript – you can use these new patterns, concepts to your advantage.
Continue reading “Object.create vs the new operator in Javascript”

Javascript – Functional Programming Part 1

Javascript – Functional Programming Part 1

I haven’t covered any advanced topics until now – functional programming in Javascript is an advanced topic in my book. Not only is functional programming an advanced topic, it’s quite special and specific to the Javascript language. Even a well seasoned developer could get a little frazzled by the concept of functional programming – especially those who code in more statically typed languages – like C or Java.

I, myself have mulled over this a long time – especially because I haven’t built any applications using much of functional programming. Frameworks and libraries – yes, but I’m talking about writing my own proprietary code. Programmers unknowingly utilize functional programming all the time – with this, comes closures, prototypical inheritance – other advanced patterns found in our javascript libraries today.
Continue reading “Javascript – Functional Programming Part 1”

Javascript’s call, apply and bind methods

Javascrip's apply, call and bind methods

I’ve been mulling over getting this post up for a while now – simply because functions are a big deal in Javascript. Javascript functions are packed with so many properties, methods and it’s fundamental nature requires some quality time in understanding its features.

There are a few things to keep in mind when dealing with Javascripts call(), apply, and bind methods()

  • call(), apply() and bind() are three methods every function has access too
  • bind() creates a copy of the function object in question
  • call(), apply() and bind() methods are methods that allow an object to point to a different ‘this’ variable when invoked.
  • Common patterns used in conjunction with call(), apply() and bind() are function borrowing and function currying.

Continue reading “Javascript’s call, apply and bind methods”

Javascript’s defer vs async attribute

Javascript’s defer vs async attribute

Flashbacks of vanilla javascript cloud my mind – back when we didn’t have Jquery. All we had was Javascripts’ event listener method to detect whether the entire DOM was loaded before scripts were fired off.

Why was this necessary though? Well, if you’re a developer you very well know – page speed. And back in those days, programmers weren’t so mindful of placing external javascript files – the head section, footer and I’ve seen some sprinkled throughout the body. Not optimal at all – this can have huge negative implications in terms of functionality and speed.

Continue reading “Javascript’s defer vs async attribute”

Fixing a network 404 error using typeof

Fixing a network 404 error using typeof

Javascript’s typeof operator is an essential debugging tool that many young programmers often miss. Countless times I’ve run into situations where my program wasn’t working because either my variable was unnoticeably coerced or I was just completely unaware of a data type. As mentioned in a previous post – a season programmer should know their data types! Another thing a seasoned programmer ought to know is to prevent themselves from being too arrogant – yes, we need help and using the “typeof” operator is there to the rescue.

Continue reading “Fixing a network 404 error using typeof”

Data Structures & Algorithms II

Data Structures & Algorithms II

This is part || of Data Structures & Algorithms using Javascript. I would like to give credit to freeCodeCamp.org for their series of videos covering this topic.

In part I we started off with a simply defining a few data types – an array and a string for storing data in memory. Then we used a “for-loop” to access and manipulate our data structures. Finally we came up with a sequence of steps to test whether a word was a palindrome or not. In part II now, were going to wrap up all that code into what we call a function object.

Functions are a powerful data structure encapsulating your algorithms. Functions also are a good example of “DRY” – Don’t Repeat Yourself.

Continue reading “Data Structures & Algorithms II”

Data Structures and Algorithms in Javascript – Stacks

Data Structures and Algorithms 1 - Stacks

Javascript is a language most developers either overestimate or underestimate – whatever the case, this is what makes Javascript special. Javascript is a dynamic language, it’s abstract and for this reason also prone to instability. Javascript in the last decade has provided developers with a place for inventiveness and innovation.

Lately I’ve been immersing myself into mathematics, physics, chemistry, philosophy and even linguistics. I found my premise to still hold true – that the universe is at a state of decay, of disorder, and mutation. It’s exactly because of mutation that we are able to manage disorder and chaos, so in a sense we are constantly trying to keep up with ourselves as we simultaneously and inevitably push forward into the future.

Continue reading “Data Structures and Algorithms in Javascript – Stacks”

Javascript Debugger Statement

Javascript Debugger Statement

I was working on a behemoth, yeah look it up – the word means monstrous and enormous in size. This project was more on the marketing side, so there were a lot of platforms mixing in with this project, one of them being Hubspot – a marketing software for managing leads. I’ve never worked with HubSpot before, but I was totally game.

In troubleshooting the underlying issue(s), I like to categorize projects like hurricanes – cat1, cat2, cat3, cat4, cat5. This one was a cat4. Partly because it’s history was so vague, the type of project where you’re shooting darts in the dark. But the other half was much simpler – I just had to get familiarized with Hubspot, but this is an entirely different topic. I went off tangent here for a bit. Moving on.

Continue reading “Javascript Debugger Statement”