ANGULAR JS WILL FAIL UPDATE: 2/25/2017

Another reason why Angular js will fail. Not even a year later and the 4th version is already being discussed and developed. Are these guys morons? I suppose angular 1, 1.5 and 2 has failed so badly, that they made an even worse version that was never even released. That’s right, completely skipped angular 3. And now we’re onto 4. By the time I get done writing this update, I might have blinked and missed angular 20. I should hurry up.

I would love to see all those defenders of the past versions come see how stupid (I can’t find any other words) their defensive comments really were. It’s like a sick joke. Within the time it takes to go through college, angular has changed dramatically through its 4 iterations. How are true developers supposed to take angular serious anymore?

Going from JavaScript to typescript and then ECMA 6 or 7 does not help its case to be a great framework. Meanwhile, I’ve completed about half dozen applications / CMS systems on my own using good old JavaScript, jQuery and my good ol’ dispatcher, found here at dispatchjs.com. I still use php 5.6 and mysql 5.6 to manage logic and data. I’m still trying to wrap my head around the complexities of angular 1.x.

Yes, I understand that technology needs to move forward, but you have to follow design rules, even in development. Creating a door without a handle may look trendy, but your average person won’t know what to do when they come face to face. Same with development. Creating a framework that only a few elite can understand is bad practice for the whole development community. Please learn a few lessons from this.

I would love to see angular succeed, but at the pace it’s going… it’s never going to happen. They develop the framework like nothing will change around it, and in one or two years, standards change, morph, or even go away altogether. Perfect example is jQuery. JavaScript has changed a lot since jQuery first came out, but instead of fighting it, jQuery embraced it. You can still use an older version or jQuery, or a new version of jQuery. The compatibility is still there on any major browser. And yes, jQuery might have made some weird decisions along the way, but it’s still standing strong.

Note to the angularjs team: You claim you’re smart, so learn something from this. They won’t. For this reason, Angular js will fail.

ANGULAR JS WILL FAIL UPDATE: 11/19/2016

So, angular 2 is out and it’s not as easily accepted, even into the angular 1 community. A lot of programmers that I know don’t like the additional constraints. Some swear by its ability to handle data on the client side, but for me, it’s still not usable for the web. So, I went ahead and attempted something else. I’ve started work on Dispatch JS. It’s a tool I’ve had around for years, but never really realized the amount of help it provides until just recently when one of my devs came up to me and actually told me that this made his life much easier, since he just doesn’t like to code in JavaScript. Read up on it, and you’ll be surprised by its simplicity.

On a sadder note, I understand why all of these libraries and frameworks are coming out and gaining popularity. Developers that don’t like to code (oxymoron, I know) create these bulky and complex libraries that only benefit certain scenarios, and then they get evangelized by additional lazy developers. I keep running into these developers that just don’t like to write code. No one wants to do the hard work of not only writing code, but writing proper code. Everything has to be abstracted because there’s nothing exciting about writing good quality, properly structured code. It amazes me that these developers survive in the development world. They develop so many constraints that removes all flexibility of developing web pages. I could go on for ever, but this is one of the reasons the angular fan base will be split up between 1 and 2, and then both groups will only get weaker and weaker.

ANGULAR JS WILL FAIL UPDATE: 12/18/2015

Angular JS will fail, if it hasn’t already. It’s almost the end of the year, and the more I see defendants of Angular, the more I think to myself that they have something there. All of my side projects (about a dozen) including a management application found here at ActingShowcase.com do not have a single piece of code from Angular, and I have not suffered. Had I not had something like jQuery, development might have taken me a bit longer. I simply have not seen the need to use Angular at all. The world didn’t end. And, that’s another reason that Angular has failed. It has been losing popularity ever since I brought up the subject. It has been replaced by other “frameworks”, and overall, a lot of people have abandoned it.

The main reasons Angular js will fail are still: too difficult of a learning curve, and uselessness.

ANGULAR JS WILL FAIL UPDATE: 4/3/2015

I feel like I have to clarify for the people who keep trying to explain that jQuery is not angular.js. No duh! I’ve learned that over the years. However, what people don’t seem to understand is that I’m not comparing angular.js to jQuery. I’m comparing the difficulty to lean angular.js to the difficulty to learn jQuery. With difficulty in mind, I read an interesting quote the other day: “More entrepreneurs than ever before will enter this booming market with limited coding ability and they will need something other than [insert preferred framework / language here]”.

