Objects and Classes, the building blocks of all things programming. Today I'm going to cover a few Scala concepts at a moderately high level. (I’m here learning with you guys) We will be going over
This will, if all goes well, put us in a good place for “Pattern Matching”. So without further ado (yes it’s ado and not that weird french word… man I can’t stand elitists) Let's go.
Scala is a modern programming language written by Martain Odersky.
Alright so what is Scala, scala, like I said above, is a modern programming language, it has some pretty cool features too, for one, and we will go deeper into everything momentarily, everything in Scala is either an object or a method, 1 + 1? yeah, it can also be written as 1.+(1) and will evaluate as two
What does this say about Scala as a language? Scala is Pure, so if you can program in Scala, you are automatically better than almost all programmers by default…
First off, welcome to Scala for simpletons, I'm not sure I will be able to write everything in a way that even I would be able to understand, but we will see. This is the first of a series of articles I will be putting out to help solidify my own understanding of Scala and the FP paradigm. Hope you enjoy and find value.
So what functional programming?
To answer this we are going to start with what is Object-Oriented Programming; Understanding how data is being handled in one will really help understand how functional programming is different. …
OK, in this article we're gonna be going over both Query languages (declarative and imperative). We will also be going over graph-like data models this is a continuation of chapter 2 part one where I went over both relational and document data models.
There are two main languages or language types for interacting with data, Declarative, and Imperative.
Imperative programming language requires going line by line in a specific order, and it's going to execute in that order every single time it runs; there isn't a lot of room for change, and when changes do occur, there can be a…
So first off I'm writing this with dictation on my Mac so I don't have to write manually, and I can just word vomit after sections. There might be some weird grammatical errors I will do my best to check. This is a very dense overview of both data models and query languages, So I will be breaking this into multiple parts so this article will be mainly focusing on data models and the next article will focus on query languages.
The limits of my language are the limits of my world.
— Ludwig Wittgenstein
Data models are extremely important…
Alright, so this is article one in a series of articles I will be writing to concentrate my understanding of “Designing Data-Intensive Applications” by Martin Kleppmann; as well as have articles to look back on to measure improvement.
I highly recommend reading this book and I hope these bring someone value.. If not, that's ok, these are for me, not you, this is in no way a supplement for reading the book.
This chapter gives an overview of the three pillars of a well architected Data-system. These three pillars are
“The container with the most water” is a LeetCode favorite. Your job is to write a function that takes in an array of numbers and returns the max area of water that could fill a container defined by the “heights” which represent the height of walls; if you're not following, that is OK! We will get to it :)
This problem is moderately challenging if you have a history with math, at least is was moderately challenging for me. I passed 80% of test cases before needing to look for what I was missing.
PRO TIP — Don’t spend more…
So, this ones gonna be short, Median of two sorted arrays is LeetCode problem number 4 and has a difficulty rating of hard (and its probably one of the easiest questions I've solved on the platform.)
Ok… Problem — Write a function that takes in two sorted arrays and returns the median number. It's really that simple.
Stop, right now, go solve it if you think you can.. come back if you're having issues; this problem is a huge confidence booster (maybe not if you arent following yet)
To the solution break down…
A function in JS, and most languages, is a block of code that does something; it can take in data and spit out new creations based on what you feed it through its parameters “()”<-that thing.
To elaborate a little more, a function is a reusable block of code that can be used to perform different, wait for it, Functions, or “Jobs”, or “Tasks”. These jobs can range from restructuring data from an API call to returning a true-false value to rendering HTML on the DOM; functions are the building blocks of a web application in JS.
A Function comes…
Strive not to be a success, but rather to be of value. — Albert Einstein
Let me start off by saying Holy Shit. This one is now very well understood. Rule number one to “Cracking the code”… Start off with a naive approach. I spent a meaningful amount of my life trying to make this code O(nlogn) vs the very (simple?) O(n²) solution; I will be going over both in the lines below.
So, Longest Palindromic Substring, Leet Code problem number 5. …