{"id":16167720,"url":"https://github.com/jlleitschuh/refactoring-interview-question","last_synced_at":"2025-10-18T11:05:27.125Z","repository":{"id":143379967,"uuid":"111705286","full_name":"JLLeitschuh/refactoring-interview-question","owner":"JLLeitschuh","description":"An interview question to test applicants refactoring and software design skills.","archived":false,"fork":false,"pushed_at":"2017-12-20T21:38:12.000Z","size":95,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-02-13T10:21:42.629Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JLLeitschuh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-11-22T16:04:17.000Z","updated_at":"2023-10-18T23:28:23.000Z","dependencies_parsed_at":null,"dependency_job_id":"78a65dbf-0355-4328-b452-df894a20168d","html_url":"https://github.com/JLLeitschuh/refactoring-interview-question","commit_stats":{"total_commits":11,"total_committers":2,"mean_commits":5.5,"dds":0.09090909090909094,"last_synced_commit":"56150ed77832eb66fce658c8be37defbd160b2d1"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JLLeitschuh%2Frefactoring-interview-question","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JLLeitschuh%2Frefactoring-interview-question/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JLLeitschuh%2Frefactoring-interview-question/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JLLeitschuh%2Frefactoring-interview-question/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JLLeitschuh","download_url":"https://codeload.github.com/JLLeitschuh/refactoring-interview-question/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247601445,"owners_count":20964865,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-10T03:09:12.464Z","updated_at":"2025-10-18T11:05:27.045Z","avatar_url":"https://github.com/JLLeitschuh.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Refactoring Interview Problem\n\nThe goal of this problem is to try to see how you tackle refactoring code from one project to another.\n\n## Project Goals\n\nThe goal of this problem is to refactor the logic in the `monolith` project\nso that it resides in the `library` project.\nThere are a few pre-written tests in the `library` project that should be\nre-enabled and made to pass.\n\n### Constraints\n\n - You are not allowed to change any code inside of the `external` sub-project.\n - The `monolith` project must depend upon the `library` project and the `external` project.\n   The `library` project can not depend upon the `external` project.\n   (The project is already configured this way, if you don't touch the build files you should be fine.)\n - You should not need to change the `AlgorithmEngineTest` but you are free to change the\n   `AlgorithmEngine` as much as you wish.\n\n## Hints\n\n - Are there methods that are instance methods that could be made `static`?\n   - If a method has a dependency on a field, could that field be passed as an argument instead?\n - Are there methods that can be made `private`?\n - Are there fields in classes that are not being used?\n - In general, constructors should \"do no work\". Instead, try to make it so that constructors are\n simply assigning their parameters to fields.\n - In IntelliJ pressing `F6` when a class is selected in the project view will pull up a UI to help\n moving classes. This can also be used to move static methods to another class.\n - If a symbol can't be resolved after moving it, make sure that the type has the right access level.\n   Eg. `private`, `public`, `protected`, \"package private\".\n   In Kotlin `internal` is nearly equivalent to Java's \"package private\".\n - Look for TODOs in the source code for additional pointers.\n\n## Solutions to Potential Problems\n\nWhen moving code around IntelliJ may cause problems where IntelliJ can't find symbols it should be able to find.\nIf you start seeing `java: cannot find symbol` and you think the type should be seen by the compiler try the following:\n - Refresh your projects by using `⌘ + Shift + A` and typing \"refresh all external projects\". \n   Then hit enter.\n - From the top menu do `Build -\u003e Rebuild Project`.\n \nIf this does not work then try the following.\n \n - Click the \"Gradle\" tab on the right side of IntelliJ. \n   Then click the blue refresh button on the Gradle tab that has appeared.\n   Then try `Build -\u003e Rebuild Project` again.\n - Contact me directly with your problem.\n\n## Environment Setup\n\nYou will need:\n - JDK 8 installed on your machine with the `$JAVA_HOME` environment variable set correctly.\n - A recent version of IntelliJ IDE Community Edition.\n\n### Configure [IntelliJ IDEA Community Edition](https://www.jetbrains.com/idea/)\n\nIn order to setup IntelliJ for development use the following steps:\n\n1. If you already have a project open use `File -\u003e Open` or just select `Open` from the welcome screen.\n2. Select the [settings.gradle](settings.gradle) file and click `Open`.\n3. When prompted:\n    1. Un-check the `Create seperate module per source set` option.\n    2. Check the `Use auto-import` option.\n    3. Make sure the `Gradle JVM` option is set to `1.8`.\n4. Wait for the project to load.\n5. Update your Kotlin Plugin:\n    1. Open the Kotlin Plugin Updates window using `⌘ + Shift + A` and typing \"kotlin plugin updates\".\n    2. Ensure `Stable` is selected and press `Check for updates`.\n    3. Update and restart IntelliJ when prompted (if necessary).\n\n## Testing Before Submission\n\nBefore you submit this project make sure you run `./gradlew check` this will ensure that your\nsubmission passes all tests and conforms to the style formatter.\n\n### Reformatting Your Code Before Submission\n\nTo reformat your code quickly simply run `./gradlew spotlessApply`.\n\n## Preparing For Your Interview\n\nBe prepared to discuss your solution during your interview.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjlleitschuh%2Frefactoring-interview-question","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjlleitschuh%2Frefactoring-interview-question","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjlleitschuh%2Frefactoring-interview-question/lists"}