Studying With Alex
Studying With Alex
  • 20
  • 1 345 322
Friendly Intro To the CAP Theorem (Consistency vs Availability vs Partition Tolerance)
The CAP theorem is a useful principle in distributed systems that illustrates some of the difficult tradeoffs that distributed systems have to make. However, it has somehow solidified itself as the E = MC^2 of the software engineering world: a cool piece of jargon that many people know and rattle off during interviews to sound smart and knowledgeable, even when it’s not relevant. As it turns out, the CAP theorem is not an incredibly advanced concept that only the most engineers can comprehend. It’s fairly intuitive, and I’ll explain why in this video. Let’s go!
00:00 Intro
00:31 C, A, and P
00:48 Consistency
01:51 Availability
02:17 Partition Tolerance
02:54 C, A, and P Recap
03:13 The CAP Theorem
03:40 C & A
04:08 One Must Choose Between C and A
04:42 Why Must One Choose?
05:38 Recap
Переглядів: 32 199

Відео

Throughput vs. Latency: How To Debug A Latency Problem
Переглядів 16 тис.2 роки тому
Imagine you’re on call for the service you work on and you get paged in the middle of the night. Phone blaring, you stumble out of bed, sleepily turn on your computer, and look at your metrics. Looks like request latency went up a lot and users are getting errors. How do you figure out what’s going on? In this video, we’ll answer this question by looking at the relationship between throughput a...
The Absolute Best Intro to Monads For Software Engineers
Переглядів 600 тис.2 роки тому
If you had to pick the most inaccessible terms in all of software engineering, monad would be a strong contender for first place, because of its spooky math background that uses terms like endofunctor and monoid. As it turns out, monads are an extremely powerful design pattern that can be used without any math knowledge. In this video, we’ll cover what monads are, how they can be incredibly use...
Idempotency, a key term in distributed systems | Software Engineering Dictionary
Переглядів 8 тис.2 роки тому
Idempotency is a property of an operation where performing the operation more than once has the same effect as performing it once. For example, setting a variable to 5 is idempotent because setting it twice to 5 has the same effect as setting it once. But incrementing the variable is not idempotent because performing the increment twice results in the variable going up by 2 rather than 1. Idemp...
Consistency, the C of ACID | Software Engineering Dictionary
Переглядів 3,3 тис.2 роки тому
Like many terms in software engineering, the term consistency has a few different meanings. Let’s go over two of them. The first one is data consistency, which is when the data in a system is accurate, valid, and meets all desired constraints. For example, if you have a table of users, you might have a constraint that “every user in this table must have a first name longer than two characters”....
Isolation, the I of ACID | Software Engineering Dictionary
Переглядів 3 тис.2 роки тому
Isolation is a property of a database where simultaneous operations on the same data never see each other’s in-progress work. If you watched my atomicity video, which you should before watching this one, you saw that operations can be grouped into atomic groups called transactions. For example, if we have a database with bank accounts, and Alice is transferring $10 to Bob, we first need to remo...
How to make code more testable, by factoring out and abstracting side effects
Переглядів 51 тис.2 роки тому
As a software engineer, sometimes the code you're trying to test accesses the filesystem, databases, other services, or the internet. But including them as part of the test makes tests slower, more brittle, and more expensive. I'll show you a best-practices way to factor out and abstract those pieces of your code so that it becomes easier to test, using our friends factoring, abstraction, and d...
Durability, the D of ACID | Software Engineering Dictionary
Переглядів 3 тис.2 роки тому
Durability is a property of a database that guarantees that completed updates will not be lost if a system crashes. In general, when you ask databases to store data, they write that data to a form of persistent storage like a disk drive. It’s called persistent because once the data is written, the system could crash, or even suffer a power outage, and the data will be safe. However, some databa...
Availability | Software Engineering Dictionary
Переглядів 7 тис.2 роки тому
Availability, also known as uptime, is the percent of time that a system spends in an operational state. For example, if a system is functional for 23 hours every day, then it has 23 / 24 = 95.8% availability. If a system is down for 1 hour every three months, which we’ll approximate as 2160 hours, that means it’s up for 2159 hours, and therefore the availability is 2159 hours / 2160 hours = 99...
Atomicity, the A of ACID | Software Engineering Dictionary
Переглядів 4,4 тис.2 роки тому
Atomicity is a property of a system, usually a database, where operations either happen completely or don’t happen at all. For example, let’s say that our database contains bank accounts, and Alice is trying to transfer $10 to Bob. We might implement this by decrementing Alice’s account by $10, then incrementing Bob’s account by $10. But what happens if the system crashes right after we perform...
So You Tested Positive For COVID, But Do You Actually Have COVID? A Friendly Intro to Bayes' Law
Переглядів 1,3 тис.2 роки тому
Sensitivity: 84.6%. Specificity: 98.5%. What do these numbers mean, and how confident can you be in the result of an at-home direct antigen COVID test? Plus, there are so many different manufacturers, such as Quidel, Ellume, and Abbott. Which one is best? Let's learn about conditional probability, false positives and negatives, COVID testing, and Bayes' Law. 00:00 Intro 00:16 Sensitivity & Spec...
1 minute coding tip: git diff-words to see diffs on a per-word basis instead of per line
Переглядів 3,8 тис.2 роки тому
1. Open ~/.gitconfig in your favorite editor. 2. Find the [alias] section. If it doesn't exist, add "[alias]" this to the bottom of your .gitconfig. 3. Under the alias section, add this text: diff-words = diff color-words='[^[:space:]]|([[:alnum:]]|UTF_8_GUARD) ' Final result: [alias] diff-words = diff color-words='[^[:space:]]|([[:alnum:]]|UTF_8_GUARD) ' 4. Run git diff-words.
1 minute coding tip: npx to make it easier to run npm binaries from your JS project
Переглядів 3,5 тис.2 роки тому
Use npx to easily run command-line tools installed by npm. npm, npx, node, javascript, eslint, productivity
Unicode, in friendly terms: ASCII, UTF-8, code points, character encodings, and more
Переглядів 236 тис.2 роки тому
Ever been bit by a Unicode bug? Maybe you weren't treating UTF-8 encoded data correctly, or tried to read it as ASCII? Maybe you mixed up UTF-8 vs UTF-16? Unicode and character encoding might seem like a tricky topic, but let's break them down and learn about them piece by piece, from ASCII to code points to graphemes to combining character modifiers and more. Thumbs up emoji link: www.fileform...
Password Storage Tier List: encryption, hashing, salting, bcrypt, and beyond
Переглядів 251 тис.2 роки тому
If you're building an app or product, you _need_ to store your users' passwords securely. There's terrible ways to do it, like storing them in plaintext or encrypting them, slightly better ways like hashing or hashing and salting, and even better ways like bcrypt, scrypt, or argon. Sources: gist.github.com/epixoip/a83d38f412b4737e99bbef804a270c40 github.com/corkami/collisions#fastcoll-md5 00:00...
Restricted Stock Units (RSUs) in friendly terms (Part 2 of Equity Compensation & Taxes)
Переглядів 3,9 тис.3 роки тому
Restricted Stock Units (RSUs) in friendly terms (Part 2 of Equity Compensation & Taxes)
Equity Compensation & Taxes, in friendly terms: RSUs vs options, cost basis, capital gains (Part 1)
Переглядів 3,2 тис.3 роки тому
Equity Compensation & Taxes, in friendly terms: RSUs vs options, cost basis, capital gains (Part 1)
Non-blocking I/O and how Node uses it, in friendly terms: blocking vs async IO, CPU vs IO
Переглядів 71 тис.3 роки тому
Non-blocking I/O and how Node uses it, in friendly terms: blocking vs async IO, CPU vs IO
Intro to Encryption, in Friendly Terms: Cryptography, AES, Man In The Middle, and HTTPS
Переглядів 9 тис.3 роки тому
Intro to Encryption, in Friendly Terms: Cryptography, AES, Man In The Middle, and HTTPS
Friendly Intro to Hardware Security Modules (HSMs)
Переглядів 36 тис.3 роки тому
Friendly Intro to Hardware Security Modules (HSMs)

