Overview
Backend Career Project
Last Saturday, 9/9, I embarked on Day 1 of the YC Tech Academy Back-end Career Project. Spanning 10 weeks, this venture is a collaboration between Yonsei University Institute of Continuing Education for the Future and CodePresso. It aims to provide a hands-on back-end experience, helping participants like myself step closer to our goal: becoming proficient back-end developers.
Blogging My Journey
To enhance my learning, I've committed to writing two blogs every week: a review after each class and a preview before the next. (It is also a requirement for the course ;P)
I'll be focusing on back-end development using Spring Boot and databases like MySQL. But I won't stop at code. I'll also dive into the fundamental architecture of web development.
Week 1: REST API and Spring Boot
Our first lecture delved into the world of REST API, REST web structures, and Spring Boot. By the end, we had crafted a spring boot app with REST controllers.
Setting Up the Development Environment
Our first step was to configure our individual development environments:
JDK 17 or 20: I opted for 17, the latest LTS version at the moment.
IntelliJ Ultimate: A renowned IDE for Java. Thanks to my student credentials, I got access to the Ultimate edition.
GitHub: While a few beginners were setting up their accounts, I had mine ready, streamlining the process.
Understanding REST API
At the heart of many applications, the backend is responsible for managing data, letting users create, read, manipulate, and delete data. APIs, or Application Programming Interfaces, play a pivotal role in this. One of the most prevalent forms is the REST API, conceptualized by Roy Fielding to amplify HTTP usage.
Characteristics of REST
REST has 3 components: Verb, Resource, and Representation
Verb: Dictates the action of the called API.
Resource: The specific data or entity targeted by the API.
Representation: How the API presents itself.
REST has several characteristics that make it a popular choice for many backend developers.
Uniformity: With a consistent interface, creating access points becomes straightforward.
Statelessness: No need to retain previous interactions. Just process the incoming request.
Cacheability: Leveraging web architectures, REST doesn’t demand restructuring.
Self-Descriptiveness: Messages are intuitive and easy to interpret.
Client-Server Separation: Distinct roles for each simplify the architecture.
Hierarchical Structure: Ensures flexibility and compatibility.
Introducing Spring Boot
Our primary tool for this course will be Spring Boot, a robust Java-based framework branching from Spring, equipped with a plethora of back-end development tools. Why is Spring Boot a top pick for developers?
Spring has some characteristics that makes it a popular choice for backend development:
Inversion of Control: Allows developers to outsource object creation and management.
Dependency Injection: Spring's way of ensuring an object's dependencies are met.
AOP (Aspect-Oriented Programming): Enables modularization of cross-cutting concerns.
Supports MVC Web Architecture: A holistic approach to building web applications.
Unraveling MVC
MVC, or Model-View-Controller, is an architectural paradigm:
Model: Manages the data.
View: Defines how the application appears or its UI.
Controller: The linchpin connecting the Model and View, often via APIs.
Documentation and Management
Regardless of expertise, navigating and debugging software is an intricate art. Comprehensive documentation can be a game-changer.Writing documentation helps with multiple areas
Project Management: Facilitates a unified vision and code synergy among developers.
Feature Development: New features need insights into the existing application's workings.
Debugging: Good documentation can be a roadmap to trace and fix bugs.
Modern tools, like Swagger, have revolutionized documentation. My recent experience with Swagger in a hackathon amplified our team's productivity. With innovations like ChatGPT and AI, documentation becomes even more accessible, emphasizing its significance for all projects, including personal ones.
Spring Boot App Initialization
Our hands-on exercise centered on creating a REST API-powered application using Spring Boot.
Spring Init
Set the stage by establishing our development environment and integrating key dependencies like Spring Boot DevTools, Lombok, Apache Freemarker, and Spring Web.
Crafting Controllers
Post-initialization, we dived into controller creation. I devised a "HelloController.java" in a new 'Controllers' folder. The goal? To display "Hello, {name}" through the endpoint "/v1/hello?name={name}".
The following was the code in the new java file created:
package com.example.demo;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping(value="/v1")
public class HelloController {
@RequestMapping(value="/hello")
public String hello(@RequestParam(name="name") String name){
return "Hello, " + name;
}
}
When running the app with this controller, you can call a curl function as below to get "Hello, TooSalty":
curl localhost:8080/v1/hello
Conclusion
Our inaugural week laid the groundwork with basics of REST API and Spring Boot. While the material seemed elementary, I'm preparing for a progressive climb in complexity. Building a robust foundational understanding is paramount for the challenges ahead.