Java icon indicating copy to clipboard operation
Java copied to clipboard

Convert the repository into a Java project

Open varunu28 opened this issue 8 years ago • 74 comments

@christianbender @AnupKumarPanwar @dynamitechetan

This is something which something which we have discussed in the past and have been raised by multiple users of the repo. The repo can be converted to a complete Java project with correct package structure, JUnit tests and Java language standard checkers. I want that anyone who is adding a new algorithm should add respective tests and follow a set coding standard so that the repo can become more usable for users who can then clone it into a local IDE and work on it.

Similar to Scala Repo

I propose that we create a development branch on which we can start making the changes and replace it with the master once it fulfills the above-mentioned requirement. I would like to take the initiative and start this task.

Please share your feedback.

varunu28 avatar Jul 29 '18 17:07 varunu28

Actually converting the repo into a Java project will not solve the purpose of this organization. We want to create this organization as an open source learning resource for data structures and algorithms which is easy to understand for beginners also and every program is capable of independent execution. This will also make it convenient to automatically fetch the code and execute it in case we go for building a website for learning the DSA.

AnupKumarPanwar avatar Jun 20 '19 05:06 AnupKumarPanwar

I've added a PR #815 that cleans up the code base to make working on it easier. After it gets merged I'll start with adding tests and all missing algorithms to the repo.

mainrs avatar Aug 25 '19 12:08 mainrs

is this still going on ? If yes, I want in on it !! Which algorithms need JUnit tests ?

jayyusi avatar Sep 14 '19 04:09 jayyusi

Just take a look at the development branch. Everything in there is OK. Everything else needs a port plus Junit tests

mainrs avatar Sep 14 '19 08:09 mainrs

Just take a look at the development branch. Everything in there is OK. Everything else needs a port plus Junit tests

Here's a question before I dive into this. CombSort.java exists in the master branch, but doesn't exist in the development branch. So based on what you said, it needs a test, can you confirm ? and what do you mean by port ? Thanks

jayyusi avatar Sep 14 '19 08:09 jayyusi

If it doesn't exist in development you have to get the code from master and add it to development. After that, you need to write unit tests for it. The tests should cover up most of the behavior of each algorithm. Like exceptions that might be thrown, wrong input formats etc.

By port I meant taking the algorithm from master and adding it to development. They need some tweaking because you don't need the main method anymore. The stuff in main should be covered by the tests. You also need to add package statements because the project structure changed to maven.

mainrs avatar Sep 14 '19 08:09 mainrs

If it doesn't exist in development you have to get the code from master and add it to development. After that, you need to write unit tests for it. The tests should cover up most of the behavior of each algorithm. Like exceptions that might be thrown, wrong input formats etc.

By port I meant taking the algorithm from master and adding it to development. They need some tweaking because you don't need the main method anymore. The stuff in main should be covered by the tests. You also need to add package statements because the project structure changed to maven.

Great, thank you, I will get to it soon, I'm gonna do CombSort.java first.

jayyusi avatar Sep 14 '19 09:09 jayyusi

I've added PR #825, which has 2 new files:

  1. CombSort.java ( copied from master as is, with minor changes to import statements and class interface implementation to accommodate project structure changes )
  2. CombSortTest.java ( which has 4 tests within it, Integer, String, Double, Character )

jayyusi avatar Sep 14 '19 22:09 jayyusi

Looks good. Edit: Added some changes that you should make to match with java's coding style.

mainrs avatar Sep 15 '19 03:09 mainrs

Hi all, I raised a pull request to change the build tool from Maven to Gradle. https://github.com/TheAlgorithms/Java/pull/902

Nowadays, Gradle is the most common build tool for new Java projects.

renjithgr avatar Sep 28 '19 06:09 renjithgr

Is this still something that needs to be addressed?

burnz248 avatar Apr 29 '20 03:04 burnz248

Is this still on going task? If so I would like to contribute :)

Adhikaribharath avatar May 13 '20 16:05 Adhikaribharath

Excellent Idea!

Detective-Khalifah avatar May 28 '20 22:05 Detective-Khalifah

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Mar 20 '21 09:03 stale[bot]