And now for the original post…

Angular JS will fail

I’m all about new technology, but just like Steve Jobs had put it, it has to be intuitive. It has to feel comfortable, and easy to learn. This is reference to another one of my posts done here: Angular JS Kinda Sucks. The main reason Angular JS will fail is because it’s too difficult. Honestly, who likes to make their lives more difficult? Not this guy. That’s not to say I’m looking for the easy way out. I believe in hard work paying off, but to make things difficult just for the sake of saying that I did something difficult that I could have done with ease, other ways? That’s just ridiculous. Yes, I can take a boat across the English channel, but why not make it harder and swim it? Other than getting into the book of world records, there really is no practical reason to do so.

Which brings me to the pattern of ever failing technologies. Remember Moo Tools? Prototype? I do too, and sadly, I use NONE of them in any of my projects. jQuery has evolved with the times. It has gotten better and better, and even with its 2.0 release, revolutionized. All while keeping its key ingredient of keeping itself simple to use and logically understandable. Any one of us who struggled with JS before jQuery came along created our own JS libraries to handle mundane tasks of JS. Class lookups, selecting elements, animation, AJAX, etc. We all wondered if there was an easier way to do repetitive work like that. jQuery came along and helped us out in that department. That’s why Angular JS will fail.

Prototype and moo tools tried to be innovative, but they just made things harder. Not only were they not intuitive to use, but referring to the documentation was even worse. Would take hours what jQuery could accomplish in mere minutes.

Don’t look at how many companies use those other tools right now. Wait for it and see how many companies will use those same tools in the future. 5 years, 10 years… jQuery has stood the test of time. And the reason they keep winning is because they cater to the developer, the people who are using the tool the most, and making their lives easier to deal with. It’s a complement to code, not a spaghetti nightmare filled with complexities and high learning curves. Another reason Angular JS will fail.

I remember the first time I built a web page using jQuery. It was easy. It was instinctive. It was amazing. It made want to use more of it. AngularJS unfortunately, did not have that same effect on me.

In the end, I guess it’s to each their own, but too many times I’ve come across reviews that are not so pleasant to read about Angular JS. Even doing a google search on “jQuery sucks” vs “AngularJS sucks” shows that there are more results for the latter, and AngularJS has only been around for a few years, while jQuery, almost a couple of decades. You’d think that there would be more results for jQuery since it’s been around for longer, and that AngularJS has been harbored by Google.

What are your thoughts?

ANGULAR JS WILL FAIL UPDATE: 7/18/2014

As promised, here it is. The first update of my attempt to compare angular vs jQuery. Before you jump in and start yelling at me about how they’re apples and oranges, I wanted to compare the ease of use of angular and jQuery to do something simple. Here are the three tests:

* Load elements onto a page

* User clicks on stuff

* Use AJAX calls to…

* Manipulate DOM elements.

Basically, this explains any sort of application that I’ve ever worked with.

* Program loads

* User clicks around

* A call is made to the “controller” which calculates some things, and returns some “views” to be rendered by the front end

* Swap out HTML elements, add classes, remove classes, etc.

Doing my research, I found out that angularjs does AJAX calls as simple and as easy as jQuery. Here’s some examples:

jQuery:

1

2

3

4

5

6

7

8

9

10

$. ajax ( {

url : '/ajax.php' ,

dataType : 'JSON' ,

success : function ( data ) {

$ ( '#element' ) . html ( data ) ;

} ,

fail : function ( data ) {

alert ( "AJAX failed!" ) ;

}

} ) ;

angularjs

1

2

3

4

5

6

7

8

9

10

$scope. myData = { } ;

$scope. myData . doClick = function ( item , event ) {

var responsePromise = $http. get ( "/ajax.php" ) ;

responsePromise. success ( function ( data , status , headers , config ) {

$scope. myData . fromServer = data. title ;

} ) ;

responsePromise. error ( function ( data , status , headers , config ) {

alert ( "AJAX failed!" ) ;

} ) ;

}

Code Size:

+ jQuery

The very first noticeable thing here is the fact that jQuery has significantly less code. This may not matter right now because it’s a small ajax call, but what happens when you have multiple AJAX controllers (as I’d like to call them)? This can escalate quickly.

Library Size:

