Giter VIP home page Giter VIP logo

reladomo-kata's Introduction

Reladomo Kata

A kata is an exercise in martial arts. A code kata is an exercise in programming which helps hone your skills through practice and repetition. The Reladomo Kata is a fun way to help you learn idiomatic Reladomo usage. This particular kata is set up as a series of unit tests which fail. Your task is to make them pass, using Reladomo.

Pre-requisites

  1. Java 8

  2. IntelliJ IDEA or Eclipse

  3. Apache Maven

Initialize Kata

Clone this repo or simply download and extract the master zip file then follow the instructions below for your IntelliJ IDEA. We currently do not have a setup process for Eclipse and Netbeans.

IntelliJ IDEA users

Once you have extracted the downloaded zip file, it comes with all the necessary project files. You can open the project from "File" => "Open..." => choose "reladomo-kata" folder which you just extracted. You might see a dialog to suggest importing as a Maven project, please import it as a Maven project. If you do not get the option to import it as a Maven project, you can do so from the Maven tool window. Setup the project JDK from "File" => "Project Structure" => Setup the Project SDK Run the Maven clean and install. It should generate the necessary files. Run the unit tests under main-kata/src/test/java/kata/test. Happy coding!

Eclipse users

Once you have extracted the downloaded zip file, it is ready to be opened in your Eclipse Workspace. You can open the project from "File" => "Open Projects from File System..." => choose "reladomo-kata" folder which you just extracted. The project should automatically be imported as a Maven project. In case it is not imported as a Maven project, you can import it by right click on reladomo-kata => "Maven" => "Configure..."

Setup the project JDK:

Maven will automatically select Java 8 for you, make sure you have your JDK 8 installed and properly configured in Eclipse "Preferences" => "Installed JREs". If not follow the below steps:

  1. Navigate to "Window" => "Preferences" => "Installed JREs" => "Add" => "Standard VM".

  2. For "JRE home:" click on "Directory..." find your Java 8 JDK directory and click "OK", all other fields should auto-populate.

  3. Click on "Finish".

  4. Make sure the JDK you just setup, is checked off under the "Installed JREs".

Run the Maven build
  1. Right click on "reladomo-kata-parent".

  2. Navigate to "Run As" => "Maven build".

  3. Under "Goals", enter the command: -DskipTests=true clean install

  4. Click on "Run".

It should generate all the necessary files. Run the unit tests under main-kata/src/test/java/kata/test. Happy coding!

NetBeans users

We haven't come up with an instruction for NetBeans yet.

Kata Presentation

Slides available online

You can access the slides for the Main Kata and Mini Kata online.

IntelliJ IDEA users

Run the Maven task "site" to generate slides for the kata. It should generate the presentation. Navigate to main-kata/target/presentation/reladomokata and open the ReladomoKata.xhtml in your favorite browser.

Eclipse users

  1. Right click on "reladomo-kata-parent".

  2. Navigate to "Run As" => "Maven build".

  3. Under "Goals", enter the command: site

  4. Click on "Run".

It should generate the presentation. Navigate to main-kata/target/presentation/reladomokata and open the ReladomoKata.xhtml in your favorite browser.

Feature: f6 Feature: f7 Feature: f11

reladomo-kata's People

Contributors

dependabot[bot] avatar epsstan avatar gs-gsoss-wf-bot avatar gs-prady avatar gs-rezaem avatar matsu-chara avatar mohrezaei avatar nikhilnanivadekar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

reladomo-kata's Issues

Odd results in Audit Exercises

Hi,

I'm getting what looks like an odd result from the Audit exercises.

My code for the exercise is here.

image

The test data hasn't been modified and looks like this.

image

This is what is in the debug output. It shows both the "Build Bridge" "Restarted" entry and the "Dam River" "Damming" entry as having ProcessingDateFrom times of 05:00:00.000 which is an hour behind the 06:00:00.000 they should be. The other entries have not been adjusted in any way so I can't see any reason these two entries have been adjusted.

image

I am in Australia/Brisbane with no daylight savings so I am standard AEST time.

Because of this time difference my test is failing. I don't think I have done anything wrong.

Any ideas?

Test Issue

Hi,

I'm going through the Code Kata which by the way is a great way to learn. I'm having an issue with one of the exercises.

In ExercisesAdvancedFinder testQ5a and testQ5b

//-------------- Question 5 ------------------------------------------------------
// Find the average age of all Person objects.  This is a two stage question:
// 1) Find the average without using any special Mithra features.
// 2) Find the average using Mithra's AggregateList feature.

    public double getAverageAgeNormalMithra()
    {
        return  new PersonList(PersonFinder.all()).stream().mapToInt(p -> p.getAge()).average().getAsDouble();
    }

    @Test
    public void testQ5a()
    {
        Assert.assertEquals(34.75, this.getAverageAgeNormalMithra(), 0.0);
    }

    public double getAverageAgeUsingAggregateList()
    {
        AggregateList agg = new AggregateList(PersonFinder.all());
        agg.addAggregateAttribute("avgAge", PersonFinder.age().avg());
        return agg.get(0).getAttributeAsDouble("avgAge");
    }

    @Test
    public void testQ5b()
    {
        Assert.assertEquals(34.75, this.getAverageAgeUsingAggregateList(), 0.0);
        final Person person = new Person();
        person.setName("Michael Caine");
        person.setCountry("USA");
        person.setAge(65);
        person.insert();
        Assert.assertEquals(this.getAverageAgeNormalMithra(), this.getAverageAgeUsingAggregateList(), 0.0);
    }

The above is my answers to the questions. testQ5a produces a pass but testQ5b produces a fail.

I can't for the life of me see how to get testQ5b to work. The data type of the Person.age column is an int and the avg function in H2 would produce an int result from what I read of H2 (I'm new to H2). So it would appear that the getAttributeAsDouble will not affect the answer returned from H2. I get 34 returned and not the 34.75 answer which is what I got in testQ5a.

Can you tell me how this should work?

My only suggestion on the Kata is that it would be great to have the solutions to check against.

Reladomo is looking great as I progress through its features. Thanks for the work.

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.