GithubHelp home page GithubHelp logo

bintaoj / java-api-assessment Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cbfacademy/java-api-assessment

0.0 0.0 0.0 99 KB

Java API assessment template

License: MIT License

Java 100.00%

java-api-assessment's Introduction

Java API Assessment

Introduction

Dive into the world of API development using Java and SpringBoot. We're handing over a skeleton codebase; your challenge is to shape a top-notch API from it.

You can build any API of your choosing, but it must include the following:

  1. At least one algorithm
  2. Unit test at least one class
  3. Store the data in a JSON file
  4. Exception handling
  5. Evidence of inheritance
  6. Good use of HTTP Protocols - methods, request and response, have full CRUD operations supported
  7. Documentation

Learning Outcomes:

By the end of this assessment, you should be able to:

  1. Design and Architect APIs: Get to grips with the nitty-gritty of curating a top-quality API, focusing on data flow and endpoint interactions.
  2. Implement Best Practices: Showcase your adherence to Java & SpringBoot coding standards, error handling, and optimal project structure.
  3. Code Integration: Seamlessly combine your creations with the provided skeleton codebase.
  4. Exception Management: Efficiently handle exceptions, ensuring your API remains sturdy and dependable.

Onward with this assessment, you're set for a deep dive into API development with Java and SpringBoot.

Design & Requirements

Design Considerations:

  • API Flow: Map out your API's progression, from endpoints to their functionalities.

Requirements List:

  • Core: Make use of Java and SpringBoot.
  • End Points: Ensure they are detailed and fully operational.
  • Error Handling: Your API should handle mishaps gracefully and return informative feedback.

Learning Outcomes:

  • Acknowledge the pivotal role of a focused design in APIs.
  • See firsthand how a detailed requirements list can pave the way for successful development.

Repository Management

  • Consistent Commits: Commit often, capturing your progress and thought process.
  • README: Not just an afterthought. Fill it with the essence of your API, setup instructions, and other salient details.

Learning Outcomes:

  • Hone your skills in effective version control.
  • Recognise the value of a well-curated repository.

Code Quality & Structure

  • Best Practices: Stick to Java and SpringBoot best practices and conventions.
  • Modularity: Your code should be modular, reusable, and easily comprehensible.

Learning Outcomes:

  • Craft clean, efficient, and maintainable code.
  • Harness Java and SpringBoot to the fullest.

Getting Started

Prerequisites

Before you begin, make sure you have the following installed:

  1. JDK 17 (or higher)

  2. Git

  3. Visual Studio Code

    1. Extension Pack for Java
    2. Spring Boot Extension Pack

Also make sure you have accounts for the following:

  1. GitHub

Setup

1. Clone the Repository

git clone [REPO_URL]
cd [REPO_NAME]

Replace [REPO_URL] with the link to your GitHub repository and [REPO_NAME] with the repository's name.

2. Install Dependencies

Open a terminal at the root of the repo directory and run the following command to install the dependencies:

./mvnw clean dependency:resolve

If you are on a Windows machine, that will be:

mvnw clean dependency:resolve

You should see console output similar to the following:

[INFO] Scanning for projects...
[INFO] 
[INFO] -------------------< com.cbfacademy:api-assessment >--------------------
[INFO] Building api-assessment 0.0.1-SNAPSHOT
[INFO]   from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- clean:3.2.0:clean (default-clean) @ api-assessment ---
[INFO] Deleting /Users/user/Dev/cbfacademy/java-api-assessment/target
...
[truncated output]
...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  3.060 s
[INFO] Finished at: 2023-10-03T16:18:25+01:00
[INFO] ------------------------------------------------------------------------

3. Running the Application

To start the API in VS Code, press F5 or tap the 'Play' icon for the api-assessment app in the Spring Boot Dashboard.

Alternatively, to start the API from the terminal, run the following command:

./mvnw spring-boot:run

Or on Windows:

mvnw spring-boot:run

