Check out a free preview of the full Building Awesomer Apps with Angular course:
The "Introducing Immutable Operations" Lesson is part of the full, Building Awesomer Apps with Angular course featured in this preview video. Here's what you'd learn in this lesson:

Lukas introduces immutable operations, which are JavaScript methods that can be used to avoid Object and Array mutations. Lukas takes questions from students.

Get Unlimited Access Now

Transcript from the "Introducing Immutable Operations" Lesson

[00:00:00]
>> Lucas Ruebbelke: Now that I've set the stage of let's think about these things. It's like everything I talked about for the rest of the day. Think about how does it help me improve state management, control flow or communication, or help me reduce my code? Okay? So as we go forward, let’s think about that.

[00:00:21] So, I have kind of a bonus mini-module here. It’s kind of a game changer for me. We’ve kind of talked about it internally a few times, as I made some suggestions. But I just wanna surface this, because one of the biggest things with managing state is moving from this mutable mindset of, I have this thing I want to change and I'm going to mutate this object directly.

[00:00:48] And instead, doing it in a mutable fashion of, I need to make this change, give me a brand new object or thing with these changes already done to it. And what that does is, if somebody is watching something, you're not directly changing it, but you're actually just returning a new one.

[00:01:10] So one, you're not passing around this reference to point to everything. But also, when you change let's say a property on an object, and you wanna undo it, well, how do you do that? Like, that's hard. How do you undo a single property change? Or let's say you do five property changes, and you wanna undo change one, two, and five.

[00:01:33] How do you wrap your mind around like okay I need to back out five skip four, three, two and then one. Like, it just becomes very complicated. As opposed to if you had five distinct objects, then you just start replacing it back. Yes?
>> Speaker 2: In the first three items where it say management control, in-flow, and call-walling.

[00:01:52] So to manage all of that is there a specific style-guide we should refer to? Or you should just keep that in mind and go from there? Or are we saying that these are the three or four application complexity types, and we should be able to address it when we are defining the application.

[00:02:14] But there is no style guide for it, there is no clear.
>> Lucas Ruebbelke: So I think this is, so the question is, is there a style guide, is there this canonical thing, to do it? And,
>> Lucas Ruebbelke: I don't think there's a certification that you go get, I'm certified, complexity-free, at the same time.

[00:02:36] And so this is a question that we had previously. And I'm just going to blend them together real quick. So Mohammad why don't you just ask the question we had this morning as we're talking before class. Cuz I think this will blend in to exactly how I want to address that question.

[00:02:51] Speak loud and let's hear it.
>> Mohammad: I was just asking as a new developer looking at the landscape of languages, what would you recommend to focus on as far as Angular, React and short term and long term?
>> Lucas Ruebbelke: Yup, so what's interesting is we spent the last two days talking about Angular.

[00:03:10] Now, I'm not actually talking about Angular at all. I'm talking about how do we build good applications. And so I think it's a blended approach. So, first and foremost, I think there's a lot to be said about the different framers. Really for me kind of the two big players.

[00:03:30] I would say the three big players is Angular, React, and View. And I guess I'll say Amber I don't want to offend anybody if that's the framework you use and I'm not trying to. I'm just saying for me personally. When I think of Frameworks, you know it's really kind of angular, react and view.

[00:03:47] There is opportunities for everyone of those Frameworks. And so what I would recommend to provide maximum value to a client is become as good as you can on a single Framework. So being a really good angler developer, because there are opportunities that are abound, when you go in and you are effective with angular at solving a problem, you're providing value.

[00:04:10] Same way with React. Some of my friends are amazing react developers, and they go, and that's the mechanism which they provide maximum value to their client. So first and foremost, pick something and be very, very good at it, be the best you can be. This is street level stuff, like how do I build real things really, really, well?

[00:04:32] At the same time, the things that make someone a great Angular developer really are not Angular specific at all. Angular, React, we did not invent programming. JavaScript did not invent programming. All of our best ideas that we're doing right now, even like Redux is actually a composite of two design patterns.

[00:04:56] What is in observable? It's a composite of two design patterns that have been around for years. So to that end, and for, I would say, if you want to have a kind of quote unquote, style guide, is go read the classic programming books. For people that have been doing it for 30 years.

[00:05:14] So my all time favorite book for this is Clean Code by Uncle Bob Martin. And as the whole thing is about Java I'm reading this as a front end developer. I'm just like, my God. If I would have had this five years ago it would have saved me four years.

[00:05:29] And so go and read the classic books, like Pragmatic Programmer, Clean Code. I would ask you to read anything from Bob Martin. Martin Fowler, Enterprise Design Patterns. And so go and start to become a student of not a framework, but is being a craftsman and a software engineer.

[00:05:49] And so what I'm saying this applies to any application that you're doing. In fact like my cornerstones of how I program are not angular specific at all like self documenting codes single purpose methods You know, separation of insurance, like these different things. Is you apply that to all of your code.

[00:06:08] So this is kinda what we're talking about here.