Skip to content

push to CSA#207

Open
DSills735 wants to merge 5 commits intothe-csharp-academy:mainfrom
DSills735:main
Open

push to CSA#207
DSills735 wants to merge 5 commits intothe-csharp-academy:mainfrom
DSills735:main

Conversation

@DSills735
Copy link
Copy Markdown

No description provided.

@chrisjamiecarter chrisjamiecarter self-assigned this Apr 5, 2026
Copy link
Copy Markdown
Collaborator

@chrisjamiecarter chrisjamiecarter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @DSills735 👋,

Excellent work on your Flashcards project submission 🎉!

I have performed a peer review. Review/ignore any comments as you wish.


Overview

This submission is incomplete - the project lacks essential build files (.csproj, .sln), cannot be built, and has no README file. These are mandatory requirements for C# Academy project submissions.

🔴 Project Incomplete - No Build Files

💡 The project is missing essential build files (.csproj, .sln). Without these, the project cannot be built or tested. A complete C# project requires at least one .csproj file with proper configuration.

🔴 No README File

💡 No README.md file exists in the project. C# Academy projects require a README explaining how to run the application and its features.

🔴 Missing Input Validation

💡 No validation on resp (user input for stack ID). The code uses Console.ReadLine()! without checking for null or empty input, which could cause issues.

🔴 IDisposable Resource Not Disposed

💡 SqlConnection is created but never disposed. Should use a using declaration or statement to properly handle the connection lifecycle.

🔴 Project Submission

💡 Please place all your code inside a single top-level folder named: [ProjectName].[UserName].

👨‍🏫 Example: ProjectName.UserName

📁 CodeReviews.Console.Flashcards ⬅️ Forked repo
 ┣ 📄 .codacy.yml
 ┣ 📄 .gitignore
 ┣ 📁 Flashcards.dsills735 ⬅️ Top-level folder
 ┃  ┗ 📄 Project.sln
 ┃  ┗ 📄 README.md
 ┃  ┗ 📁 Flashcards.Console

💭 This helps me clearly identify your work and confirms you can work within community repository guidelines.


Required Actions

Please fix any 🔴 items, as they block approval. Commit and push your changes, then leave me a comment when done! 🔧

Thanks,
@chrisjamiecarter 👍

@DSills735
Copy link
Copy Markdown
Author

@chrisjamiecarter I really appreciate the review! I believe I hit all your points. I added the running information to the bottom of the readme.

To be completely honest, I have no idea how the csproj and sln files did not get included.. I replaced the entire project and it seems to be working fine now. I think I maybe included one too many folders In my initial submission.

Lastly, I believe I handled the IDisposable correctly now.. (I just added the using statement to all of the SqlConnection calls). Im not 100% sure if that is all I needed to do in regards to that.

Once again, thank you!

Copy link
Copy Markdown
Collaborator

@chrisjamiecarter chrisjamiecarter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @DSills735 👋,

Excellent work on your Flashcards project submission 🎉!

I have performed a peer review. Review/ignore any comments as you wish.

Your project demonstrates solid use of Dapper ORM, Spectre.Console for UI, and good separation of concerns through multiple namespaces. The use of DTOs to hide internal IDs is excellent. The code compiles with only warnings (mostly nullable reference types) which is good for a .NET 10 project.

🟢 Good things:

  • Good use of DTOs to hide internal IDs from users
  • Proper use of parameterized SQL queries to prevent SQL injection
  • Good separation of concerns with distinct folders for Menus, Card_Ops, Stack_Ops, Validation, etc.
  • Database initialization with proper foreign key with ON DELETE CASCADE

🔴 Project Structure
Apologies, I do not know whether this is a difficult requirement to follow, but I was expecting this, but got this.

Expected
📁 CodeReviews.Console.Flashcards ⬅️ This is the cloned repo
 ┣ 📄 .codacy.yml
 ┣ 📄 .gitignore
 ┣ 📁 Flashcards.DSills735 ⬅️ This should be a new folder created by you manually.
 ┃  ┗ 📄 Project.sln ⬅️ Your solution file 
 ┃  ┗ 📄 README.md  ⬅️ Your README file
 ┃  ┗ 📁 Flashcards.Console ⬅️ Your solution project directories
