vardaansinha / vsstudent

MIT License
0 stars 0 forks source link

FRQ Connections to PBL with Reflection #39

Open vardaansinha opened 6 months ago

vardaansinha commented 6 months ago

Show how FRQs or principles of FRQs are incorporated into to your final project.

FRQ 1:

This FRQ was centered around 1D & 2D Arrays along with ArrayLists. The main point of the FRQ is to check whether or not elements of an array are diverse. Such operations are pretty important in any Java implementations, as many projects store arrays of information in a two-dimensional format. Let's take a look at how there were principles of ArrayLists & arrays implemented into our final project. For Person.java, which is important for account creation and management, an ArrayList is used to represent user roles: ```java import java.util.ArrayList; import java.util.Collection; import jakarta.persistence.ManyToMany; ... @ManyToMany(fetch = EAGER) private Collection roles = new ArrayList<>(); ``` During the creation of the object, an ArrayList is assigned to the "roles" field so that it can store PersonRole objects. Since the ArrayList is stored as a **collection** it will be able to store multiple user roles. In our project, we have not yet implemented the different roles that a user can have, but this is a good baseline that we will utilize in Trimester 3. For the specific implementation in mind, currently, we only have a Fantasy Basketball matchup that you can do one team at a time. However, during Trimester 3, we will work on making it so that there is a LEAGUE MANAGER role (the person who can create and manage the rules of the league) and then a basic role, for users who are simpy joining a fantasy league and competing. This ArrayList format will be used to accomplish this, which is the connection between the FRQ and PBL.

FRQ 2:

This FRQ was based on class creation and a word guessing game. Essentially, there would be a set word that a user is trying to guess, and based on each guess, the computer would output back hints based on asterisks or plus signs - depending on whether or not a particular letter they guessed is in the word or not. Java is very useful for such a program, as it is good for string manipulation. Throughout our PBL, we have gone through the process of creating classes with this same basic structure - it is likely the FRQ with the most overlap with PBL, as it is one of the most basic yet essential Java skills required to create a functioning backend. Here is one example of a basic Java class implementation in our final project: ```java package com.nighthawk.spring_portfolio.nbapredictor.monte_carlo; public class Player { private String name; private PlayerStats stats; // Getters and setters public String getName() { return name; } public void setName(String name) { this.name = name; } public PlayerStats getStats() { return stats; } public void setStats(PlayerStats stats) { this.stats = stats; } } ``` In our fantasy basketball project, this was the Player.java file, where we initialized the getters and setters for the player object. The anatomy of the class was simple - it was a public class, with private instance variables, along with setters and getters.

FRQ 3:

This FRQ had implementations of 2D arrays - mainly sparse arrays. Sparse arrays are mainly used so that it can allow for easy manipulation of data stored inside of an array.

In our project, we have not implemented too many sparse arrays or 2D arrays, as we are storing most of the fantasy basketball data in different ways (sending JSON data in 1D array to the backend), but there are a couple of different ways we could implement this into our project if we wanted to: We could make it so that team rosters are stored to a user in the form of a 2D array - the array could be initialized to have a fixed number of players based on how many are allowed on a team. Furthermore, for the drafting process, we could implement code that would allow for situations where a roster array is not completely full - sparse arrays. Sparse arrays, which handle such situations by storing null references or other default values, will help when there are empty slots on a team. Furthermore, the array size will dynamically change based on how many players have been drafted. This is something for our team to think about implementing when we expand on our current features.

FRQ 4:

This FRQ is more related to interfaces (which are no longer a specific FRQ type on the AP exam), but there is also an emphasis on methods and control structures. Throughout this FRQ, knowledge of methods and control structures were necessary. First of all, through creating the NumberGroup interface, we had to create an interface which represented a group of integers and had a method to check if an integer was in that group. We had to write a "contains" method. In the Range class in part b, we had to implement the contains method, and had to use control structures through conditional statements to check whether or not an integer was within the range. Finally, with the MultipleGroups class, which implemented the NumberGroup interface, control structures were used to iterate over each NumberGroup and see if an integer was in any of them. The entire FRQ had a lot to do with implementing interfaces, classes, methods, and control structures in Java.

