What is a Framework?

Sdílet
Vložit
  • čas přidán 20. 01. 2023
  • What is a [software] framework actually?
    In our quest to take down popular tech buzzwords, we're going to tackle frameworks next.
    A software framework is a bring-your-own-code system that takes your code and runs it through its own complex code that achieves some task.
    For example take a look at your operating system (OS). it's a large program that has code for creating files, running processes, and more.
    On top of that, you can extend your OS by creating more files and subprocesses to do whatever you'd like.
    In this example, the OS provides users a hook into itself. such hooks are a telltale sign of a framework. in general a hook is something that the framework expects YOU, the coder, to fill in. the framework will then take your "thing" and integrate it into itself at some point.
    Depending on what specific framework you're dealing with, you will of course have different constraints on what your hook looks like.
    For example in the web development framework Next.js, you can create new pages in your site by creating a new file in the `./pages` directory. in this case the pages directory is your hook into the nextjs html generating framework.
    In Next.js, you're expected to export a single function as the default function for that file that will later be imported by the nextjs engine.
    So a framework is some system that lets you hook into it. this sort of hooking, more formally known as inversion of control, is what differentiates using a library from using a framework.
    A great example of inversion of control is taking the train to work versus taking your own car. with your own car, YOU move IT, but with the public transport framework, you're expected to bring yourself to it so IT moves YOU.
    #nodejs
    #expressjs
    #reactjs
    #webdevelopment
    #softwareengineering
    #django
    #flask
    #fastapi

Komentáře • 23

  • @Phat_trick910
    @Phat_trick910 Před 5 měsíci +2

    For newbies in programming, Framework is for Scripting language - which is usually used for Web Developing, not Kernel, Game Developing.

    • @redblacktech
      @redblacktech  Před 5 měsíci

      agreed.
      framework is indeed commonly used in the context of web dev like you say, and through this video I'm hoping to break that unnecessary coupling of ideas.

  • @JEsterCW
    @JEsterCW Před rokem +17

    XD i still have no idea

    • @redblacktech
      @redblacktech  Před rokem +7

      Its really any system that has hooks into it. Think of going to work using an urban train system as opposed to using your car.
      Driving your own car is like writing your own program.
      The train system lets you hook into it by being at a specific place at a specific time (train station) - this makes taking the train like writing on top of a framework.

    • @iCloutOrg.-uy4rs
      @iCloutOrg.-uy4rs Před 8 měsíci +1

      ​@@redblacktechdamn..... that's a good analogy

    • @redblacktech
      @redblacktech  Před 8 měsíci +1

      Ha - I didn't come up with the analogy, but it's a great one

    • @JustinLietz
      @JustinLietz Před 5 měsíci +1

      ⁠​⁠​⁠@@redblacktechso isn’t a programming language a framework then? I don’t understand the difference between a language and a framework

    • @redblacktech
      @redblacktech  Před 5 měsíci

      yes. i'd claim a language is a framework for writing programs easily, and let's you hook into itself through functions, classes, and all the other things you're used to with a language.
      i believe you will not like that answer, so let me put it in the way that most people mean when they say framework.
      when you use a CODE framework, you're installing a library like React where there's a looot of code written already. what's special about this code is that IT BECOMES THE MAIN CODE of your program, and all you're doing is making that code more specific to solve your specific problem.
      for example React will provide you a component tree, and will worry about rendering that tree on your browser (roughly speaking). all you need to do is add more components to that tree.

  • @zakzak24
    @zakzak24 Před rokem +2

    does a module fall under a framework or is it interchangeable with a library? e.g : Python modules

    • @redblacktech
      @redblacktech  Před rokem +1

      good question. modules are unrelated to frameworks; modules mostly exist as a mechanism for breaking up code into multiple files. it has a precise definition in a given language eg Python module.
      as for the relation between framework and module: there's no real relation, but sometimes a framework will actually let you "hook" into itself by creating your own module (search "Hugo modules")
      a library is a (usually big) collection of code. usually frameworks are packaged in a library, and there are many modules in the library.
      I suggest doing more of your own research about frameworks and libraries; this is only my best answer.

  • @2ch921
    @2ch921 Před 2 měsíci

    thanks

  • @subinkv6849
    @subinkv6849 Před 3 měsíci +1

    React is actually a library

    • @redblacktech
      @redblacktech  Před 3 měsíci +1

      can you explain what makes you say that? i'm curious because someone else has said the same thing, but that seems incorrect. theres inversion of control going on in react - another giant piece of code is running the code you provide.

  • @delta_shankar
    @delta_shankar Před rokem

    How to change the frame work to pay charm to python

    • @redblacktech
      @redblacktech  Před rokem

      i dont fully follow, you can type your question in your native language and youtube will translate it.
      pycharm is not a framework, its a fancy tool for letting you write code. you can write python without it

  • @stevencoy
    @stevencoy Před rokem +1

    Isn't React a library and not a framework?

    • @redblacktech
      @redblacktech  Před rokem +2

      That's a tough question. Even though React doesn't explicitly call itself a framework I'd argue it is.
      React claims it's not opinionated (as frameworks usually are) however it provides mechanisms like hooks and a component tree that you're supposed to extend.
      Perhaps I'm wrong but in my opinion having to define components in a component tree is no different from having to define files in a filesystem tree.
      Pair the component tree with the inversion or control that occurs when using features like hooks or lifecycle methods and you've got yourself a framework.
      Feel free to push back on what I'm saying, these concepts are all blurry since they're usually used interchangeably.

    • @stevencoy
      @stevencoy Před rokem +2

      @@redblacktech React technically is a library and not a framework, but is often referred to colloquially as a framework and compared side-by-side to other frameworks like Angular, Vue, and Next. It's not exactly apples to oranges, maybe more like apples to apple pie. Also, React is more like a framework when used with CRA or other toolchains. Perhaps most importantly, employers seem to refer to React commonly as a framework on job listings. So, pointing out that React is a library is kind of like pointing out that a tomato is a fruit... technically right but not always necessary. Either way, it is definitely confusing for newcomers.

    • @redblacktech
      @redblacktech  Před rokem

      Well then I guess this definition I proposed for a framework isn't perfect because it includes React. Though I can't seem to find a more clear definition of framework. If you have any references let me know.

  • @yisus__mt09
    @yisus__mt09 Před 10 měsíci +2

    Speak slower bro

    • @redblacktech
      @redblacktech  Před 10 měsíci +1

      its kinda hard to do that in youtube shorts since it enforces 60s (as opposed to tiktok which actually lets you run longer) but i'll keep that in mind