Introducing typed strings
In today's applications, there are many data structures that we need to handle, such as students in school, books in a library, or orders in a shop – if we want to keep the code object-oriented, we need to create a Student
, Book
, or Order
class, respectively. This is because such structures are complex schemas that contain many characteristics that need to be checked. On the other hand, there are lots of less complex data types that are still schematic, and some checks are required to confirm their validity. Some examples include phone number, ZIP code, email address, credit card number, or even simple types such as mass or distance. All these data types can be described with a finite number of rules that define their structure. The problem is that we usually do not create a class for things such as a mass unit and even if we do, we feel like it's overkill because the implementation hides the true intent of a programmer, which is to simply...