The Single Responsibility Principle (SRP) with an example in Angular

Image for post
Image for post
Photo by Thomas Park on Unsplash

Have you ever come across a class or method with so much going on that your head starts to spin?

The Single Responsibility Principle (SRP) is a best practice methodology that states that a function, method, or class should have one main specific purpose.

Having classes or functions which have a lot of purposes makes your code hard to read, understand, difficult to trace bugs, and hard to maintain in the long run.

Creating smaller classes, functions, or modules that are geared for some specific purpose will lead to more robust, and maintainable code. …


and other Debian based Linux distros

Image for post
Image for post
Photo by Fotis Fotopoulos on Unsplash

The software you have on your PC tells a lot about what you work with or what you love to do. We use software for a wide range of purposes e.g., for education, productivity, or just mere entertainment.

Because software is so central to what we do, software management is one of the most common tasks you will do on your Linux machine or as a Linux admin.

In this guide, we will take a look at managing software packages from the command line using the Advanced Package Tool (APT) on Debian based Linux distros such as Ubuntu, Mint, and Kali, etc. …


Linux user admin commands

Home office setup
Home office setup
Photo by Josh Sorenson from Pexels.

From the very beginning, the Linux operating system was designed to be a multi-user OS. As such, one of the most common administrative tasks performed on a Linux machine is managing user accounts. It’s a critical part of keeping a healthy and secure Linux machine.

You might think that it is overwhelming to manage users from the command line. On the contrary, it is not at all. There are only a few basic commands that you need to know, and I will cover them in this article.

Background

A user account in Linux is the primary way of gaining access to a system — whether locally or remotely. …


A software engineer’s reading list

Arm holding up books
Arm holding up books
Photo by Thought Catalog on Unsplash.

As 2020 draws to a close, I am thrilled to share with you a selection of the best software engineering books that I have read during the past 12 months.

If you are a software engineer, data scientist, or one of those people who work in the tech or software industry, you will agree with me that you have to constantly keep learning if you are to remain relevant in the game.

When you decide to become a software engineer, you essentially sign up for a journey of lifelong learning.

There are many ways of learning or acquiring knowledge, but books still remain a dominant force in that sphere. …


Creating a simple custom pipe in Angular

Image for post
Image for post
Photo by Markus Spiske on Unsplash

In Angular, pipes are used to transform or format data in a template without writing any boilerplate code in the component. Pipes are extremely handy because you only declare a pipe once and can use it throughout the entire applications’ templates.

In this guide, I will show you the power of Angular pipes by implementing a simple custom unit conversion pipe. Here are some of the advantages of pipes in Angular.

  • the user gets instant feedback as values are formatted or transformed as you type or in reaction to other changes.
  • pipes are very lightweight
  • simple syntax, to call a pipe within a template, you simply use the pipe character followed by the pipe name e.g., {{ name| uppercase }}. …


A comparison of null and undefined values

Image for post
Image for post
Photo by Pankaj Patel on Unsplash

JavaScript is a powerful, mature, and widely used language. But it can also be strange in its own unique ways.

This post explores the differences between null and undefined values in JavaScript. An understanding of these differences is important in making sure that you avoid runtime bugs in your application code.

Running the code

If you want to follow along or test the code in this post. You can simply, use your web browser’s console to do so.

In Chrome and Firefox, you can access the web browser console by clicking the F12 button on your keyboard.

The anatomy of null and undefined values

In JavaScript, null and undefined are essentially the same or equal. What …? …


Web console features to use for better debugging

programmer wearing headphones examining code on a screen
programmer wearing headphones examining code on a screen
Photo by Nubelson Fernandes on Unsplash

I must admit that when I was new to JavaScript, every time I wanted to log something to the web console, it would look like this:

console.log('log message ...!')

In this guide, I will discuss the alternative ways of logging to the web console so that you can be more efficient in your development workflow, for debugging purposes in particular.

Before we look at the alternatives, let’s look at what the console.log() is really good at.

console.log()

The most common method of logging to the web console is via the console.log() method. …


Guidelines on how to create applications that carter for people with impairments

Image for post
Image for post

The web is used by a wide range of people that have unique physical and or mental abilities.

In this guide, I will walk you through the steps that you can take to make your Angular applications more accessible to a wide range of people regardless of their impairments.

A website is said to be accessible when its content can accommodate all users and can be operated by almost anyone.

When creating websites it is important to realize that not all users have the same access or ability to use a mouse, or touch screen.

Key guidelines

Some of the underlying principles that should form the foundations of an accessible website are outlined in the Web Content Accessibility Guidelines (WCAG). …


Implement a simple countdown in Angular

Image for post
Image for post
Photo by Eder Pozo Pérez on Unsplash

Counting down to some special event is something we do a lot.

In this guide, I will show you how to implement a simple and effective countdown timer in Angular using RxJS.

So far, 2020 has been a roller coaster year. How about we implement a countdown timer to the year 2021? The countdown timer we will implement will be updated to the second.

Without further ado, let’s jump into the code.

Create an Angular application

We will get started by creating a simple Angular application via the CLI with the following command.

$ ng new count-down-timer --defaults

Once the application is created go into its root directory. …


A look at the different ways you can provide a service in Angular

Image for post
Image for post
Photo by Erik Mclean on Unsplash

In this guide, we will take a look at the different ways in which you can provide a service in an Angular application. The method you choose to provide your service will determine the scope and visibility of your service to its dependents.

In Angular, a service can be anything from a simple value, a function, or a feature that your application needs. In most cases, however, services in Angular are classes that perform some specific function.

To be able to use a service via dependency injection you must register it with at least one provider.

In Angular, there are three main ways in which you can make your service available to its dependents. …

About

Mwiza Kumwenda

I develop software by profession. My interests include: history, economics, politics & enterprise-architecture. I am a child of God.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store