What is Frameworks in Programming?


  • Ethical Hacking & Pen-Testing

    Frameworks


    Most guys specially 😎 beginners asked me What is framework?
    They said, that they read so many articles but still they are confused 😵 .

    frameworks

    Let's Imagine,

    You need to drive a car, So First you should start the car, Then put the correct gear, then you need to change the gear in correct order.

    But, If you take auto-gear car, You just wanna start and press accelerator only,
    The gear will be changed automatically.

    So they build a environment for this specific scenario. It will handle the gear, No trouble for us.

    Like that,

    If you wanna build a software, That is a huge process (Except Development),

    When you come to code a software, You need to

    1. Design Views.
    2. Setup environment.
    3. Install Dependencies.
    4. Define Modals.
    5. Write Logic.
    6. Bind Modals with Databases.

    And other Blah Blah things.

    The Frameworks are helping us to done these jobs easily, quickly and perfectly.

    ⁉ ⁉ Why Frameworks?


    As I mentioned, Frameworks are making our tasks easy. So we can save a lot of development time.

    And also, If you follow your own structure It will be little hard to follow to your co-developers. Because everyone have their own style. But If you use a framework, That will have a standard pattern,

    So the whole development should follow the same standard, And any developer who knows that framework standard can understand the code.

    So, It will increase the code maintainability

    🧐 How?


    Structures

    Framework has a well defined environment and structure, We need to just follow their manual and put correct files in correct places, That's all, It will bind it automatically.

    PHP - Laravel Framwork Folder Sructure

    Laravel Folder Structure

    Routers

    All the Web Frameworks have Routers, Which will Route a request to a handler / controller.

    In web applications, If we want to add routing based URL we need to configure a lot of things.

    For Example : -

    In Apache and PHP, We need to configure .htaccess file to redirect requests to a specific PHP file, And then we need write logic in PHP file to handle the incoming requests.

    But in frameworks, They will have a specific file for Routing. You just need to add, Which URL -> where to go. Thats it.

    Laravel Framework Router

    Laravel Router

    Built-In functions

    Most of the frameworks have some awesome built-in functions to make our work much easier.

    Example (PHP)

    //Traditional Way to set and get a Session.
    session_start();
    $_SESSION['username'] = 'John';
    $username = $_SESSION['username'];
    
    //Using Laravel Framework.
    session('username','John');
    $username = session('username');
    

    //Validation in Traditional way
    public function login()
    {
        $username = (isset($_POST['username'])) ? $_POST['username'] : null;
        $password = (isset($_POST['password'])) ? $_POST['password'] : null;
    
        if(!empty($username) && !empty($password) && (strlen($username) <= 10)) {
           //valid
        }   
    
    }
    
    //Validation in Laravel Framework
    public function login(Request $request)
    {
        $validatedData = $request->validate([
            'username' => 'required|max:10',
            'password' => 'required',
        ]);
    }
    

    How simple, Frameworks have a lot of awesome functions ❤!


    Conclusion

    Frameworks are well planned and structured setup for build a software.
    It handles more than 50% of development procedures and saves our time.



  • nice explanation bro... ♥


  • Ethical Hacking & Pen-Testing


  • Web Development

    wow b6 brooo , wonderful


  • Ethical Hacking & Pen-Testing

    @Malith thx bro



  • Thnks bro..


  • Ethical Hacking & Pen-Testing



  • wow b6, your an amazing article writer i ever seen.


  • Ethical Hacking & Pen-Testing

    @root but didn't upvote yet 😜😜😜