Skip to content

tamilatiurina/FlashcardsApp

Repository files navigation

📘 Flashcards Console Application (PL / EN / DE)

This project is a console-based Flashcards application built in Java, supporting translations between Polish, English, and German. It implements various Spring features such as Dependency Injection, IoC Container, Profiles, and YAML-based configuration.


🎯 Project Overview

The goal of the project is to demonstrate proficiency in:

  • Java OOP design
  • Application configuration
  • Separation of concerns and SOLID principles (notably Dependency Inversion Principle)
  • Practical usage of Spring Profiles, Configuration classes, and Property injection

The flashcards app allows users to:

  • Add new words to a multilingual dictionary
  • View all entries with display formats controlled by profiles
  • Take interactive translation quizzes (user inputs are case-insensitive)

🧱 Class Structure

Entry

Represents a word translation between Polish, English, and German.

EntryRepository

Acts as the in-memory store for Entry objects.

FileService

Responsible for reading words from a CSV file and loading them into the repository.

FlashcardsController

Handles business logic and interaction with the user through the console.

FlashcardsApp

Main class to start the application.

✅ Display Format Profile Classes

Behavior changes based on active Spring profile:

  • default: Displays words as they appear in the CSV
  • uppercase: Displays all words in CAPITAL LETTERS
  • lowercase: Displays all words in lowercase

📋 Features

  • ✅ Add a new word to the dictionary
  • ✅ Display all words in a selected format (controlled via Spring profiles)
  • ✅ Quiz mode: Test the user's knowledge by prompting them to translate a random word into the other two languages
  • ✅ Case-insensitive matching for quiz answers

⚙️ Technologies & Techniques Used

Concept Usage
Dependency Injection Injecting service and repository dependencies
Dependency Inversion Principle (DIP) Business logic depends on abstractions rather than implementations
IoC Container Application context controls object creation
Spring Profiles Change display behavior (original, uppercase, lowercase)
YAML Configuration App configured via application.yml
External Properties File path configured via external property: pl.edu.pja.tpo02.filename
Custom App Banner Uses contents of logo-app file for startup banner

📁 Example YAML Configuration

spring:
  profiles:
    active: uppercase

pl:
  edu:
    pja:
      tpo02:
        filename: data/words.csv

🚀 How to Run

  1. Ensure you have a compatible Spring setup (or manually wire dependencies if Spring Boot is not used).
  2. Place your logo-app file (no extension) in the root directory.
  3. Set the profile and filename in application.yml.
  4. Run the FlashcardsApp.java class.

📖 Sample Console Menu

=== Flashcards App ===

1. Add a new word
2. Show all words
3. Take a translation test
0. Exit

🗂 Sample CSV Format

kot,cat,Katze
pies,dog,Hund

🧠 Class Dependency Diagram

+---------------------+
|    FlashcardsApp    |  <-- entry point
+---------------------+
            |
            v
+--------------------------+
|   FlashcardsController   |
+--------------------------+
       |             |
       v             v
+------------+   +-------------+
| FileService|   |EntryRepository|
+------------+   +-------------+
                        ^
                        |
                 +-------------+
                 |   Entry     |
                 +-------------+

Profile-specific display format logic is injected into FlashcardsController via Spring Profiles.


📝 Notes

  • The app is designed using SOLID principles.
  • Display behavior is fully dynamic and controlled by profiles.
  • Supports external customization via application.yml.
  • The banner and file path are both configurable and decoupled from the core logic.

Built with ❤️ for educational purposes.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages