September 29

Technical Interview Questions: Java, Week 4

  • What is the difference between an abstract class and an interface? Describe why you would use one over the other, and walk trough an example use case.

You cannot create objects directly from either an abstract class or an interface. Their similarity ends there though. To use an abstract class you extend the class. To use an interface you implement it. With an abstract class you have methods with default behavior that can be overridden. With an interface you have empty methods that you MUST override (or it throws errors) in the class that implements them.  You can only extend one class, but you can implement multiple interfaces.

I would use an interface when I want to make sure certain features are included. I would use an abstract class when I wanted to inherit fairly standard functionality from my parent class.

  • What is polymorphism? How does it apply to programming?

Continue reading

Category: Career Change, Interview Questions, Java, PostgreSQL | Comments Off on Technical Interview Questions: Java, Week 4
September 24

Java – Week 3: PostgreSQL

Screenshot of 3rd week, 2nd class independent project
1150 lines of Java (360 of which are tests), 280 lines of HTML, and 13 lines of CSS later…my final project for the week has been turned in.

We can finally persist data!

Kinda… on the computers at school, not on the internet.  We don’t always get the same computer. But I have a backup file and can carry the data between school and home for when I re-run the program.

This project took me ALL day, and then some. Maybe 9-10 hours. I came in early, took a short lunch, stayed late. REALLY would have preferred to stick around another hour or two to get those appointments working too – but dinner and my boyfriend decided to drag me away. Continue reading

Category: Learning | Comments Off on Java – Week 3: PostgreSQL
September 22

Technical Interview Questions: Java, Week 3

We started getting interview questions this week on Thursdays… here is the first set for Java:

  • Talk through the following method line by line. What is happening here?
    public void save() {
      try(Connection con = DB.sql2o.open()) {
        String sql = "INSERT INTO Categories(name) VALUES (:name)";
        this.id = (int) con.createQuery(sql, true)
          .addParameter("name", this.name)
          .executeUpdate()
          .getKey();
      }
    }

This is a function/method that saves a value to a database. The first line establishes a connection to the database, the next assigns a SQL statement that adds a name into the categories table, the next (up to the next semi-colon) runts the query and assigns the new id from the table to “this.id”.

  • Discuss the difference between POST and GET. When do we use a POST route, when a GET?

Continue reading

Category: Career Change, Interview Questions, Java, PostgreSQL | Comments Off on Technical Interview Questions: Java, Week 3
September 17

Spark Framework

This week we learned all about how to use the Spark framework with our projects. I love it! I really like having that web-page front end on my projects and don’t miss the days of terminal programs at all.

The only thing is that Spark “isn’t used in the real world” and so I wonder why are we learning it instead of, say, Spring… which IS used out there in real jobs. There are courses on Treehouse for Spring, so I’m going to make sure I know how to use that framework as well.

The week was uneventful. Everything seemed to line up just right and run smooth. I feel like I’m not working hard enough. The end of the week project was a dictionary with two objects: words & definitions. We were supposed to make it so that each word could have one or more definition. I had that done in about an hour and had to find a way to entertain myself for the rest of the day. It all just seemed too easy.

Continue reading

Category: Epicodus, Java, Team Treehouse | Comments Off on Spark Framework
September 10

TDD and BDD

Here I am at the end of the first week of Java. I survived! I was a little worried about how to get through a whole week with no front-end stuff to keep me busy.

They decided to rewrite this course and take the front-end stuff out of the first week so that we could focus on the fundamentals of Java and of “Behavior Driven Development”. (AKA BDD, or TDD in some circles). Continue reading

Category: Epicodus, Testing | Comments Off on TDD and BDD