English
[Interview Question] Frameworks and Libraries (Feat. ChatGPT)

[Interview Question] Frameworks and Libraries (Feat. ChatGPT)

Organizing interview questions about Frameworks and Libraries

Introduction

This time, I was asked this question for the first time in an interview, and although I honestly thought I knew the answer, I couldn't answer it clearly and ended up giving an alumni answer... So, I'm writing this article to know a little more clearly, thinking that I shouldn't do that next time!

Library

A program designed to perform a specific function by modularizing functions that can be used commonly in development.

Framework

A collection of classes and libraries with multiple functions that are put together to achieve a specific result.

ChatGPT's answer

The above definitions are what I personally thought were close to the correct answers after reading several articles. However, something felt incomplete and I wanted a more detailed answer, so I decided to utilize ChatGPT!

  • Definition of Library

  • Definition of Framework

So what's the difference?

If we go back to the answer above and look at Frameworks and Libraries, we can see that the

  • Library

Collection of reusable code and resources Organized into functions, classes, methods, data types, etc.

  • Framework

A structured framework or platform for developing software. Consists of predefined code and libraries

It's hard not to look at this and wonder. If frameworks can contain libraries, why can't libraries contain frameworks?

As expected, it turns out that frameworks can contain libraries, but not vice versa. The article also highlights an important difference between frameworks and libraries.

It's the control of code flow. In the case of a library, the developer calls the library's functions and uses them, but in the case of a framework, the developer's methods are called by the framework.

The form that appears in a framework is called IoC (Inversion of Control). Since it is related to Dependency Injection, I won't write much about it because I think there will be something else to write about.

Conclusion

  • A library is a collection of reusable code and resources, while a framework is a structural framework or platform for development. They generally work similarly in terms of functionality, so the difference is in how they are used.

  • Frameworks can contain libraries, but libraries cannot contain frameworks. Control of the code flow is in the hands of the framework and the developer in the hands of the library, so it's generally not possible for a developer to modify a framework, while a library can be customized by the developer as needed.

See also

Kareyou's Blog ChatGPT 3.5

댓글 작성

게시글에 대한 의견을 남겨 주세요.

댓글 0