Skip to content

Technical Exercise Product Engineer - Adhitya Bagus Putra Erlangga #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 0 additions & 59 deletions .env.example

This file was deleted.

152 changes: 152 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
# Dicoding Product Engineer Technical Exercise

## Part 1: Technical Problem Solving

### Setup Instructions

1. **Clone the Repository**:

- Open your terminal or command prompt.
- Run the following command to clone the repository:
```sh
git clone https://github.com/dicoding-dev/technical-excercise.git
cd technical-excercise
```

2. **Set Up the Environment**:

- Install the required dependencies using Composer:
```sh
composer install
```
- Copy the example environment configuration file and create a new `.env` file:
```sh
cp .env.example .env
```
- Generate a new application key:
```sh
php artisan key:generate
```

3. **Run Database Migrations and Seeders**:
- Run the database migrations and seeders to set up the database. If you encounter a memory limit error, try increasing the memory limit as follows:
- Start with 4096M:
```sh
php -d memory_limit=4096M artisan migrate --seed
```
- If needed, you can increase it further to 12000M:
```sh
php -d memory_limit=12000M artisan migrate --seed
```

### API Documentation

#### Drop Out Enrollments Command

- **Command**: `enrollments:dropout`
- **Description**: Drops out enrollments that meet specific criteria based on the deadline date.
- **Usage**:
```sh
php artisan enrollments:dropout
```

### Testing Instructions

1. **Benchmark Performance**:

- Measure memory usage and execution time before and after optimizations.
- Example benchmark command:
```sh
php artisan enrollments:dropout
```

2. **Analyze Results**:
- Compare the memory usage and execution time to identify improvements.
- Document the results and include screenshots of the benchmarks.

By following these testing instructions, you can ensure that the code is working correctly and measure the performance improvements after optimizations.

## Part 2: Product Analysis

### Objective

Conduct a thorough analysis of Dicoding's platform and propose meaningful improvements to enhance the learning journey for Indonesian developers, focusing on Java Spring Boot and microservices courses for backend development in the banking and finance industry.

### Problem Analysis

#### Identified Pain Points

1. **Lack of Specialized Backend Development Courses**:

- Dicoding offers Java courses primarily for Android development and backend development using JavaScript.
- Modern banking and finance companies often use Java Spring Boot and microservices for secure, scalable, and maintainable systems, creating a gap in Dicoding's offerings.

2. **Limited Alignment with Industry Requirements**:
- The absence of Java Spring Boot and microservices courses means learners are not fully equipped with the skills demanded by the banking and finance sectors.

### Solution Design

#### Proposed Feature Improvements

1. **Java Spring Boot Course**

- **Beginner to Advanced Levels**: Comprehensive curriculum covering fundamental to advanced Java Spring Boot concepts.
- **Real-world Projects**: Projects such as building secure REST APIs, integrating with banking systems, and handling transactions.
- **Industry-Relevant**: Collaboration with industry professionals to ensure alignment with current banking and finance requirements.

2. **Microservices Architecture Course**
- **Design Principles and Best Practices**: Covering principles of microservices architecture.
- **Hands-on Projects**: Projects like creating a microservice for a payment gateway or user authentication system.
- **Deployment and Monitoring**: Using tools like Docker and Kubernetes, and monitoring with Prometheus and Grafana.

#### Justification for Proposed Improvements