You should see console output similar to the following (press Ctrl + C to exit):

[INFO] Scanning for projects...
[INFO] 
[INFO] -------------------< com.cbfacademy:api-assessment >--------------------
[INFO] Building api-assessment 0.0.1-SNAPSHOT
[INFO]   from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- clean:3.2.0:clean (default-clean) @ api-assessment ---
[INFO] Deleting /Users/gary/Dev/cbfacademy/java-api-assessment/target
[INFO] 
[INFO] >>> spring-boot:3.1.4:run (default-cli) > test-compile @ api-assessment >>>
[INFO] 
[INFO] --- resources:3.3.1:resources (default-resources) @ api-assessment ---
[INFO] Copying 1 resource from src/main/resources to target/classes
[INFO] Copying 0 resource from src/main/resources to target/classes
...
[truncated output]
...
2023-10-03T17:17:34.413+01:00  INFO 35536 --- [  restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG'
2023-10-03T17:17:34.751+01:00  INFO 35536 --- [  restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
2023-10-03T17:17:34.756+01:00  INFO 35536 --- [  restartedMain] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2023-10-03T17:17:34.756+01:00  INFO 35536 --- [  restartedMain] o.apache.catalina.core.StandardEngine    : Starting Servlet engine: [Apache Tomcat/10.1.13]
2023-10-03T17:17:34.777+01:00  INFO 35536 --- [  restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2023-10-03T17:17:34.778+01:00  INFO 35536 --- [  restartedMain] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 364 ms
2023-10-03T17:17:34.898+01:00  INFO 35536 --- [  restartedMain] o.s.b.d.a.OptionalLiveReloadServer       : LiveReload server is running on port 35729
2023-10-03T17:17:34.907+01:00  INFO 35536 --- [  restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8080 (http) with context path ''
2023-10-03T17:17:34.911+01:00  INFO 35536 --- [  restartedMain] com.cbfacademy.apiassessment.App         : Started App in 0.643 seconds (process running for 0.786)

Open your browser and navigate to http://localhost:8080.

Deliverables

Ensure that your work is merged to the main branch of your GitHub repository by the specified deadline (original or extended). Your solution will assessed based on its state at that point; any later commits will not be taken into account.

FAQs

  • Q: How can I process JSON in Java?

    A: There are a number of open-source packages that you can use to manipulate JSON. We recommend Gson, but you can also investigate alternatives like json-simple or Jackson.

  • Q: Can I use another IDE I'm more familiar with instead of VS Code, like IntelliJ or Eclipse?

    A: You can if you wish, but only VS Code is formally supported by CBF Academy staff, so you do so at your own risk.

Top Tips

  • ๐Ÿ“ธ Commit frequently and use meaningful commit messages. A granular, well-labelled history becomes an increasingly valuable asset over time.
  • ๐ŸŒต Use feature branches. Build the habit of isolating your changes for specific tasks and merging them into your default branch when complete.
  • ๐Ÿšฆ Use consistent naming conventions. Choose easily understandable names and naming patterns for your classes, functions and variables.
  • ๐Ÿ“ Keep your code tidy. Using the built-in formatting of VS Code or other IDEs makes your code easier to read and mistakes easier to spot.
  • ๐Ÿ“š Read the docs. Whether via Intellisense in your IDE, or browsing online documentation, build a clear understanding of the libraries your code leverages.
  • ๐Ÿ“† Don't wait until the last minute. Plan your work early and make the most of the time available to complete the assessment and avoid pre-deadline palpitations.
  • ๐Ÿ†˜ Ask. ๐Ÿ‘ For. ๐Ÿ‘ Help! ๐Ÿ‘ Your mentors, instructors and assistants are literally here to support you, so make use of them - don't sit and struggle in silence.

Best of luck! Remember, it's not just about the destination; it's the journey. Happy coding! ๐Ÿš€

java-api-assessment's People

Contributors

bintaoj avatar genyus avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.