RESTful Scala Play Framework 2.4 Application (Development)
Code Sampling with Scala, Play (Development)
This is a sample application using Scala, PlayFramework, and Postgres.
- Slick FRM for DB connection
- Akka Actors for ActionLog
- Deep validation where all errors, warnings, and info messages are collected and presented
- All REST responses are unified with the same structure every time, so it's easier to handle errors, warnings, and messages as well as specific data on pages.
Responses are structured for global and local messages. Local messages are coupled to some field, e.g., "Username is too long. Allowed length is 80 chars." Global messages are messages that reflect all data on page, e.g., "User will not be active untill is approved." Messages have three levels: ERROR, WARNING and INFORMATION.
(example response: http://demo3385913.mockable.io/api/v1/single-create-response)
- JSON Web Tokens (JWT) for user identification and authentication
- Divided into modules, e.g., user module, organization-structure module, etc. Each module has DAO, domain, validation, and service packages
- Spring dependecy injection
Chess Problem (Development)
The problem is to find all unique configurations of a set of normal chess pieces on a chess board with dimensions M×N where none of the pieces is in a position to take any of the others. Assume the colour of the piece does not matter, and that there are no pawns among the pieces. Write a program which takes as input:
- The dimensions of the board: M, N.
- The number of pieces of each type (King, Queen, Bishop, Rook and Knight) to try and place on the board.
As output, the program should list all the unique configurations to the console for which all of the pieces can be placed on the board without threatening each other. When returning your solution, please provide with your answer the total number of unique configurations for a 7×7 board with 2 Kings, 2 Queens, 2 Bishops and 1 Knight.
Red Bull Paper Wings 2009. Croatian Champion (Other amazing things)
National Champion of Croatia in the Red Bull Paper Wings contest in 2009 and participant in the Red Bull Paper Wings World Championships in Salzburg, Austria, where I took 43rd place.
Red Bull Paper Wings 2012. Croatian Champion (Other amazing things)
National Champion of Croatia in the Red Bull Paper Wings contest in 2012 and participant in the World Championships in Salzburg, Austria, where I took 20th place.
Context Validation in Domain-Driven Design (Publication)
Handling all validation in domain objects results in objects that are huge and complex to work with. In domain-driven design, using decoupled validator components allows your code to be much more reusable and enables validation rules to rapidly grow.
In this article, Toptal engineer Josip Medic shows us how validation can be decoupled from domain objects, made context-specific, and structured well to achieve more sustainable validation code.