- **High Demand in Banking and Finance**: As highlighted in the [Adeva article](https://adevait.com/java/java-in-banking), Java Spring Boot and microservices are essential for modern banking and finance applications.
- **Enhanced Employability**: Equipping learners with these skills will make them more attractive to employers in the banking and finance sector, increasing their job placement rates.
- **Industry Trends**: Modern banking and finance companies adopt microservices architecture to build scalable and maintainable systems, making these skills essential for developers.

### Implementation Strategy

1. **Collaborate with Industry Experts**

- Partner with professionals from banking and finance sectors to design the curriculum.
- Conduct workshops and guest lectures to provide real-world insights.

2. **Develop Comprehensive Course Material**

- Create detailed tutorials, documentation, and video content.
- Include practical examples and case studies relevant to the banking and finance industry.

3. **Offer Certifications**

- Provide certifications upon course completion to validate skills.
- Align certifications with industry standards to enhance job prospects.

4. **Incorporate Interactive Elements**
- Use quizzes, coding challenges, and peer reviews to engage learners.
- Implement project-based learning to provide hands-on experience.

### Metrics for Measuring Success

1. **Enrollment Numbers**

- Track the number of students enrolling in the new courses.
- Measure growth in enrollment over time.

2. **Completion Rates**

- Monitor the percentage of students completing the courses.
- Identify any drop-off points and address potential issues.

3. **Job Placement Rates**

- Measure the number of students securing jobs in banking and finance after completing the courses.
- Track the types of roles and companies where students are getting hired.

4. **Student Feedback**
- Gather feedback from students to continually improve the course content.
- Use surveys and reviews to assess student satisfaction and learning outcomes.

### Conclusion

By addressing the gap in Java Spring Boot and microservices architecture courses, Dicoding can better serve Indonesian developers seeking careers in the banking and finance industry. These improvements will enhance the platform's value and attract more learners looking to acquire these in-demand skills.
88 changes: 48 additions & 40 deletions app/Console/Commands/DropOutEnrollments.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ public function __construct(
public function handle()
{
try {
DB::beginTransaction();
// Start the transaction
DB::beginTransaction(); // Optimization 3: Transactional Operations

$deadline = Carbon::parse(Enrollment::latest('id')->value('deadline_at'));

Expand All @@ -50,15 +51,16 @@ public function handle()
$this->stopwatch->stop(__CLASS__);
$this->info($this->stopwatch->getEvent(__CLASS__));

DB::rollBack();
// Commit the transaction
DB::commit(); // Optimization 3: Transactional Operations
} catch (\Exception $e) {
DB::rollBack();
DB::rollBack(); // Rollback the transaction in case of an error
throw $e;
}
}

/**
* The dropout process should fulfil the following requirements:
* The dropout process should fulfill the following requirements:
* 1. The enrollment deadline has passed.
* 2. The student has no active exam.
* 3. The student has no submission waiting for review.
Expand All @@ -67,41 +69,47 @@ public function handle()
*/
private function dropOutEnrollmentsBefore(Carbon $deadline)
{
$enrollmentsToBeDroppedOut = Enrollment::where('deadline_at', '<=', $deadline)->get();

$this->info('Enrollments to be dropped out: ' . count($enrollmentsToBeDroppedOut));
$droppedOutEnrollments = 0;

foreach ($enrollmentsToBeDroppedOut as $enrollment) {
$hasActiveExam = Exam::where('course_id', $enrollment->course_id)
->where('student_id', $enrollment->student_id)
->where('status', 'IN_PROGRESS')
->exists();

$hasWaitingReviewSubmission = Submission::where('course_id', $enrollment->course_id)
->where('student_id', $enrollment->student_id)
->where('status', 'WAITING_REVIEW')
->exists();

if ($hasActiveExam || $hasWaitingReviewSubmission) {
continue;
}

$enrollment->update([
'status' => 'DROPOUT',
'updated_at' => now(),
]);

Activity::create([
'resource_id' => $enrollment->id,
'user_id' => $enrollment->student_id,
'description' => 'COURSE_DROPOUT',
]);

$droppedOutEnrollments++;
}

$this->info('Excluded from drop out: ' . count($enrollmentsToBeDroppedOut) - $droppedOutEnrollments);
$this->info('Final dropped out enrollments: ' . $droppedOutEnrollments);
Enrollment::where('deadline_at', '<=', $deadline)
->select('id', 'course_id', 'student_id') // Optimization 4: Selective Data Loading
->chunkById(1000, function ($enrollments) {
$droppedOutEnrollments = 0;
$excludedFromDropOut = 0;

foreach ($enrollments as $enrollment) {
// Optimization 2: Efficient Queries
$hasActiveExam = Exam::where([
['course_id', $enrollment->course_id],
['student_id', $enrollment->student_id],
['status', 'IN_PROGRESS']
])->exists();

$hasWaitingReviewSubmission = Submission::where([
['course_id', $enrollment->course_id],
['student_id', $enrollment->student_id],
['status', 'WAITING_REVIEW']
])->exists();

if ($hasActiveExam || $hasWaitingReviewSubmission) {
$excludedFromDropOut++; // Track excluded enrollments
continue;
}

$enrollment->update([
'status' => 'DROPOUT',
'updated_at' => now(),
]);

Activity::create([
'resource_id' => $enrollment->id,
'user_id' => $enrollment->student_id,
'description' => 'COURSE_DROPOUT',
]);

$droppedOutEnrollments++;
}

$this->info('Excluded from drop out: ' . $excludedFromDropOut);
$this->info('Final dropped out enrollments: ' . $droppedOutEnrollments);
});
}
}
Loading