- Getting started with Spring Core. Reading (30 mins)
- Getting started with Spring Core. Reading (25 mins)
- Getting started with Spring MVC. Reading (30 mins)
- Best practices for REST API design. Reading (10 mins)
- Spring Web Application Structure. Reading (20 mins)
- Create REST API with Spring MVC. Reading (30 mins)
- Connection Pool (10 mins)
- Testing. Well-known approaches (10 mins)
- JUnit (overview guid)
The recommended timeline for the whole module is 2 weeks.
- Develop web service for Gift Certificates system with the following entities (many-to-many):
- CreateDate, LastUpdateDate - format ISO 8601 (https://en.wikipedia.org/wiki/ISO_8601). Example: 2018-08-29T06:12:15.156. More discussion here: https://stackoverflow.com/questions/3914404/how-to-get-current-moment-in-iso-8601-format-with-date-hour-and-minute
- Duration - in days (expiration period)
- The system should expose REST APIs to perform the following operations:
- CRUD operations for GiftCertificate. If new tags are passed during creation/modification – they should be created in the DB. For update operation - update only fields, that pass in request, others should not be updated. Batch insert is out of scope.
- CRD operations for Tag.
- Get certificates with tags (all params are optional and can be used in conjunction):
- by tag name (ONE tag)
- search by part of name/description (can be implemented, using DB function call)
- sort by date or by name ASC/DESC (extra task: implement ability to apply both sort type at the same time).
- JDK version: 8 – use Streams, java.time.*, etc. where it is possible. (the JDK version can be increased in agreement with the mentor/group coordinator/run coordinator)
- Application packages root: com.epam.esm
- Any widely-used connection pool could be used.
- JDBC / Spring JDBC Template should be used for data access.
- Use transactions where it’s necessary.
- Java Code Convention is mandatory (exception: margin size – 120 chars).
- Build tool: Maven/Gradle, latest version. Multi-module project.
- Web server: Apache Tomcat/Jetty.
- Application container: Spring IoC. Spring Framework, the latest version.
- Database: PostgreSQL/MySQL, latest version.
- Testing: JUnit 5.+, Mockito.
- Service layer should be covered with unit tests not less than 80%.
- Repository layer should be tested using integration tests with an in-memory embedded database (all operations with certificates).
-
Code should be clean and should not contain any “developer-purpose” constructions.
-
App should be designed and written with respect to OOD and SOLID principles.
-
Code should contain valuable comments where appropriate.
-
Public APIs should be documented (Javadoc).
-
Clear layered structure should be used with responsibilities of each application layer defined.
-
JSON should be used as a format of client-server communication messages.
-
Convenient error/exception handling mechanism should be implemented: all errors should be meaningful and localized on backend side. Example: handle 404 error:
• HTTP Status: 404 • response body • { • “errorMessage”: “Requested resource not found (id = 55)”, • “errorCode”: 40401 • }
where *errorCode” is your custom code (it can be based on http status and requested resource - certificate or tag)
-
Abstraction should be used everywhere to avoid code duplication.
-
Several configurations should be implemented (at least two - dev and prod).
It is forbidden to use:
- Spring Boot.
- Spring Data Repositories.
- JPA.
- Powermock (your application should be testable).
Mentee can use lombok when agreed with mentor.
- Demonstrate API using Postman tool (prepare for demo Postman collection with APIs)
- (Optional) Build & run application using command line
Mentee should be able to answer questions during demo session.
- Java 8
- Overview
- https://oz.by/books/more10885929.html - Java SE 8 by Cay S. Horstmann (Book I and II)
- https://www.amazon.com/OCP-Certified-Professional-Programmer-1Z0-809/dp/1119067901 - Chapter 3 “Generics and Collections” (“Additions in Java 8” section, Page 152)
- Functional Interfaces
- https://docs.oracle.com/javase/specs/ - The Java Language Specification, Java SE 8 Edition, Chapter 9.8 “Functional Interfaces” (Page 321)
- https://docs.oracle.com/javase/specs/ - The Java Language Specification, Java SE 8 Edition, Chapter 9.9 Function Types (Page 325)
- http://tutorials.jenkov.com/java-functional-programming/index.html - Java Functional Programming from Chapter 1 to 4 (Java Functional Programming, Java Higher Order Functions, Java Functional Interfaces, Java Functional Composition)
- https://www.amazon.com/OCP-Certified-Professional-Programmer-1Z0-809/dp/1119067901 - Chapter 4 “Functional Programming” (Page 171 to “Checking Functional Interfaces” section, Page 182)
- Lambdas, Method references
- https://docs.oracle.com/javase/specs/ - The Java Language Specification, Java SE 8 Edition, Chapter 15.27 “Lambda Expressions” (page 601)
- 1.3.Stream API
- https://www.amazon.com/OCP-Certified-Professional-Programmer-1Z0-809/dp/1119067901 - Chapter 4 “Functional Programming” (From “Using Strebams” section, Page 185 – 223)
- http://tutorials.jenkov.com/java-functional-programming/streams.html - Chapter 5 (Java Stream API)
- https://habr.com/ru/company/luxoft/blog/270383/ - Java Stream API Overview
- Optional
- https://www.amazon.com/OCP-Certified-Professional-Programmer-1Z0-809/dp/1119067901 - Chapter 4 “Functional Programming” (“Returning Optional” section, Page 182)
- https://habr.com/ru/post/346782/
- Date/Time API, TemporalAdjuster
- https://www.amazon.com/OCP-Certified-Professional-Programmer-1Z0-809/dp/1119067901 - Chapter 5 “Dates, Strings, and Localization” (“Working with Dates And Times” section, Page 286)
- https://habr.com/ru/post/274905/
- https://www.baeldung.com/java-8-date-time-intro
- Overview
- Coding best practices
- Overview
- https://www.amazon.com/Clean-Code-Handbook-Software-Craftsmanship/dp/0132350882 - “Clean Code” by Robert C. Martin
- https://www.youtube.com/watch?v=otrfSgeK3JI – good lection about Clean Code
- https://learn.epam.com/detailsPage?id=1ad7fd02-311b-4b96-845d-599b177ad928 – course on eLearning portal
- Java Code Convention
- OOD, SOLID, YAGNI, DRY principles
- https://www.baeldung.com/solid-principles - SOLID Principles
- https://youtu.be/rtmFCcjEgEw - lection by Katerina Trajchevska
Transcription:
- Single Responsibility Principle: 7:04
- Open/Closed Principle: 13:53
- Liskov Substitution Principle: 20:42
- Interface Segregation Principle: 27:18
- Dependency Inversion Principle: 31:21
- https://habr.com/ru/post/348286/ - article in Russian about SOLID
- https://habr.com/ru/post/144611/ - article about principles
- Comments best practice
- Overview
- Exception handling
- Overview
- https://oz.by/books/more10885929.html - Java SE 8 by Cay S. Horstmann (Book I) or Java SE 7 by Cay S. Horstmann (Book I), Chapter “Exception Handling”
- https://www.amazon.com/OCP-Certified-Professional-Programmer-1Z0-809/dp/1119067901 - Chapter 5 “Dates, Strings, and Localization” (“Working with Dates And Times” section, Page 286)
- https://www.amazon.com/OCP-Certified-Professional-Programmer-1Z0-809/dp/1119067901 - Chapter 6 “Exceptions and Assertions”, Page 283
- https://learn.epam.com/detailsPage?id=be65b7d2-7fb0-45dc-9d1c-db8e2b84a37f – course on eLearning portal
- Checked vs. Runtime (Unchecked) Exceptions
- https://www.amazon.com/OCP-Certified-Professional-Programmer-1Z0-809/dp/1119067901 - Chapter 6 “Exceptions and Assertions”, Page 283 (“Categories of Exceptions” section, Page 285)
- https://www.geeksforgeeks.org/checked-vs-unchecked-exceptions-in-java/
- https://howtodoinjava.com/java/exception-handling/checked-vs-unchecked-exceptions-in-java/
- Exception handling best practices
- Overview
- Layered Architecture
- Spring Framework
- Overview:
- https://www.youtube.com/watch?v=BmBr5diz8WA - Spring-потрошитель, часть 1
- https://www.youtube.com/watch?v=cou_qomYLNU - Spring-потрошитель, часть 2
- https://www.youtube.com/watch?v=nGfeSo52_8A - Spring – Глубоко и не очень
- Spring Core: Wiring beans
- Core concepts – Chapter 2: Wiring beans;
- Core concepts –Chapter 3: Advanced Wiring;
- Building Spring web applications: Spring MVC
- https://www.manning.com/books/spring-in-action-fourth-edition MVC – Chapter 5: Building Spring web applications MVC – Chapter 7: Advanced Spring MVC
- Overview:
- REST API Fundamentals
- Overview:
- https://bookauthority.org/books/best-rest-api-books - list of books for additional learning
- RESTful Architecture
- REST APIs with Spring
- https://www.manning.com/books/spring-in-action-fourth-edition REST – Chapter 16: Creating REST APIs with Spring
- https://habr.com/ru/post/101342/
- Overview:
- Connection Pool
- Maven
- Testing
- Well-known approaches
- Junit
- Mockito
- Postman