mdohr's logbook

IT retraining week sixteen and seventeen: it was a lot (of theory)

The last two weeks have been a bit blurry. There was a lot of new information in a short period of time, with a bit of practice here and there, but overall, it was mostly theory. It's all still a bit confusing in my head, and I didn't feel like blogging about it. So here's a summary of the last two weeks in one post.

During these two weeks, the main focus was on how to use Java with databases. Specifically, how to connect to a database, read and manipulate data, and how to structure it all. We also learned about the DAO principle and heard about POJO for the first time. Grasping all of this within just the first week was already a challenge, and I don't think anyone in the class felt confident using it— we all need to go back and check how to do certain things. Fortunately, this was reviewed in the second week, but together with several other topics that were more or less related to DAO, but only in parts.

For example, MVC. At first, I didn't understand the difference between DAO and MVC. And then there's something that sounds almost the same, namely MVP! But let me explain the terms mentioned so far:

DAO - Data Access Object

The Data Access Object is a design pattern that helps retrieve data from different sources. It ensures that you can easily swap the source of the data without needing to change the entire process.

MVC - Model View Controller

Another design pattern, used to divide a software application into three components: Model (data model), View, and Controller. The View never interacts directly with the DAO but only receives data through the Controller.

For Overview

DAO Database logic and communication, as well as abstraction of data access. Part of the MVC model.
MVC Application structure. Contains logic for interaction and presentation.
Model Data structure
View Presentation
Controller Logic

MVP - Minimal Viable Product

Only the essentials needed to create a functional product. So, while it may not have all the features, it is at least usable.

Moving on. We also spent some time learning about date and time in Java, and about LocalDate, LocalTime, and LocalDateTime. But I won’t go into that further here.

Persistence and Build Process

Another important topic in the past two weeks was persistence — the permanent storage of data. For example, in a database. We also talked about build tools and build processes. I'm already familiar with this from web development, especially from the Astro Framework, which my website was running on until recently.

A build process roughly refers to a procedure through which a finished application is automated.

CRUD and ORM

CRUD is another term that came up. It stands for Create, Read, Update, Delete. These are basic and common operations that are used repeatedly, especially in relation to databases. We worked with these ourselves, and CRUD kept coming up whenever we interacted with the database.

    // Create
            sql = "INSERT INTO movie (title, score) VALUES ('The Lord of the Rings', 10)";
            int rowCount = statement.executeUpdate(sql);
            System.out.println("INSERT row count: " + rowCount);

    // Read (SELECT) Query
            sql = "SELECT * FROM movie WHERE year = 1999";
            ResultSet resultSet = statement.executeQuery(sql);

    // Update
            sql = "UPDATE movie SET year = 1999 WHERE title = 'The Lord of the Rings'";
            rowCount = statement.executeUpdate(sql);
            System.out.println("UPDATE row count: " + rowCount);

    // Delete
            sql = "DELETE FROM movie WHERE director IS NULL";
            rowCount = statement.executeUpdate(sql);
            System.out.println("DELETE row count: " + rowCount);

Mapping is the process of transferring data from one format or system to another. We mostly dealt with Object-Relational Mapping (ORM). This is a technique to map data between relational database tables and objects in object-oriented programming. In short, ORM connects tables with objects.

I have more bullet points for this blog entry, like database interfaces and APIs, POM files, beans, data streams, XML, and JAXB. Serialization, JSON, and REST. But I don't feel like explaining all of them here.

send help, please

However, I do want to briefly talk about JSON, because I'm glad to finally be at this topic. JSON is also something I’m familiar with from web projects, and it’s definitely nicer than XML. Sorry, XML.

JSON is a compact data format for exchanging data between applications and is independent of programming languages. In simple terms, you can store data in a JSON file and read it. JSON is also quite easy for everyone to read and write.

{
  "title": "A Night at the Opera",
  "artist": "Queen",
  "released": "21.11.1975",
  "price": 10.99,
  "record_label": {
    "name": "EMI Records",
    "country": "United Kingdom"
  },
  "songs": [
    "Death On Two Legs (Dedicated to...)",
    "Lazing on a Sunday Afternoon",
    "I’m in Love with My Car",
    "You’re My Best Friend",
    "39",
    "Sweet Lady",
    "Seaside Rendezvous",
    "The Prophet’s Song",
    "Love of My Life",
    "Good Company",
    "Bohemian Rhapsody",
    "God Save the Queen"
  ]
}

APIs

One topic that will remain important is APIs. This stands for Application Programming Interface. It’s a software component that allows you to connect other programs to a software system. In other words, it’s an interface— a connection.

We will soon start our individual projects, for which we need to choose an API to work with. I’ve already looked around, but I’m still unsure what my topic should be. Everyone I’ve asked in my class already has an idea. For example, collecting and displaying Clash of Clans data, or creating a plant database to figure out when certain plants should bloom and be planted. We’ll have two weeks for implementation, and before we start, we’ll finally learn how to build a web application with Java that you can actually interact with on a web interface. I'm really looking forward to that.

Reply via E-Mail


Music: Cyan Reader - GHOST DATA
Mood: content

#IT retraining