Wednesday, September 11, 2024

CST363 - Week 2

This week we were tasked to answer the following questions

SQL has the flexibility to join tables on any column(s) using any predicate (=, >, < ). Most of the time the join will use equality between a primary and foreign key. Think of example where joining on something other than keys would be needed. Write the query both as an English sentence and in SQL. If you can't think of your own example, search the textbook or internet for an example.

I think one way to look at this in English would be sales in a store. For example, we want a list of the total stock of a product along with the total number of that product the store has sold.

In SQL, I think it would look like this:

SELECT p.product_name
    SUM(p.quantity) AS current_stock
    SUM(s.quantity AS total_sold
FROM products AS p
LEFT JOIN sales AS s ON  p.product_name = s.product_name
WHERE p.product_name = 'apples'
GROUP BY p.product_name;


What is your opinion of SQL as a language? Do you think it is easy to learn and use? When translating from an English question to SQL, what kinds of questions do you find most challenging?

Aside from the basic SELECT SQL problems, I find SQL fairly difficult to understand compared to languages like Java or Python for some reason. I particularly struggle with JOIN problems and often have to refer to documentation. There are other aspects that I constantly get mixed up, and it just doesn't come as easily to me for whatever reason.

Tuesday, September 3, 2024

CST363 - Week 1

Relational database tables and spreadsheets look similar, as both have rows and columns. What are some important differences between the two?

In relational databases, data is organized into tables with defined keys (such as foreign keys), whereas spreadsheets organize data in rows and columns without utilizing any keys.


Installing and configuring a database and learning how to use it is more complicated than simply reading and writing data to a file. What are some important reasons that make a database a useful investment of time?

Using constraints (like primary and foreign keys) allows for consistent and accurate data. Spreadsheets do not have this feature, which can lead to errors. Databases can also handle large amounts of data and facilitate easier scaling in the future.


What do you want to learn in this course that you think will be useful in your future career?

Databases are incredibly useful, and although I don't have much experience now or a clear idea of how I will use them going forward, I always enjoy learning and expanding my knowledge.

Tuesday, August 6, 2024

CST 338 - Week 7/8

 Take a look back at Homework 1: Histogram

After reviewing my work on this assignment, I don’t think there is much I would change about my process. Creating the display was the most challenging part, but I was reading Java documentation and watching videos and came across the LinkedHashSets, which made the process significantly easier. One change I might consider is using a single for loop in my bubble sorting algorithm. A teammate suggested this could be achieved by using a boolean to check if the array is sorted. Additionally, the only other change I would make is using the .repeat method to print a string of characters a set number of times, rather than having a long print message.


Highlight some of your victories

I came into this class with only surface-level knowledge of Java and no experience with Android development. Overall, I now feel fairly comfortable working in both areas, though I still need to look things up pretty often. One area where I've noticed improvement is in understanding the basics of Java. Additionally, although it might seem basic, I've also improved my understanding of HashMaps. Initially, I found them confusing and often mixed up keys and values, so I had to frequently check the documentation and explore the methods available.


Tuesday, July 23, 2024

CST 338 - Week 5

This week, we worked on a Markov Text Generator, which creates new sentences from a list of random words taken from a text file. After completing the homework assignment, we were tasked with reviewing each of our teammates' code for the Markov assignment.


Who did you work with?
My teammates Alan and Abdul.


What was your strategy for solving the Markov assignment?
I began the assignment by creating a skeleton for the class and then read the prompt for each method to think about how I wanted to work through it. I then implemented each method one at a time, not moving forward until the tests for each method passed. I did run into an issue trying to pass the addBadLineTest(), but that was due to me only accounting for the extra whitespace at the beginning and end of each line.


What was their strategy for solving the Markov assignment?

Abdul: "I started by making sure I understood what the assignment was asking for and what the goal was. Instead of writing the code, I took some time to think through the structure and logic. This helped me get a clear understanding of how to combine the statements and methods for completing the assignment." 

Alan: "I started by creating a skeleton of the Markov class, including all of the fields and methods in the assignment description. I then implemented all of the methods for creating the dictionary of words, and then later implemented all of the methods for generating sentences. Lastly, I worked through the two failing tests one at a time to fix the handful of bugs/missing features that they found."


How would you change your strategy having worked on the assignment?
I don't think I would change anything about my strategy process for writing the code. However, I did notice two of my teammates using a BufferedReader instead of a Scanner like I did. I am curious if that might be more efficient for completing this assignment, especially if we had a larger file to read from.


According to your classmate(s): how well does your code follow the Google Java Style Guide

Abdul: "Method names are clear and follow camelCase conventions. The code is clean, well-indented, and uses braces properly, aligning with style guide standards. Its logical flow is straightforward, making the code easy to read and maintain."

Alan: "The only thing that I could find is that the style guide asks for a blank line between the paragraph and the tags for javadoc ( §7.1.2)."

Tuesday, July 16, 2024

CST 338 - Week 4

This week we got together with teammates and reviewed each other's code for project 1.

You can work with up to three people (you MUST work with at least one other person)
1. With whom did you work?


I worked with Alan and Abdul.


What was your strategy for solving the assignments?
Did you start writing code right away? Did you plan it out on paper?


For the first 3 parts of the project, I didn't plan anything out, I read the prompt and took it one piece at a time, never moving on until I finished the first part. For the final part of the project, I just wrote everything and then dealt with the errors and bugs later. 

What was THEIR strategy for solving the assignments?

I would say me and Abdul took a similar approach and took it one step at a time, and Alan opted to write a skeleton for each class and then work on implementing it.

How would you change your strategy after having worked on the assignment?

Honestly, I don't know. I had a lot of trouble with the Library.java class, but the others went smoothly. So, I don't think I would change much. I did mess up writing another class by not paying close enough attention to the prompt, so I guess I will pay closer attention in the future.

According to your classmates, how well does your code follow the Google Java Style Guide?

There were a few issues with my code such as using 4 spaces for indentation, a column limit of 100, line-wrapping, and braces for if statements even when it's a single line.

We also learned we can automate some of the Java style guides in Intellji https://medium.com/swlh/configuring-google-style-guide-for-java-for-intellij-c727af4ef248.
 I never used JetBrains before this class, but I love them now!

Tuesday, July 9, 2024

CST 338 - Week 3

Feedback received about my Histogram Java code

Abdul brought to my attention that I can use append("=".repeat(29)) instead of creating a long string of equal signs. He noted my variable names, comments, and formatting were all good.

Alan mentioned that I could implement the bubble sort algorithm with a single loop by utilizing a boolean that tracks whether we changed the list on the previous pass. He also mentioned that my imports should be replaced with individual imports for each utility to increase readability and compilation time.

Farooqkhan mentioned he had no issues with my code's logic, formatting, variable names, or comments.


Identify any trends you noticed when evaluating the code of others

After viewing everyone's code, and reflecting on my own, I would say the thing it seemed everyone struggled with was creating the display and getting it to work according to the assignment specifications.


Was any part of the code a struggle for YOU?

Yes, I found the display to be difficult to display properly. It took me hours and trying a bunch of different things before I managed to get it to work.


Was any part of writing the code easy for YOU?

The sorting algorithm was not particularly difficult. I had never used a bubble sort algorithm prior, so I had to research it, but I found it easy to implement and understand.


What is your biggest victory?

My biggest accomplishment was completing the assignment on time and having my display work correctly.

Tuesday, July 2, 2024

CST 338 - Week 2

This week we worked on parts 1 (Book.java) and 2 (Reader.java) for our first project in the class which stores, manipulates, and analyzes information stored within a library. I didn't really have any issues, except for not realizing there was an enum class I needed to use. We will finish up Project 1 in the coming weeks by completing Shelf.java, and Library.java.


We also had to complete our first heavy homework assignment, Histogram, which reads a text file from a user and displays a histogram from the occurrences of characters in the file.

I never really ran into issues passing the unit tests, but I spent too long trying to implement a solution for taking the numbers from counting the letters, removing all duplicate numbers, and then printing them in descending order, so instead of 1 2 3 4 4, it printed out 4 3 2 1. I imagine I was overcomplicating the solution and there was a much simpler way to go about it. 

After trying a few different solutions and still having trouble, I thought I would use a HashMap to store the unique numbers as keys and then return those unique keys. However, I still encountered issues. While working to figure out what was wrong with my HashMap, I learned about LinkedHashSets and how they don't include repeating elements, and return the output in the same order it receives the input. This solution ultimately worked for me, but again, I feel I was overthinking the problem, and there was probably an easier way.

Going forward, I will try and spend a little more time thinking of possible ways to solve the problem and why my current approach is not working, instead of getting frustrated and constantly going through numerous methods to solve the problem.


CST489/499 - Week 16

This marks the end of my journey in the CSUMB CS Online program. I will officially graduate and receive my bachelor's degree in Computer...