Today I continued the regex challenges at FreeCodeCamp.
Regexes are weird little things. I have used them before when I worked with scrapers and they were confusing then and they are confusing still.
The idea of regexes is super simple and easy to understand, and the ones used in the FCC challenges weren't that difficult. But, when it comes time to actually use them they become a lot trickier. The real problem comes from figuring out the way to catch everything you want. And after you have figured it out you still have to write it using the cryptic characters.
They will probably become easier as time goes by, gotta just keep using them!
This is how it's defined in the book:
"When a piece of code is written to work with objects that have a certain interface - like the toString method - any kind of object that happens to support this interface can be plugged into the code, and it will just work."
This means that we can change our object's pre-built methods to better suit our goals and still be able to use other functions that relied on the prebuilt version. That is cool.
Chapter 6 was a great read. You'll find links to the book below as well as the summary of CH6.
There were some problems last time when I decided to add a way to reply with a quote. It was solved when I moved the quotes to their own txt-file. Everything went pretty well and with a very small amount of bugs. Hopefully, it stays that way.
You can make your own version by following this tutorial by Code Wizard.
As I said yesterday, I decided to make a more robust schedule for coding. My base plan right now is:
- Read a chapter of EJS in two days. Then do the exercises on the third day.
- Do at least ten challenges at FCC every day.
This is just the base plan and I'm adding some "spice" to the mix. The spice can be anything that I want to do on that particular day. I'll keep this at the beginning of my writings and change it as I see fit.
I encourage everyone to make a plan. Without one, I would be a lot like Kermit below.
- Learned about literal match, wildcard char, and matching ranges or classes
- Learned about different flags such as i, g
- What is polymorphism
- What are symbols
- How iterable objects work (The book explains the behind the scenes)
- Introduced to inheritance
- Using a server to host my programs.
Task 'FCC'. Elapsed time: 0 h 30 min 15 s
Task 'Reading EJS'. Elapsed time: 0 h 49 min 48 s
Task 'Twitter_bot'. Elapsed time: 0 h 39 min 46 s
"So objects do more than just hold their own properties. They have prototypes, which are other objects. They’ll act as if they have properties they don’t have as long as their prototype has that property. Simple objects have Object.prototype as their prototype.
Constructors, which are functions whose names usually start with a capital letter, can be used with the new operator to create new objects. The new object’s prototype will be the object found in the prototype property of the constructor. You can make good use of this by putting the properties that all values of a given type share into their prototype. There’s a class notation that provides a clear way to define a constructor and its prototype.
You can define getters and setters to secretly call methods every time an object’s property is accessed. Static methods are methods stored in a class’s constructor, rather than its prototype.
The instanceof operator can, given an object and a constructor, tell you whether that object is an instance of that constructor.
One useful thing to do with objects is to specify an interface for them and tell everybody that they are supposed to talk to your object only through that interface. The rest of the details that make up your object are now encapsulated, hidden behind the interface.
More than one type may implement the same interface. Code written to use an interface automatically knows how to work with any number of different objects that provide the interface. This is called polymorphism.
When implementing multiple classes that differ in only some details, it can be helpful to write the new classes as subclasses of an existing class, inheriting part of its behavior."
Have a great day and see you all tomorrow!