Libraries and frameworks

Libraries and frameworks

What will you learn?

? Describe Libraries

? List uses for Libraries

? Identify the advantages and disadvantages of using Libraries

? Describe Frameworks

? List uses for Frameworks

? Identify the advantages and disadvantages of using Frameworks

? Compare a Library with a Framework

“If you are not familiar with coding, don’t worry we just explain the concept”

? The Library

Suppose you have a slice of bread that you want to toast. Most likely, you would use a toaster. But if we think about it, did you invent or make the toaster? No, you bought it. We can better understand the library by defining the toaster as a reusable application that performs pre-defined functions. I believe you have now understood what a library is. A library contains a collection of utility functions that your application code can use for carrying out specific tasks. Libraries serve to help with a wide range of activities, just like your toaster.

We can refine the definition of the library for better clarity. A library is essentially a reusable software component that saves developers' time by providing access to pre-written code that performs specific programming tasks. Libraries are created to assist with various types of tasks and can be used across different projects.

If you're still having trouble understanding, don't worry! Let's use the example of a toaster and bread to explain further. The toaster is designed to toast bread to varying levels, but let's look at how it actually works. A toaster uses infrared radiation to heat the bread until it's toasted to your desired level. As an end user of the toaster, you don't need to worry about the technical details. You simply put your bread in, choose your desired level of toasting, and get your perfectly toasted bread. This is exactly what a library does - as an end developer, you don't need to worry about the technical implementation of the task. Even if you do know how it works, you don't need to code it yourself. Instead, you just need to pass the required parameters and get the output you need.

Library Use case

If you have an application that shall be connected to a database located on the server, the application must follow these steps:

1. Listening to a socket

2. Accepting connections

3. Getting access to the streams (data) represented by a connection

As a developer, you might think that you need to create every single step of your code from scratch to get the data you need. However, there are many pre-written libraries available that can perform the same functions. All you need to do is pass the required parameters to these libraries, and you will get the data you need without having to start from scratch.

Using libraries can save you a significant amount of time and effort in your development work. The advantages of using a library are obvious:

  • Time-saving: There is no need to reinvent the wheel when you can use a pre-existing library that already does the job.
  • Reusability: You can reuse pre-written libraries made by you or other developers.
  • Modern applications are so extensive that it's almost impossible to create them without the use of libraries.

Like everything in the world, libraries have their advantages and disadvantages. The following are some of the disadvantages of using libraries:

  • Human Error: Since libraries are pre-written by developers, they may contain bugs that can cause issues in your application.
  • Complexity: Libraries can have a lot of tasks, and you may not need all of them. Therefore, you should consider which libraries your application depends on and have control over its structure.


The Framework

In the given scenario, you have a metal ingot instead of a toaster. The metal ingot does not have any mechanism for toasting, buttons for different toasting modes, or slots for putting bread. However, you have all the necessary tools to build your own toaster including buttons, push buttons, different mechanisms, and other required tools. Your task is to shape the metal ingot to match your toaster design and come up with a solution to make the toaster function properly. By using these tools and your creativity, you can build your own toaster and get the final product you desire.

A framework provides you with the necessary tools to create an application that has unimplemented functions. In software engineering, we define "a framework as open or unimplemented functions or objects that the user writes to create a custom application. "

As we mentioned in the library context, you have the control to call and use which library to perform a specific task. However, in a framework, the framework has the control to call and use your written code to complete the task.

Writing your own library is different from using a pre-made framework that is designed for specific platforms. With a framework, you are provided with supporting libraries and tools to help you focus solely on your solution. As we mentioned in our scenario, you have all the necessary tools to build a toaster.

When it comes to software engineering, the framework has a wider scope compared to libraries as it provides a comprehensive set of tools and functionalities that can be used to build custom applications.

In our scenario, you have the ability to build a standalone toaster. However, if we need to incorporate the toasting function into a more complex device, such as a French toast maker, the toasting mechanism will be different and require alternative tools. To achieve this, you can use a pre-built library to handle the toasting task alongside the framework tools to construct your French toast toaster.

Framework Use case

To better understand the concept, let's take a look at Flutter as an example. Flutter is a framework developed by Google that allows you to create applications for multiple platforms using a single codebase. With Flutter, you don't have to build every component from scratch, as it provides all the necessary components for both the user interface and your codebase. Additionally, you can use other libraries developed by others to handle specific tasks.

We can determine the benefits and drawbacks of utilizing a framework by analyzing its features and functionalities.

The advantages

  • High-quality development, Speeds Up programming time: the framework provides standard, low-level functionality so that developers can focus efforts on the elements that make the project unique.
  • Save time, effort, and money

The disadvantages

  • Less freedom: you can't edit or change the code that is included in the core of the framework.
  • Performance: It may affect the performance of the project as most of the frameworks are made for large-scale projects so it may have a bad impact on small-scale one

Wrap-up

Finally, Is it possible for a developer to build an app without a framework? Yes, but does it require a lot of time and effort, even for a small-scale project? Yes, This is why frameworks are important, as they provide all the necessary components and tools for development.


I'd love to hear from you. Whether you want to leave a message or drop a comment, I'm all ears! Don't be shy, let me know what's on your mind.
Excited for the next article? Let me know what you want to read. Stay curious and open-minded. Share topic suggestions if you'd like.

#concepts #softwareenginnering #devwizAN #makeitClear #libraries #framework        



要查看或添加评论,请登录

Ahmed Nobi的更多文章

社区洞察

其他会员也浏览了