• Sloth Bytes
  • Posts
  • šŸ¦„ Why Do We Use Web Frameworks?

šŸ¦„ Why Do We Use Web Frameworks?

In partnership with

Hello friends!

Welcome to this weekā€™s Sloth Bytes.

Happy to announce the first sponsor to help support this newsletter!

I also made some updates to the sections to give it more character šŸ˜ 

As always if you have any suggestions, feel free to comment or reply.

They can starve to death on a full stomach

Sloths have sacrificed the ability to control their body temperature in order to save energy.

Instead they are completely reliant on the environmental conditions. If they get too cold, the special microbes that live in their stomachs can die, and the sloth can no longer digest the leaves that it eats.

Web Frameworks

What is a Web Framework?

A web framework is a set of resources and tools designed to support the development of web applications.

Programmers are lazy, so they like to automate things to make our lives easier.

Why Use Web Frameworks?

  • Efficiency and Speed: Web frameworks come with built-in solutions for repetitive tasks. This allows developers to skip the boring parts and jump straight to writing the good stuff which speeds up development.

  • Security: Building secure applications from scratch IS HARD. Frameworks often have built-in security features that protect against common vulnerabilities

  • Scalability: As applications grow, managing code becomes complex, Frameworks organize code in a consistent way, making it easier to scale, maintain, and onboard new developers.

  • Community and Support: Popular frameworks have large communities of developers who contribute to the framework's development, provide support, share plugins, and write extensive documentation. Basically you get to benefit off of other peopleā€™s workā€¦. cool.

Should You Use A Framework??

Most cases YES.

The rare moments when you donā€™t need a framework is when:

  1. Youā€™re a beginner and still learning the fundamentals: Frameworks hide details. If you're new to programming, start without one to learn the basics. After some projects, use a framework to appreciate its benefits.

  2. Itā€™s a very simple project: Frameworks are ideally for bigger projects, so if your project doesnā€™t need any of these features youā€™re just making it overly complex. KEEP IT SIMPLE.

JavaScript

  • React (ā€œitā€™s a library šŸ¤“ā€)

  • Angular

  • Vue.js

  • Svelte

JavaScript has so manyā€¦ too many, so Iā€™ll leave it at that

PHP (yes people use it)

  • Laravel

  • Symfony

  • Laminas

  • CodeIgniter

Others

  • Ruby on Rails - A full-stack framework for Ruby

  • Django - A full-stack framework for Python

  • ASP.NET - Full-stack framework for C#

  • Spring - Framework for Java

Thereā€™s a lot more frameworks that I left out, but these should be enough.

Summary 

  • Web frameworks make life easy

  • If youā€™re a beginner or working on a very simple project donā€™t use them YET

  • Thereā€™s so many of them that the hardest part is picking one.

Big O Notation (For interviews)

What is it?

Big O notation is a method of measuring an algorithms time and space complexity.

Using this method, we can determine an algorithms best case, average case, and their worse case.

Itā€™s not meant to be precise, itā€™s meant to give us a general idea.

Why is this important?

The reason we need big O notation is it helps us understand how efficient an algorithm is.

Imagine if you did a google search and it took 5 minutes for your search to go through.

Another reason we need this is because we canā€™t just time our code.

Why not???

I mean you could could measure how long it takes for an algorithm with a timer, but there are 2 main problems that could mess up these measurements:

1. Hardware

If a supercomputer and an old computer ran the same program, the supercomputer would finish first.

Doesnā€™t really help usā€¦

2. The programming language

If I created the same program in C and JavaScript, most likely C would be faster.

Once againā€¦ doesnā€™t really help us.

With big O we can minimize these problem because it focuses on the algorithm.

Time Complexity

Time complexity means the amount of time an algorithm takes to run as a function given an input size.

So basically how fast it is.

Space Complexity

As the name implies, itā€™s the amount of space an algorithm takes up.

When we say space, we mean memory and storage.

Imagine you made an algorithm that took up all the memory and ram in your computer (yā€™know something like google chrome).

Now all of a sudden your computer is slow and struggling because of how much space it needs to run this algorithm, this is not good!

Common Big O runtimes

When it comes to big O, thereā€™s many types of time complexities and runtimes, but those are really rare, most of the times youā€™ll be seeing these:

These are ordered from best to worst:

  • Constant: O(1) (This is the best!)

  • Logarithmic Time: O(log N) (Pretty good!)

  • Linear Time: O(N) (Itā€™s decent)

  • Logarithmic Time: O(N log N) (Starting to get bad)

  • Quadratic Time: O(N^2) (Pretty bad)

  • Exponential Time: O(2^N) (Terrible)

  • Factorial Time: O(N!) (Worst case, how did this happen?)

Big O notation is very important for data structures and algorithms, and of course interviews, so get a lot of practice!

Only a couple days left to invest in this smart home startup.

The ball-park isnā€™t the only place to look for home runs. Best Buy has a proven record of placing early bets on home-tech products that go on to dominate the market.

  • Ring - acquired by Amazon for $1.2B

  • Nest - acquired by Google for $3.2B

Early investors in these companies are sitting on some serious returns - but for the rest of us, there's still a chance to get in on the action with RYSE.

History tends to repeat itself, and RYSE's launch in +100 Best Buys points towards their company being the next home run.

Their Smart Shade tech is poised to dominate an industry growing at 50% annually, and there's still time to invest in their $1.50/share public offering.

So many people submitted this time! Check out their submissions!

TarmanderC, ddat888, paulkiwana, Yoshlix, SpyNullExe, rushi-001, RelyingEarth87, umeshsiddarth, 10g1n, WideLoadCollie, and the most impressive one to me (Yeah I have favorites)

not only that, they made this too

Thank you all to everyone who did the challenge!

How Many Vowels?

Create a function that takes a string and returns the number (count) of vowels in the string.

Examples

count_vowels("Celebration") āžž 5 # 5 vowls

count_vowels("Palm") āžž 1 # 1 vowl

count_vowels("Prediction") āžž 4 # 4 vowls

Notes

  • a, e, i, o, u are considered vowels (not y).

  • All test cases are one word and only contain letters.

How To Submit Answers

Reply with this:

  • A link to your solution (github, personal blog, portfolio, etc)

  • A link to your post on Twitter, Linkedin, or any social platform you use.

Working on the AI girlfriend/boyfriend šŸ’€

I found the right tools/APIs for this project and itā€™s definitely going to be interesting. Iā€™m probably going to use Replicate (tool I showed before) because the models are open source which means less restrictions.

The popular AI models seem to not like the AI girlfriend/boyfriend idea because of their content policy but Iā€™ll find a wayā€¦

but thatā€™s all from me!

Have a great week, be safe, make good choices, and have fun coding.

See you all next week.

Reply

or to participate.