@kulboi4real If you have to think of test cases for TDD. I am sorry but either one of two things are wrong.
1) The top-level functional requirements aren’t properly done and/or understood by the team or software engineer working on it
2) You don’t know how to translate requirements to tests
@kulboi4real Translating takes understanding of what’s important to the success of that functionality.
For instance How would you test a React component OR a web route on the backend in the context of the business rules that make it function ?
There’s a simple trick to this and I’ll share
@kulboi4real Now, even though test design is a manual process, it is still a logical one too. Same for Unit/Integration tests.
Don’t focus on behavior and properties of the single software artifact/unit you’ve just built. Focus on the output under given conditions that match the requirements
@kulboi4real The reason I put up the figure above (diagram of a Test case) ☝🏾 (check the tweet preceding this one) is because that is the pattern you need to fit a React component OR web route action class method or any software unit into. E.g A react component recieves input and gives output
@kulboi4real The output is supposed to change (or remain the same) under given conditions. Remember, I said focus on output and conditions (a condition could be the data type of the input or passing no input at all to software artifact/unit)
I know you have heard of password #Salts which are similar to Nonces and used to add uniqueness to passwords and protect against pre-computed hashes (rainbow tables).
Did you also know about password #Peppers ? They are equally important too.
In modern web applications of today, you should #Pepper your passwords as well as #Salt them too before hashing them. Here is the order:
Original Password ---> Salt ---> Pepper ---> Hash ---> Store-In-DB.
However, if you #Pepper passwords wrongly. It could be very disastrous!
What do i mean by this ?
Well, the simplest (and safest - very important) way to #Pepper a password is to HMAC(Original_Password, key) it.
HMACs are resistant to length-extension attacks & brutes-force attacks.
Finally, when you are building a #PWA & setting up a service worker, this is how i feel your fetch event handler should be to handle a myriad of edge cases:
Part 1:
This part shows a CACHE FIRST LOOKUP. Also notice when the app is offline. Setup fetch to work with the HTTP cache
Part 2:
This part show a NETWORK NEXT LOOKUP. We detect errors with the fetch request first and return early. Then detect server-sent events and return too. Then split the by content type: html,css,js,svg responses gets put in the cache and json responses gets put in IndexedDB.
Notice this area: it helps us handle cache eviction gotchas that might hit us when developing a PWA
Don't worry the navigator object is very well accessible inside both Web Workers & Service Workers.
Notice how persist the cache after updating with `cache.put()`
So, my thread on how to choose databases for your web apps starts in 20 minutes time. Hope y'all are ready ?However, this time i would love it to be an interactive session where we can learn from each other about database preferences for specific web apps and the use case #thread
This is what we want to talk about today. Take a really good look at the image below. Study it well. Also notice the words at the 3 vertexes of the triangle. CONSISTENCY, AVAILABILITY & PARTITION-TOLERANCE (Big English - but fear not, we shall demystify all and it'll all be easy)
If we also look at the image in the previous tweet on this thread we can see some popular databases placed at certain sides of the triangle. It is important to note also the positioning of some of a particular point on each side. We shall discuss this in more detail soon. #thread
Okay, so tomorrow is the day i do the thread on regular expressions. I will do the thread on everything on regexes for 2 popular languages : #Javascript & #Python. So, stay tuned for tomorrows tweets starting at around midday
So, today i am going to be talking about regexs or regular expressions and how formulate them in 2 programming languages. We are going to start with the basics and from there we will look at the meta syntax combinations that come together to make...
...it possible to perform matches on strings (matching sequences) using patterns (formed by meta characters / meta syntax).
Regular Expressions are sequence of characters that define a pattern that is always finite, unambiguous or unaffected by context.