This Design Pattern replaces a behavior with different implementation at run-time or sometimes at load-time by means of configuration. Two entities could have different implementations of the same behavior.
How to use Command Design Pattern in Rust
This Design Pattern uses commands to wrap and invoke capabilities. A car can run faster and slower. We can have commands AccelerateCommand and DecelerateCommand for increasing and decreasing speed, respectively. We can also have AccelerateAndDecelerateCommand to run both capabilities in a certain order.
How to use State Design Pattern in Rust
Anything has a state. An entity has a state. Similarly, a car can be in a state of acceleration. While it is accelerating, there are some things it certainly cannot or should not do, e.g., reversing at that very moment. The State Design Pattern treats each state as a struct whose functions represent movements to the other states.
How to Read Input from Console Examples
In Rust, we can read user inputs from the command-line console. These inputs are string values with newline characters at the end. Most of the time, we do not want those extra characters. This post provides three simple example codes
Rust Core Data Types To Get Familiar With
Rust has two types of core data types – scalar and compound. Scalar types are single-value types, while compound types are multi-value types. Integer Data Types An integer data type is one of Rust’s core data types that represents a
Custom Data Types With Struct, Trait, And Enum In Rust
We can create custom data types in Rust using struct, trait, and enum. A struct is a composite data type that groups variables in a memory block. These variables are then accessible via the struct’s instance – also referred to
Enum Variants And Match Expressions In Rust
There are a few ways to define an enum variant and, as a result, to use it when creating match expressions. We can define a variant in three ways – one-word, Tuple-like, or Struct-like. Match One-Word Enum Variants Let’s say
Should You Use string or String in C#?
If you’re new to C#, you’ll notice there are sort of 2 types of strings – string and String. The first type is spelled out in lowercase letters; while the second is a proper noun. Built-in Reference String Type C#
Rust And Ubuntu 18.04 Docker Image
This post shows how to build a Ubuntu 18.04 Docker image with installed Rust. We can use the image to build Rust applications, but the codes are in the host Windows system. When we compile the codes, we need to
Install Julia And Run Source Code Files In Windows
This post is about how to install Julia and run source code files in Windows. Once we install it, we need to configure it a bit to make the Julia executable file available in command-line windows. Download And Install Julia