Lately, I’ve been posting a bunch of really fun content in a series called Mastering Unit Testing on Twitter. The latest tweet is here on the difference between DAMP and DRY in unit testing.
Please go give it a look and like/retweet.
The const keyword in JavaScript is a lie and a waste. I recently tweeted about how const is a waste and had a lot of interesting discussions.
But here’s the thing about const in JavaScript: it ONLY makes sure that the reference isn’t reassigned. But when you use a keyword like const, it implies to you that the thing you’re creating is constant, and will remain unchanged throughout the life of the reference. But that’s not true. That’s not what const does. …
JavaScript has a nice Date Object. It can do all kinds of cool things like tell you the current date and time, etc. Lots of languages have a similar facility.
And you shouldn’t use it.
By that I mean, you shouldn’t use it directly.
Let me clarify a little bit. I don’t mean don’t use date objects, those are a fundamental data type in JavaScript (or your preferred language). But what I mean is that you shouldn’t directly use the functionality that tells you the current date and time, or some calculation based on current date/time, such as getting tomorrow’s date. …
Angular 10 is out. Knowing all the newest features of a tool can be very important. So let’s break down what’s new in Angular 10:
Yeah, honestly, there’s really nothing new. Ok, there are a couple of tiny changes: Angular Material has a new date picker, and there’s some minor changes to things you almost for sure don’t use.
So does this mean that it’s a problem? Disappointing?
Nope. Why? Because first of all, upgrading to 10 will be super easy.
Also, this matches their release cadence. A new major version every 6 months, regardless of how many features make it in. …
There’s been some fascinating discussion and debate recently about the modern web, and whether what we often take for granted as “the right way to do things” is really better than “the old way”. A lot of this has been centered around Hey.com, the new email service that’s taking the world by storm.
Now if you’re wondering what is the “modern web” let’s use a pretty general definition. The modern web is a web app using some kind of front end framework — angular, react, vue, etc. with some kind of API server — node, .NET, …
I like to paint miniature figures for Star Wars (pics below for anyone who may be interested). It’s about the geekiest of hobbies. The other day I was on a website buying custom bases for these figures. This site was out of the US, and the default currency was not US Dollars, but there was an option to switch the currency to US dollars so I did, and then I noticed this:
In my free course on the Fundamentals of Angular, there are just over 2 hours of content on template-driven forms in Angular. One of the main parts of this is coverage of how to validate user input. This is an important part of any framework’s forms handling.
But in Angular, there’s a bit of an unmet promise when you learn about forms validation, and this can be confusing, so I’d like to just quickly cover the issue to help clear up any confusion you may encounter when doing forms validation in Angular.
When you first learn about forms validation, you quickly discover that there are several attributes you can add to an input control to validate that control. Angular’s integration with this validation is simple and effective. …
Dates in JavaScript and Angular can be dangerous if you don’t know what you’re doing. Let’s look at how to avoid potential bugs by gaining a fundamental understanding of JavaScript and Angular date handling and the quirks that come along with that.
To start off with, you need to understand the ISO date format that the JavaScript ecosystem supports. It’s actually the ISO 8601 format. It’s a fairly straightforward format that looks like this:
yyyy-mm-ddThh:mm:ssTZD
In this example we see that it is the year, month, and day separated by dashes, then a “T” and the time in hours, minutes, seconds, and finally a time zone. …
Earlier this year I was privileged to be able to help put on ng-conf Hardwired, a last-minute, seat of our pants scramble to turn an in-person conference into an online conference that was all duct tape and baling wire behind the scenes, but turned out great for the audience.
Anyway, I thought I’d just put out there that there were a few talks given at the conference that were truly epic and are absolute must-sees. These are pretty Angular-centric, FYI.
So here’s my list in no particular order:
In my free course on the Fundamentals of Angular, there are just over 2 hours of content on template-driven forms in Angular. One of the main parts of this is coverage of how to validate user input. This is an important part of any framework’s forms handling.
But in Angular, there’s a bit of an unmet promise when you learn about forms validation, and this can be confusing, so I’d like to just quickly cover the issue to help clear up any confusion you may encounter when doing forms validation in Angular.
When you first learn about forms validation, you quickly discover that there are several attributes you can add to an input control to validate that control. Angular’s integration with this validation is simple and effective. …
One of the most confusing things when building an Angular component is deciding what to put in the constructor and what to put in the ngOnInit method. Both of these methods are used for similar purposes, both fire once at the beginning of the life of a component, so knowing what to put where can be troublesome. In this article, we’ll break down when to use each method, and why, and what to put in them, and what NOT to put in them.
First, let’s break down what each method does, and when it’s fired.
The constructor is important in a component for two reasons. First, it’s a lifecycle method, meaning it is called when the component is constructed, so, therefore, it has an important purpose in that if you want specific code to run at a certain time (during construction) then this is the right place to do it. Second, it’s the place where you inject services into the component. …
About