Actual
📁 CodeReviews.Console.Flashcards ⬅️ This is the cloned repo
 ┣ 📄 .codacy.yml
 ┣ 📄 .gitignore
 ┣ 📄 README.md ❗ Your README is not for the repo, so should not be here
 ┣ 📄 Flashcards.slnx ❗ Your solution file is not in your project submission folder 
 ┣ 📁 Flashcards.DSills735 ❗ This is actually your solution project directory, not a project submission directory.

🔴 Missing Requirement

💡 This project is about teaching DTOs. You should be using an imaginary incrementing ID here, instead of the actual database ID. (Note you will still need the DB ID to update/delete)

Image Image

🔧 Next Steps

  • Please fix any 🔴 items, as they block approval.
  • Commit and push your changes, then leave me a comment when done.
  • Feel free to reach out if you have any questions or want to discuss further 🆘.

Thanks,
@chrisjamiecarter 👍


static void Main(string[] args)
{
SqlConnection connection = new SqlConnection(connectionString);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 Missing using statement for IDisposable

💡 SqlConnection is not properly disposed with a using statement. Use: using SqlConnection connection = new SqlConnection(connectionString);

using Flashcards.Menus;


namespace Program
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 Incorrect namespace convention

💡 The namespace Program is incorrect. Consider renaming to Flashcards/ Flashcards.Console / Flashcards.UI or a more descriptive namespace.


internal static string ConnString()
{
string? connectionString = Program.Program.config.GetConnectionString("DefaultConnection");
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Potential null reference warning

💡 The connectionString could be null (CS8603). The method returns a nullable string but it's assigned to a non-nullable type in calling code.



string subj = Console.ReadLine();
int stackID = Convert.ToInt32(subj);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 No input validation

💡 No validation for null/empty input or non-numeric input when reading stack ID. Convert.ToInt32 can throw FormatException.

Image




while (!exists)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 Logic issue - loop always executes

💡 The while loop checks for stack existence but the quiz logic is inside the loop - if stack doesn't exist, it loops infinitely asking for input without checking again.

Comment on lines +14 to +20
using SqlConnection connection = new SqlConnection(connectionString);


var stacks = connection.Query(SqlHelper.ReturnEntireStackWithStackID(), new {StackID = id}).ToList();


var table = new Table()
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Too Much Whitespace

💡 Code should be separated by one blank line maximum. Keeps code readability and maintainability high.

Comment on lines +6 to +14
internal static string AddToHistory()
{
return @"INSERT INTO History(Date, Score)
VALUES(@Date, @Score)";
}
internal static string ViewHistory()
{
return "SELECT * FROM History";
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 Methods?

❓ Why are these methods? Ideally these are constant string values so should be treated as such.

Suggested change
internal static string AddToHistory()
{
return @"INSERT INTO History(Date, Score)
VALUES(@Date, @Score)";
}
internal static string ViewHistory()
{
return "SELECT * FROM History";
}
internal const string AddToHistory = @"INSERT INTO History(Date, Score)
VALUES(@Date, @Score)";
internal const string ViewHistory = "SELECT * FROM History";

internal class SqlHelper
{

internal static string CreateStackTable()
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 Should be Constants

{
internal class SQL_History
{
internal static string AddToHistory()
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 Naming

💡 The name of this makes it seem like it does something. Really this is the AddToHistoryCommandText.

internal class SqlHelper
{

internal static string CreateStackTable()
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 Should have better names

@DSills735
Copy link
Copy Markdown
Author

@chrisjamiecarter

I want to thank you for your quick response, and very very detailed review! I appreciate all the warnings and oddities included. I have received reviews from you on 2 separate projects now, and have learned alot of good info because of them!

I hope this submission meets the academy standards!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants