Skip to content

Webso-Dev/Webso-php-interview

Repository files navigation

Webso refactoring code review

This project is part of the Webso PHP developer interview process. The codebase has been written to contain multiple issues that could be identified and fixed by a developer.

Scenario

Pretend you have just inherited this codebase from the business.

The project is an API that allows users to search for page resource items based on id, tag, or content.

It was developed by a 3rd party contractor, and once the project was completed they moved on and are no longer contactable.

It's been decided that you are the new owner of this project. At the moment you have no new requirements but you have been told in the near future this project is going to be critical for an important client.

This client will want new features and to dramatically increase (around 1000x) the current traffic load. Your job is to get the project ready for that.

Note: This test is not about database performance or the structure of the data at rest. The underlying content service has been mocked so that the focus can be on how the data set is being searched and returned. You should ignore any of the files in the /mocks directory.

The project

Please assume that the project has been set up to run on PHP7.4+

In order to run the project, you have to have docker installed on your machine (2.22 or later). To get the application running, in your terminal, run docker compose watch. This spins up the server, and uploads the code changes to the container running the application. Unfortunately, Docker can't show application logs in watch mode. To see logs from the application, open another terminal, and run docker logs container-name.

The API

The following endpoints are available:

  • Search pages by content: This end point searches through the page content and returns the matching data. The search term is passed in via a query param term. Example url: http://localhost:8000/contents/?term=foo

  • Search pages by tag: This end point searches through the page tags and returns the matching data. The search term is passed in via a query param term. Example url: http://localhost:8000/tags/?term=bar

  • Search pages by id: This end point returns the page data corresponding to the given id. The id is passed in via a path param. Example url: http://localhost:8000/pages/123

Your tasks

  1. Get the project running, inspect the codebase, and note down any issues you see.
  2. Determine the 5 most critical parts of the project that need changing based on the scenario above. For each one, consider the changes that you would make to improve the codebase.
  3. Consider the application's architecture and production run time and think about what changes would you make (if any) to accommodate the new requirements.

Note: We will be discussing the issues you have found during the interview, so please make sure you note them down and that you are familiar with the codebase. Once you have identified the 5 most critical parts of the project and we've discussed them through, you get to pick one, that you seem feasible to implement in the remainding of the interview. Then we'll work on the issue together with your lead, since after all, software development is team work!

What we're looking for

  1. Your ability to read and understand an unfamiliar codebase
  2. Your ability to identify issues with an unfamiliar codebase
  3. Your ability to communicate those issues, why they're an issue, and what work needs to be done to resolve the issue

About

PHP interview codebase

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published