Lec 1
Lec 1
Framewor
ks and
Tools
• Understand the difference between
Frameworks and Tools
• Practice with some web and
database application development
Course frameworks
objectives • Practicing with machine learning
development framework
• Exposure to some tools for code
building and versioning
• Midterm Exam: 20%
• Final Exam: 40%
Course
• Project: 10%
Grading
• Quizzes/Periodic Exams/HomeWorks:
System 20%
• Lab : 10%
• Don’t be late to class
• Don’t raise hand to go out during the
class
• Must be active and take notes during
Students class – don’t be a guest!
• Write down your questions, think
Obligations about it, then ask when appropriate!
! • Must spend 3 hours minimum
weekly doing self-study ,homework ,
revision, practice … etc
4
Key Topics to be covered in the
course
• Brief theoretical background about Frameworks/Tools
• Webservices/Microservices and APIs theoretical background
• Spring Boot Framework in depth
• Different annotations
• Microservice development
• JSON based end points
• Pages rendering (Thymeleaf /Flutter .. )
• Machine Learning theoretical background
• Pytorch Framework in depth
• Model development
• Training and prediction
• APEX low-code development framework for web application
• Building simple data-driven dashboard
• Exposure to simple PL/SQL
Frameworks & Tools
What is Software Framework?
• A framework is a reusable structure that provides a base for the
application development process. With the help of a framework, you
can avoid writing everything from scratch. Frameworks provide a set
of code and libraries that help in speeding the development process.
• It provides structure, tools and templates that can be used and
even modified/extended to meet project requirements.
• Frameworks are based on programming languages. Few examples:
• Spring Boot (Java),
• Pytorch (Python),
• Angular(Type Script)
… and many more!
Software Dev Frameworks
Characteristics
• Reusability: A framework provides reusable components or modules
that developers can reuse across multiple projects, reducing
redundancy and saving development time.
• Example: Spring Boot provides reusable components such as Spring Data JPA for database operations,
Spring Security for authentication/authorization, and Spring Web for creating RESTful APIs.
Execution Focus × Maven is focused on building and preparing applications, not their runtime behavior
Community and Maven has a large community and extensive documentation, ensuring robust support
Support ✓ and frequent updates
Inversion of Control (IoC)
• inversion of Control (IoC) is a programming principle where
the control of object creation, lifecycle management, and
dependency resolution is transferred from the developer
(manual control) to a framework.
• This principle is a cornerstone of frameworks like Spring and
promotes loose coupling between components.
Key concepts of IoC:
• Control is Inverted: traditionally, the developer writes code to instantiate
objects, manage dependencies, and invoke methods. In IoC, the framework
takes over this responsibility, and the developer provides instructions or
configurations about what to instantiate and how.
• Dependency Injection(DI): this is a common technique to implement IoC.
Dependencies (objects a class depends on) are "injected" into the class by the
framework instead of the class creating them itself.
Inversion of Control (IoC)
Key concepts of IoC (cont):
• Decoupling: IoC decouples the application’s components from each other,
making the codebase more flexible and easier to test.
• Lifecycle Management: The IoC container manages the lifecycle of
components, including their initialization, configuration, and destruction.
@SpringBootApplication
public class MicroserviceApplication {
public static void main(String[] args) {
SpringApplication.run(MicroserviceApplication.class, args);
}
}
Controller
• A controller in Spring Boot application is a key component of the
Model-View-Controller (MVC) architectural pattern. It is
responsible for handling HTTP requests, processing them
(often with the help of a service layer), and returning an
appropriate response to the client.
• Controllers are typically used to expose RESTful endpoints in a
Spring Boot application.
• A controller must be annotated with @RestController
@RestController
public class MyController {
…
}
Annotations within Controller-
@GetMapping
• The @GetMapping annotation is used to handle HTTP GET
requests. It is commonly used to retrieve data or resources from
a server. This is a key part of building RESTful APIs.
@RestController
public class MyController {
@PostMapping("/users")
public User createUser(@RequestBody User user) {
return userService.save(user);
}
}
@RestController
public class MyController {
@DeleteMapping(path = "/beans/{id}")
public void deleteBean(@PathVariable int id) {
…
}
}
• Notice the usage of @PathVariable to extract values from the
URL in a request.
Annotations within Controller-
@PathVariable
• The @PathVariable annotation is used to bind the placeholder in
the URL path to a method parameter in your controller.
@RestController
public class MyController {
@GetMapping("/{id}")
public String getUserByCustomId(@PathVariable("id") Long
userIdentifier) {
return "User ID: " + userIdentifier;
}
}
Annotations within Controller-
@Autowired
• The @Autowired annotation is used for dependency injection. It
enables Spring to automatically inject the required bean (object)
into a component, such as a controller, service, or repository.
• Three types of injection:
• Field Injection
• Constructor Injection
• Setter Injection
Exercise