user1675564
user1675564

Reputation: 43

Applications of Frameworks

I have read enough posts on what a framework is and how it is different from a library..including the Inversion of Control.

Just one question left unanswered Are Frameworks only for User Interfaces, Where the framework keeps listening to User requests and then call programmer's custom code when needed? Can someone please provide example of any other type of framework which is not for GUI? Like java or C++ codes always start with Main() and follow the path set by the programmer..

Upvotes: 1

Views: 32

Answers (1)

TwiN
TwiN

Reputation: 3824

The Spring Framework is one such example.

Also, I think you might have misunderstood inversion of control. In very simple terms, it means that instead of the programmer being in control of what happens, it's the framework. So while it's true that it starts with a main, it doesn't necessarily mean that the user is in control of what happens

The way that the Spring Framework works is actually very simple from the programmer's perspective - you can add features by using the proper annotations e.g. @Controller, @Service/@Component, @Configuration, etc. and if you want to modify Spring's behavior, you generally override the beans by declaring a @Bean on a method that returns the type of the class you want to override. e.g.:

@Bean
public PasswordEncoder passwordEncoder() {
    return new BCryptPasswordEncoder();
}

In this example, you wouldn't have to do anything other than that, because the Spring Framework will take care of detecting all @Bean annotations and adjust itself accordingly.

That's just a rough explanation on how the Spring Framework works, but it should help you understand a little better.

Upvotes: 1

Related Questions