For our project implementation, we had to utilize a lot of methods and control structures (as for most projects). Here are some examples in our final project: ```java for (int i = 0; i < numberOfSimulations; i++) { double[] fantasyPoints = simulateFantasyPoints(meanFantasyPoints, standardDeviation); projectedFantasyPointsA.add(fantasyPoints[0]); projectedFantasyPointsB.add(fantasyPoints[1]); } ``` In the above implementation, control structures (for loop) were utilized in order to call a method simulateFantasyPoints to add the projections for each drafted fantasy team to the fantasyPoints list.
```java package com.nighthawk.spring_portfolio.mvc.person; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import java.util.List; /* Extends the JpaRepository interface from Spring Data JPA. -- Java Persistent API (JPA) - Hibernate: map, store, update and retrieve database -- JpaRepository defines standard CRUD methods -- Via JPA the developer can retrieve database from relational databases to Java objects and vice versa. */ public interface PersonJpaRepository extends JpaRepository { Person findByEmail(String email); List findAllByOrderByNameAsc(); // JPA query, findBy does JPA magic with "Name", "Containing", "Or", "Email", "IgnoreCase" List findByNameContainingIgnoreCaseOrEmailContainingIgnoreCase(String name, String email); /* Custom JPA query articles, there are articles that show custom SQL as well https://springframework.guru/spring-data-jpa-query/ https://docs.spring.io/spring-data/jpa/docs/current/reference/html/#jpa.query-methods */ Person findByEmailAndPassword(String email, String password); // Custom JPA query @Query( value = "SELECT * FROM Person p WHERE p.name LIKE ?1 or p.email LIKE ?1", nativeQuery = true) List findByLikeTermNative(String term); /* https://www.baeldung.com/spring-data-jpa-query */ } ``` The above implementation is the PersonJpaRepository.java file. This is a prime example of interfaces in the PBL template we utilize for CSA. The interface that has been created in the file allows for database interaction to perform CRUD operations on the Person object. The interface also has many unique components, such as allowing for querying methods (i.e. findByEmail). Interfaces allow for greater code efficiency by creating templates that can be utilized in other files.

Overall Reflection on FRQs and PBL Crossover

Doing these FRQs and exploring the intersections between my group's final project and the key concepts made me understand what concepts I need to get better at and what concepts I am more fluent in.
The FRQs on 2D arrays and methods/control structures/interfaces were definitely very challenging. I was not able to do these FRQs completely on my own, and had to utilize external resources to get a fully running and functional program. I think the issue that I had was not with writing the basic implementations of the programs that each part of the FRQ asked to do, but rather, combining them all together to have a running program. I will definitely need to work on doing things within a time limit of 15 minutes per FRQ. I also need to work on understanding how to manipulate 2D arrays, writing complex control structures, and understanding what situations require a string to array conversion.
It is clear that almost all the FRQ concepts have some sort of implementation in the PBL, which is very important. Throughout Trimester 3, instead of just drawing these comparisons at the end as a reflection, I will be constantly comparing practice FRQs to the work we are doing on our project to make sure that I am grasping the concepts more firmly and seeing a greater purpose to the work that I am doing. This will help me for the AP exam and for my programming journey in the future.
jm1021 commented 6 months ago

Your thoughts are outstanding. I enjoyed reading them and seeing your growth.

I always think of a 1D/arraylist of a class like player as a 2D array of mixed data types. With possibility of 3D if you use something like a collection.

A more pure 2D example is images or neural network data. You have application for both in your project.

raunak2007 commented 6 months ago

GRADING:

Understood the FRQs very well, had a clear understanding of the code and was able to explain the key algorithms. Had good understanding of the PBL association with the code as well:

FRQ 1: (FRQ: 0.9/0.9, Assocation 1.0/0.9) FRQ 1 Blog

Had nice association with sports models Checking whether or not teams were diverse based on arrays for part (c) was a cool implementation

FRQ 2: (FRQ: 0.9/0.9, Assocation 1.0/0.9) FRQ 2 Blog

Pretty simple implemenation of the class, game works, had an output and showed the multiple hints that the computer could possibly give FRQ 3: (FRQ: 0.9/0.9, Assocation 1.0/0.9) FRQ 3 Blog

Calculated method outputs with different inputs (each row of the sparsearray), nice connection

FRQ 4: (FRQ: 0.9/0.9, Assocation 1.0/0.9) FRQ 4 Blog

All code parts had a proper/working output

Overall: Liked how you implemented your team's main concepts into the FRQ, the connecting between PBL and FRQ was also solid. This merits a 3.6/3.6 for the FRQ and 4.0/3.6 for the association between PBL and FRQ

jm1021 commented 6 months ago

Liked how you implemented your team's main concepts into the FRQ, the connecting between PBL and FRQ was also solid. This merits a 3.6/3.6 for the FRQ and 4.0/3.6 for the association between PBL and FRQ

No depth in crossover grading