+jQuery

If you check your network tab like I do, you’ll also notice that jQuery is about 20% smaller in size. Not a biggie really, just a small win, but still a win.

Maintainability:

= neither / both

While I like how angular binds everything with variable names to make it easier to manage your code, there’s absolutely nothing holding you back from writing well structured jQuery code that will accomplish the same thing. Well structured code is well structured code. I can see either fail at this if either code is spaghetti.

DOM Manipulation:

++jQuery

I wanted to see an example of how angularjs will do DOM manipulation since my app is mostly DOM elements being updated, added, removed. This is where angular fails for me by far! The first google search led me to this jsfiddle link: http://jsfiddle.net/simpulton/E7xER/

Code:

1

var myApp = angular. module ( 'myApp' , [ ] ) ;

myApp.directive(‘myWidget’, function() {

var linkFn;

linkFn = function(scope, element, attrs) {

var animateDown, animateRight, pageOne, pageTwo;

pageOne = angular.element(element.children()[0]);

pageTwo = angular.element(element.children()[1]);

animateDown = function() {

$(this).animate({

top: ‘+=50’

});

};

animateRight = function() {

$(this).animate({

left: ‘+=50’

});

};

$(pageOne).on(‘click’, animateDown);

$(pageTwo).on(‘click’, animateRight);

};

return {

restrict: ‘E’,

link: linkFn

};

});

Notice something awkward? It starts all nice an ajngularjs-y, but the on line 11 of 28, something awesome happens. All of the DOM manipulation is handled by jQuery. Um…….. What? So not only do I have to load a library (jQuery), on top of a heavier framework, and handle my DOM with jQuery still? This is what I was referring to when I first started writing about this article. 8/28 lines are jQuery. And this after a google search on how to manipulate DOM with angularjs. I guess the answer is: use jQuery.

Most of my front end code is ajax calls and DOM manipulation. As most apps are, that’s the norm. And I mean 99.999% of my jQuery is just that. AJAX and DOM manipulation. This is why we’re creating an app in the first place; so we don’t have to constantly reload a page. This is as simple as it gets, and angularjs has failed me.

An app without DOM manipulation is no app. It’s an applet. Forget about building full SPAs without jQuery.

Scalability:

++jQuery

So, I wanted to see how my friends here would fare against some extended code to handle a dynamic AJAX controller with JSON data coming back from the back-end. I won’t post the back-end code since it’s the same code. I just want to see the difference of how angularjs handles the data coming back from the server, and how jQuery handles the same data.

For the purpose of simplicity, here’s the requirements:

* Two links, and two output elements on the page.

* One link loads a random number in the first element.

* The second link loads today’s date in the second element.

angularjs:

—-angularjs

First off, I had to search the documentation… A LOT. And although the documentation lists functions and methods, it doesn’t show examples like jQuery does. How do I know how to use it if there’s no example? Is it assumed that I already know how to use angularjs? Then why is there documentation if I know how to use it? It’s illogical garbage. If you, the reader, can show me how to achieve something similar to the jQuery example below, please, I beg you, show me!

Forget about trying to get an attribute value from an element. The documentation page about attributes… NOTHING. No examples:

https://docs.angularjs.org/api/ng/type/$compile.directive.Attributes

I found “some” answers on stackoverflow.

First, there was this:

1

// Use $observe to observe changes to the attribute:

attrs.$observe(‘data’, function(value) {

console.log(‘data has changed value to ‘ + value);

});

attrs.$set(‘data’, ‘new value’);

Where am I supposed to put this code? In my controller file? My main app file? In the HTML as a script tag? And I don’t care about detecting changes to the attribute. I want to get the value of an attribute. Found something else while browsing:

http://stackoverflow.com/questions/20636537/angularjs-find-element-by-attribute-value

“In AngularJS you won’t do direct DOM manipulation from the controller, you should create a directive to to that. Inside the directive you can use JQuery as you wish.”

……. dandy! So, while really trying to make DOM manipulations, which is the visual feedback that end users require in order to know if something happened… I went back to jQuery.

Binding and directives? How am I going to write them to achieve the dynamic world that jQuery offers through IDs and Class Names? How can one bind anything to achieve that beautiful DOM manipulation? What about rendering new elements (created after DOM ready) on the page that I can continue to manipulate with jQuery using the $(document).on(); function?

