定制 playground-sessions/php-code-exercise 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

playground-sessions/php-code-exercise

Composer 安装命令:

composer create-project playground-sessions/php-code-exercise

包简介

An API Coding Exercise.

README 文档

README

Scenario

Take this hypothetical situation.

We are making an iOS and Android app for teachers. A teacher will select a student to see all lessons, and whether that student completed each lesson.

Each app will get its data from the JSON REST API endpoint:

/student-progress/{userId}

Where {userId} is the user id of the student.

You inherit this codebase.

You remember how the data is structured:

  • Lessons contain several segments.
  • A user can create practice records for a segment.

You look over the codebase and realize that several problems exist in this endpoint.

  1. Business rules (eg. whether a user has completed a lesson) would be duplicated by each app.
  2. It is too slow, even with a reasonable amount of practice records.

Luckily, both front-end developers agree that the endpoint needs to change before it is used. You all agree to the following data structure for the response:

{
  "lessons": [
    {
      "id": 32,
      "difficulty": "Rookie",
      "isComplete": true
    }
  ]
}

Instructions

Solve all problems with this codebase.

  • Create a new data structure for the response.
  • Codify the following business rules.
    • A lesson is complete if each segment has at least one practice record with a score of 80% or more.
    • Difficulty categories ("Rookie", "Intermediate", "Advanced") are associated with difficulty numbers [1,2,3], [4,5,6], [7,8,9], respectively.
  • Ensure the response time for user id 1 is under 500ms for the given dataset. Right now the response time is about 2 seconds.

Code should be cleanly written in self-contained parts, each having one responsibility, according to the Single Responsibility Principle (SRP). For example, application logic (eg. extracting query parameters from a URL) should be separate from business logic (eg. determining whether a lesson is complete).

You have full reign over the codebase. You can add or remove any packages you like. Everything is fair game.

We are testing your ability to organize code cleanly, with SRP, not your knowledge of the Laravel/Lumen frameworks.

Try to commit often and with small changes, so we can see what you are doing.

If you have a particular strength (say documenting APIs), feel free show it off.

You might benefit from knowing that all 3 problems can be solved without use of a cache.

Deliverables

Email ben@playgroundsessions.com with a link to your git repository.

Getting Started

Getting started is simple with PHP's built-in web server.

  1. Have PHP 8.0 installed.
  2. Follow the Development Environment Setup

Go!

We look forward to seeing your code!

统计信息

  • 总下载量: 34
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 4
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-01-27

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固