UCL-INGI / LEPL1402

INGInious tasks for LEPL1402 at EPL ( UCLouvain )
4 stars 5 forks source link

Refactoring #44

Open Ahzed11 opened 2 years ago

Ahzed11 commented 2 years ago

Refactoring

Ahzed11 commented 2 years ago

File structure

Files

AlexandreDubray commented 2 years ago

Some comments

import static org.junit.Assert.assertEquals

public class ExerciseTest {

    @Test 
    public void test1() {
         // some tests that call the student's code
    }
}

Also don't forget to add the //BEGIN STRIP and //END STRIP so the students have a small test to launch when downloading the intellij project

And then starting from this the python script generates an inginious directory (but it should not be present at the beginning).

As a start, do not handle inginious things. Just make a repo with the exercises and the structure shown above. We should be able to run a command like mvn test and all the tests should ran and pass.

Ahzed11 commented 2 years ago

Sorry for bothering you but do you know a way to make IntelliJ understand that the files in src/ are Java classes ? I can't get any autocompletion when working in that folder.

AlexandreDubray commented 2 years ago

Looks better for the structure :+1:

For intellij you need to tell it that it is a java code repository, you can for example add a pom.xml at the root and use maven to run it.

Ahzed11 commented 2 years ago

When working on section 3 I encountered a problem with auxiliary classes.

The three exercises about Binary Trees include a Node class with the same name which means we have three different definitions of the same class in the same package.

Should I rename the Node classes or will we use a different solution to this problem ?

AlexandreDubray commented 2 years ago

You can define the node class as a private class in the Tree classes. Something like

public class Tree {
    private class Node {
        ....
    }
}

should work. You can define getters to access elements of the nodes.

Also could you i) Not push .iml files that are specific to intellij? ii) Put the src node at the root of the project. The idea is that the repo is a java project iii) You can delete the old folders as you go on. What's need to be done will be easier to see