jQuery:

1

2

< a class = "ajaxClick" href = "/ajax.php" data- action = "dobuttonone" > Link 1 < / a >

< a class = "ajaxClick" href = "/ajax.php" data- action = "dobuttontwo" > Link 2 < / a >

The backend will return some JSON encoded code with the following structure:

1

2

3

{ "htmls" : { "#elemOne" : 496609 } }

// or

{ "htmls" : { "#elemTwo" : "2014-07-19 00:32:09" } }

The JS that will show the main controller that I was talking about:

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

var manipulateMyDOM = function ( data ) {

for ( htmlElem in data. htmls ) {

$ ( htmlElem ) . html ( data. htmls [ htmlElem ] ) ;

} ;

for ( appendElem in data. appends ) {

$ ( appendElem ) . append ( data. appends [ appendElem ] ) ;

} ;

for ( prependElem in data. prepends ) {

$ ( prependElem ) . prepend ( data. prepends [ prependElem ] ) ;

} ;

for ( updatableElem in data. updatables ) {

$ ( updatableElem ) . html ( data. updatables [ updatableElem ] ) ;

} ;

for ( replaceableElem in data. replaceables ) {

$ ( replaceableElem ) . replaceWith ( data. replaceables [ replaceableElem ] ) ;

} ;

for ( removeElem in data. removes ) {

$ ( document ) . find ( data. removes [ removeElem ] ) . remove ( ) ;

} ;

for ( after in data. afters ) {

$ ( after ) . after ( data. afters [ after ] ) ;

} ;

for ( attrchange in data. attrchanges ) {

for ( value in data. attrchanges [ attrchange ] ) {

$ ( attrchange ) . attr ( value , data. attrchanges [ attrchange ] [ value ] ) ;

}

} ;

for ( classRemoveElem in data. classRemoves ) {

$ ( classRemoveElem ) . removeClass ( data. classRemoves [ classRemoveElem ] ) ;

} ;

for ( classAddElem in data. classAdds ) {

$ ( classAddElem ) . addClass ( data. classAdds [ classAddElem ] ) ;

} ;

}

$(document).on(‘click’,’.ajaxClick’,function(e) {

e.preventDefault();

var $this = $(this);

var _action = $this.attr(‘data-action’);

var _url = $this.attr(‘href’) + ‘?action=’ + _action;

$.ajax({

url: _url,

dataType: ‘JSON’,

success: function (data) {

manipulateMyDOM(data);

}

});

});

And you’re done!!!! The only thing you will have to take care of is to provide elements with the class name “ajaxClick” and add a “data-action” attribute to tell the back-end which function to run. Here’s that PHP file I said I won’t put up. For each one of those links, you just add another function to your ajax file. The binding happens because of the data-action attribute is named the same as the php function. Yes you can obfuscate them if you’d like, but this is just to give you an idea of how code can be structured without the aid of 3rd party frameworks.

What I did above was to build my DOM Manipulator for as much of the functionality that I will use for most of my apps. You can reuse this for every application out there as a plug and play piece of code. Angular cannot make this possible as it can’t do DOM Manipulation on its own.

1

2

$action = isset ( $_GET [ 'action' ] ) ? $_GET [ 'action' ] : 'badcall' ;

call_user_func ( $action ) ;

function dobuttonone() {

// DO PHP STUFF HERE

echo json_encode(array(

‘htmls’ => array(

‘#elemTwo’ => date(‘Y-m-d H:i:s’)

)

));

}

function dobuttontwo() {

// DO PHP STUFF HERE

echo json_encode(array(

‘htmls’ => array(

‘#elemOne’ => rand(111111,999999)

)

));

}

function badcall() {

echo json_encode(array(

‘error’ => true,

‘message’ => ‘No action was provided’

));

}

Now THAT’S good structure. No frameworks necessary. Just good ol’ code. An entire dynamic and scalable application.

I really wanted to compare a real life world example on how I can achieve something with angular that I already have with jQuery. Unfortunately, angular has already failed for me, and I provided examples on how it did so.

To all those angularjs developers who keep claiming how awesome the holy grail of angularjs is, please provide some examples of some work so I can understand what you keep claiming to be real. It’s like a religion, I swear. AngularJS is just awesome. You just have to be immersed in it to realize it. Sounds just like religion.

For me, angular has failed for the following reasons:

