Marisabel Munoz

I code. I write. I draw. I learn. I love.

My Java Progress Update

I am back! I was not gone. I was still learning a lot but finding it difficult to write anything meaningful over the mess in my brain. Today, however, I sit down to share my latest success and lessons these past 2 months.

SQL World

I learned a lot about SQL and applied this to my journal project. I also dedicated quite some time to join the tables and be able to manipulate and access the data in them. It was quite the challenge but I got the hang of it. Though I am no SQL expert, I know now my way around it and how to find what I need.

I never thought I would find SQL so fun. I want to continue working on my projects just so I can integrate databases into them. I do have in my list to play with data via Java from SQL and am looking forward to that!

Java Generics and Collection

This kept me busy for so long. It is insane and I still only understand half of it, which is more than last month. I am not sure why we use so much technicality for things that can be explained simpler. Is it our ego? Who knows.

What are Generics? The name does not make sense. But the simple explanation is:

Generics allow type check at compiler time. It is NOT that we can use ANY type, but that the IDE/Compiler will tell us if it is invalid before it runs!

It took me a whole month to understand that simple key concept.

What about collections?

Collections are classes for accessing and manipulating data.

They are based on interfaces and generics classes, hence they are often taught hand in hand. However, I was totally lost until I finally understood what Generic was. I won’t go into details as Collections is such a big subject I am still studying them. I finally got Arrays, Array Lists, and Linked Lists down. I still need to understand the others. But I found taking one subject at a time does help a lot.

Journal Project

I spent the last 2 weeks of February working on my journal project and made great progress thanks to the new understanding of SQL. It still needs a lot of work. But my goal is to make it fully functional from the terminal first. And hopefully, next year when I want to work on GUI, I can then translate it. For now, I am having a lot of fun. The code is online in my repository.

Exception handling

After almost 2 weeks break, I skipped the JavaFX part and gave Collections a break in order not to lose motivation. If you get stuck learning something, give it a break, move to something else and come back when you feel better about yourself. No one is stupid, we all learn at different phases. So I accept that Collections will take me much longer due to Algorithms but that won’t stop me from learning other things.

I finally understand Exception handling (I’ve been just following the IDE’s suggestions) and managed to implement them properly on both my projects when receiving wrong input and it works! After months of trying to find a way to stop my program from crashing when receiving a character instead of an int! I made so many happy dances when I fixed one and then when I fixed the other. I am so happy to see my programs do not crush anymore I had to start my own “Java recipes” notebook to make sure I save the code.

Input Validation Class to request input again if wrong:

import java.util.InputMismatchException;
import java.util.Scanner;

public class InputValidation {

    public static int getInt() {
        Scanner scanner = new Scanner(System.in);
        while (true) {
            try {
                return scanner.nextInt();
            } catch (InputMismatchException e) {
                scanner.nextLine();
                System.out.println("Please enter a number.");}}}}

Leave a Reply

Your email address will not be published. Required fields are marked *