КОМЕНТАРІ

  • @eronth
    @eronth 4 дні тому

    I... still don't really understand what "a monad" is. Like, I understand the design pattern you're showing off, but what is "a" monad?

  • @durgeshreenaidu7027
    @durgeshreenaidu7027 4 дні тому

    direct to the point, thanks !!

  • @user-ql7pw7ld1n
    @user-ql7pw7ld1n 5 днів тому

    fantastic video..loved it

  • @hooman1439
    @hooman1439 6 днів тому

    i read mcdonalds :(

  • @JohnDoe-xk2sj
    @JohnDoe-xk2sj 6 днів тому

    Nice one, thank you. At about 2:00 I would have called the inner and outer square rather than the first and second one.

  • @DanteMishima
    @DanteMishima 7 днів тому

    Lose the background music. Couldn't get through a quarter because it's so distracting

  • @hedwigfarthofer
    @hedwigfarthofer 7 днів тому

    Very good video! Thank you a lot!

  • @JackDespero
    @JackDespero 11 днів тому

    Just to be nitpicky, the wrapper of the type is not a part of the monad. The (in)famous sentence is true: A monad on A is a monoid of the endofunctors of A. This means that the it is a F: A -> A, meaning that both the original object and the end object must belong to the same category. In your examples, you are doing two different operations: - An isomorphism, F: U -> W, where U are all the unwrapped objects and W are the corresponding unwrapped objects. - A monad, G: W -> W, where the monad acts on any wrapped object and returns the same type of wrapped object. Not that it is fundamental to program or anything, as most of the time combining both is the easiest solution (multiple times my functions accept different types for certain arguments and I internally transform those arguments into the type that I actually use in the function, like passing the name of a matplotlib cmap, and then I get the cmap, but also allowing to pass a cmap itself). Another nitpick to make is that in pure functional programming, the "busy logic behind the scenes" cannot affect anything else other than the object being returned. For example, if instead of adding the log to the object you wrote it somewhere else, that also wouldn't be a monad, even if that function would work exactly in the same way, being able to chain it as much as you want.

  • @JackDespero
    @JackDespero 11 днів тому

    A monad is a function that takes an object of any type and returns the same type of object. Map and filter are two very understandeable monads. In Pandas, for example, getting rows by index is a monad, as you had a database before, and the function (selecting indices) returns you to another database object (to which you could further apply an index selection).

    • @JackDespero
      @JackDespero 11 днів тому

      Monads are my favourite design pattern for functions that apply to something, and I never knew how to call "that type of function", until I discovered that they are called monads.

  • @karthifairhawn9825
    @karthifairhawn9825 12 днів тому

    Title: The Absolute Best Intro Video:🗿

  • @IvanBilan-ty9jw
    @IvanBilan-ty9jw 12 днів тому

    It's a great explanation of complex concept. Divinding work time into CPU and IO time is a realy great concept for understanding this. Now I understand why Node.js is so popuar for web development. Thanks!

  • @alastairleith8612
    @alastairleith8612 14 днів тому

    I wish loud soundbed musak wasn't considered de rigour everywhere ATM. it really is very distracting not some kind of educational aid.

  • @NikolajLepka
    @NikolajLepka 14 днів тому

    oh you call it run? I call it apply

  • @aaquibtayyabi
    @aaquibtayyabi 15 днів тому

    1:09 But doesn't ascii use 7 bits for representation ?

  • @chronos7554
    @chronos7554 15 днів тому

    i feel like im losing my sanity watching this thats how you know its good

  • @lanx0652
    @lanx0652 16 днів тому

    Feel like rust

  • @illdieanyway7865
    @illdieanyway7865 17 днів тому

    Why explain without code?

  • @jacobthomas1344
    @jacobthomas1344 17 днів тому

    Ok the usefullness of this wasnt making any sense to me until we started using nullable types. Maybe JS wasn't the best langauge to explain these concepts with? The pattern seems to be much more relevant to other languages like C# to me

  • @andresgutgon
    @andresgutgon 17 днів тому

    The best way to learn monads is as always by using them. i use the result pattern which I think is another monad

  • @isaacking4555
    @isaacking4555 17 днів тому

    Or you can log in the function and set the log level like a normal person

  • @uxmansarwar
    @uxmansarwar 17 днів тому

    please create a video to explain how to convert utf-8 text to 8 bit binary

  • @LethalChicken77
    @LethalChicken77 17 днів тому

    Is that like gonads?

  • @adre2194
    @adre2194 18 днів тому

    I don't understand... how is this meant to help us in our battle against the Mechon?

  • @ezsnova
    @ezsnova 18 днів тому

    Feel like I've leveled up as a developer after watching this 🙌

  • @Omnifarious0
    @Omnifarious0 19 днів тому

    This seems ridiculously overcomplicated.

  • @sigstackfault
    @sigstackfault 19 днів тому

    my hobby: spreading lies about functional programming "Monads are just functions which take one argument. They always explain it in a really complicated way."

  • @supermaster2012
    @supermaster2012 20 днів тому

    Heap programming at its peak

  • @glenospace
    @glenospace 20 днів тому

    Please no music

  • @alastairleith8612
    @alastairleith8612 20 днів тому

    please remake this using Haskell for the code examples! great monad tute but torture for my eyes parsing the JS :-)

  • @zxuiji
    @zxuiji 20 днів тому

    4:23 Way to turn a perfectly readable `n * n` to obfuscated code. I would hate to debug your code. Would've been better to create *separate functions* for stringifying what was done. Something like var n = 5 log(beganwith(x)) log(added(x,1,(y = add(x,1)))) log(squared(y,(z = square(y)))) log(multiplied(z,3,multiply(z,3))) would be far less confusing to read. since it doesn't create additional lines of code in functions that should kept to just one task so that they can be inlined by any compiler that's used instead of an interpreter

  • @nickeldan
    @nickeldan 21 день тому

    Is this related to Aspect Oriented Programming?

  • @tropicarls
    @tropicarls 21 день тому

    So really I’ve been using monads for a long time now. Nice!

  • @shadeblackwolf1508
    @shadeblackwolf1508 21 день тому

    If i'm seeing this right, it looks like a technique to bind operations that don't want to know about the all parts of a data structure to only the parts it wants to know about, in a way that's easy to extend both on the supported functions, and the underlying data structure. And then the broader secret work clicked

  • @XiangWeiHuang
    @XiangWeiHuang 21 день тому

    feels like a glorified version of wrapper pattern, or rebuilding object-oriented design in a function language without using class (new NumberWithLogs(5).add(5).square() ?). the secret work-behind-the-scene sometimes can be confusing either, because hiding the null protections, the function name not indicating it, the later readers must be familiar with the library or they won't know certain behaviours actually happen from the code. Hiding certain behaviours to ease things out - that also sound like what classes are for, and don't get me wrong, same issue also happens in object-oriented languages. We usually need to think a fitting name for things or write good documentations to avoid that. This video kinda ignored such aspect - codes are more for reading. It also results in repeating code, using monads in the way of first example. The code's theme should be about calculations, but reading the final product, it seems more about runWithLogs().

  • @newsofthenerd
    @newsofthenerd 22 дні тому

    I thought typescript is just an attempt to fake a type system badly over javascript a non functional language. Why the heck are you talking about monads? Theres no monads in javascript lol.

  • @IllIl
    @IllIl 22 дні тому

    _CAP_ is actually *PAC* "In case of *Partition* you can choose between *Availability* or *Consistency* but not both." *CAPELC* is the full reality: "In case of *Partition* you can choose between *Availability* or *Consistency* but not both. *Else* (when not partitioned), choose between *Latency* and *Consistency* "

  • @IllIl
    @IllIl 22 дні тому

    Bro, you're a legend. I've tried at least a dozen times before this to learn about monads. Wikipedia, googling, videos... was always left with the feeling that even though I didn't get it, the explanations were all trash. This video is so clear, I immediately understood the concept and how it was useful. And some old examples of monads that still rattled around in the skull suddenly made a lot more sense. Thank you.

  • @qweewqqweewq31313131
    @qweewqqweewq31313131 22 дні тому

    Finally understand what Monads is as I already using them in code like std::optional<T>😂

  • @zo2ahy
    @zo2ahy 23 дні тому

    At 8:37, the very first line of getPetNickname calls getCurrentUser. If getCurrentUser returns a User of None, do the other lines in getPetNickname execute as well?

  • @musangbeku
    @musangbeku 23 дні тому

    Makes sense. Thank you very much ❤

  • @rolandvarga3912
    @rolandvarga3912 23 дні тому

    dude, make more videos! Such high quality stuff 👏

  • @andrewpinedo1883
    @andrewpinedo1883 24 дні тому

    Where you at?

  • @tylerholden1548
    @tylerholden1548 24 дні тому

    I think maybe in more professional and critical software this could be important, but as a game dev I watch this and think "wow this is very overcomplicated"

    • @user-uf4lf2bp8t
      @user-uf4lf2bp8t 18 днів тому

      Don't worry, the library code that you use takes care of this so you don't have to.

    • @sheepcommander_
      @sheepcommander_ 15 днів тому

      ` Vector2?`

  • @1____-____1
    @1____-____1 24 дні тому

    This example is shockingly close to Rust.

  • @HyuLilium
    @HyuLilium 24 дні тому

    Seems there are libraries around bringing monads and other FP features to JS but they are NOT good for bringing in real production work with teams for many reasons.

  • @keanucoetzee8627
    @keanucoetzee8627 24 дні тому

    Monads? They hang between molegs.

  • @HyuLilium
    @HyuLilium 24 дні тому

    How would you use this practically in JS?

    • @tropicarls
      @tropicarls 21 день тому

      If you have ever done an http request to an api, then you probably have used a type of monad (promises) to handle the operation and its return value

  • @hoarsebees
    @hoarsebees 25 днів тому

    If the trade off is “duplicate code or use monads” I’m duplicating code every time no question.

  • @zeroows
    @zeroows 25 днів тому

    Thank you. Please keep these Great videos coming.

  • @310gowthamsagar5
    @310gowthamsagar5 25 днів тому

    your videos are great. thank you.