* No clear examples of the two most widely used front end features, DOM Manipulation and AJAX calls.

* Most of my development (over 99%) consists of those two features.

* jQuery easily provides AJAX calls, and keeps the code lighter and cleaner than angular.

* Even angular documentation suggests you use jQuery for DOM Manipulation.

* Why even bother using angular if most of my work consists of features easily implemented by jQuery?

I’m sorry to say that my research with angularjs has just strengthened my trust in jQuery to be my library of choice.

Well, actually, I’m not sorry. I’m glad I chose wisely from the beginning.

ANGULAR JS WILL FAIL UPDATE: 10/15/2014

After reading a lot of your comments, I’ve started to realize why the two are apples and oranges. Most angular developers speak of SPAs as something that doesn’t require DOM manipulation. Just numbers or text values changing here and there. Or even replacing your curly brackets with chunks of html within the document.

AJAX can be done by both, fairly easily. So that’s not a problem. I have noticed several comments that are less than nice towards someone trying to understand something new. It’s as if it should be simple because you understand it. Some people have an easier time with apples than oranges I suppose.

Performance wise, both can be good or bad. I keep saying it over and over, but it’s HOW you code, now what you use that matters in the end.

As far as making things easier… well, the shortest road is the one best known. Shortcuts can sometimes leave you wasting time if you’re not familiar with them.

Having been in the web dev field for quite some time now, I’ve realized that it all comes down to the basics. Adding levels of abstraction just creates necessity for no reason. Necessity to learn new things, which some people may be opened to, but this old timer (and apparently a lot of the commenters and readers of this post) is about done with learning new things that go obsolete before they get famous (prototype, mootools, GWT, Code Igniter for backend, I could go on and on).

Frameworks are nice when you understand them, that’s why I believe that the best framework is the one that’s easiest to learn. Unfortunately, most people don’t understand that the most popular framework is JavaScript itself. As for BackEnd PHP Frameworks, PHP still outlived every other abstract layered framework on top of it, and their many non backwards compatible versions. Looking at Laralvel, the greatest marketed PHP framework since Zend, it honestly looks like all of the other frameworks before it… just done differently with a little more or a little less abstraction, and its own quirks. Sparse documentation doesn’t help it either.

In the end, it comes down to the choice of the developer. I give a lot of respect to developers that still write pure JS. No abstraction for them. They know what’s needed from the language for their project.

I’ll stick to my apples, thank you.

ANGULAR JS WILL FAIL UPDATE: 11/3/2014

All righty then. Angular 2.0… a complete revamp of angularjs. Yet, another reason AngularJS will fail. I keep trying to explain why it will fail, and of course, I get all sorts of backlash about how I suck at programming. Maybe I just have a better understanding of business requirements integrated with development.

For all of those fan-boys of AngularJS… I don’t want to say “I told you so…” but… well, you know.

Apparently AngularJS 2.0 will be a complete rebuild of the first. It will blow your socks off… if you haven’t already built something with Angular 1.3 or its predecessors. Nevertheless, if you have built something with a previous version of AngularJS, sucks for you! Yes, there will be migranes… I mean… migrating procedures and such… but look at the cost!

I remember the days of when jQuery went to 2.0. Well. I remember them because I had to do it, and not too many people complained. In fact, the things that were pulled out that people used, were stacked neatly in an additional line of code that mostly housed IE dependencies. Easy, peasy! And… 99% of it is backwards compatible… And it’s not like things were added to it as bulk

With Angular 2.0, good luck migrating your entire code that’s dependent on a specific framework to another framework that’s not backwards compatible… at all… in fact, they will have to spend a whole year making it backwards compatible, therefore, bringing it back to a bulky mess that it was in version 1.3.

Does anyone else see anything wrong with this? Or are the fan-boys so faithful in this new religion, even if their projects crash and burn on the way down? How can anyone have any faith in a system that will drastically change their way of doing things? What’s to guarantee that they won’t do it in the future, causing you more headaches and lost hours… that you apparently saved while you were working with what would become an outdated version of itself.

Frameworks suck, and frameworks that are not updated with backwards compatibility, fail! Just look at all of the PHP frameworks that have gone by the way side because they didn’t keep up.

I understand that frameworks are supposed to make things easier for the future… but has Angular JS done that in this case? Uh… nope! Major fail in my book!