TheAlgorithms / Java

All Algorithms implemented in Java

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Convert the repository into a Java project

varunu28 opened this issue · 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.

Hey Anup. I would like to help with this as well. Let me know what you need help with

Hi Anup. Great idea. I also can help if you need.

Hello Anup,

This seems to be great thing. Please let me know if I can contribute.

Also, I am in and happy to contributes

So great, happy to join and contribute.

Presently working on solving most problems. I'm more than willing to help and contribute.

I can definitely help and contribute to this.

I'd love to contribute to make this repo a java project.

From what I've seen so far, the development branch is identical to the master in terms of structure and content. I'm used to working with maven in Java, however I saw that the scala repo is based on Travis CI. Would you like me to work on either of them, create the project and test for some of the existing classes?

@giannisal I initially created the development branch. I would move the code to that branch in a project structure by the weekend and would update the README for the test case format. After that we can start accepting contributions to the development branch for the tests
We are using ScalaTest spec in the Java repo

I have updated the development branch and added a instructions to the README. We can start with the migration.

@christianbender Please make sure every PR is adhering to the points mentioned in README on Development branch

which build tool should be used, maven or gradle? @varunu28 I didn't see on the Development branch.

What about bazel?

@lq920320 As of now we are concentrating on adding test coverage. We would be deciding on the build tool later

Hi, all I have started working on sorting algorithms
@varunu28 Are we following java 1.8 here?

@SatyaPrakashDwibedi Yes. We are following Java 1.8.

I'm happy to contribute as well. :)
Just to understand better, it is to transfer the already done algorithms from master to the new branch, in the appropriate package and then make test cases for them, right?

@Leoat12 Exactly(While following the correct coding standards and practices)
So just have a look at the README in development branch and if you see some code which is not according to the Java standard coding guidelines then feel free to refractor it.

I would like some help to collaborate with you. When I read Steps to raise a PR, what do you mean with "by using the command git checkout Development". Where do I write this commad? In my local repo or in the github web?

@MarisaAfuera You would have to fork the repo first and then when you cd into the repo on your local machine, you need to switch to development branch using git checkout Development

@MarisaAfuera I suppose eclipse also has a very good Git support(Not sure about exact setup)

If you face any issues on eclipse, I would advice you to run this command through a terminal

@varunu28 is there any progress on this issue? if not much, I will work on this tonight, and create a PR

@burnz248 The Development branch is created and instructions for opening a PR have been updated in the README of the branch

After forking, cloning and checking out to the Development I noticed that the structure of the project is not conventional, at least as I far as I've seen. The structure we usually see is this:

  • src\main\java\com\example
  • src\test\java\com\example

With this we have the same packages for both source and tests: com.example
I don't know about Eclipse because I will not using it right now, but IntelijIDEA complains a lot with the current structure. I think we can agree that a package structure which appears the "src" folder like here "src.main.com.java.conversions" is not conventional.
What do you think? Would it be better to make this change, it would be too much trouble for the rest of the collaborators?

@Leoat12 I have the project opened in IntelliJ and it shows a green mark in the IDE. I have a vanilla setup of IntelliJ and it is showing no issues. Can you please check if you have any kind of checker enabled?

@asdiamond As of now we are not considering any build tool. We are focussing on building a basic java project with complete test coverage.

@MarisaAfuera @Leoat12 I have updated the project structure now.

I Suggest to make a new branch that for this issue and merge it when it's ready or change it to be master branch.
This idea is best thing can be happen to this repo , excited to see it happening soon.

@khalil2535 Already created a Development branch and people have started contributing to it. Please refer Development branch for more details

@varunu28 hello i am completely new to github . it will great if you would guide me i will love to contribute , currently i am learning java so i can help with all my efforts
thanks

Sure @bhati-lokendra . You can start by adding tests to Development branch. Please refer the README before making the changes. Do let me know if you face any issues

What about adding Travis CI in the developement branch?

@NeverMendel That would be really helpful for testing as the tests are going to increase with time on the development branch

Do we really need this? As we are planning to go ahead with a website also for the organization where students can learn algorithms and their implementation in various programming languages. So for the automated fetching or the code from repositories using Github APIs, I think keeping them in single file codes will be beneficial down the line.

@AnupKumarPanwar It would be helpful if a beginner wants to pull the complete project on their local and want to change the code, tests would be beneficial. Also, someone trying to contribute to the repository, tests would be helpful in verifying their changes. The project structure and the test automation teaches the best Java practices along with the algorithms and keeps the repository in a systematic way.

As far as the website is concerned, we can make some changes to the API script to fetch codes from this project structure also. Great initiative btw. I was not aware of it and would be happy to be a part of this.

Hi, Sorry I couldn't keep up but what I came to know that as we are now migrating to a complete java project structure so we don't just need algorithms but also with test cases right??
If Yes:
I see that for conversion, search and sorting is done I can go ahead with Compression.
If No:
Where did I miss??
Thanks

Hi there, My name is Ales and i am new here and i want to be a contributor to this repo . So, how can i be that one , what are the procedures to follow?

@SatyaPrakashDwibedi You can refer the master branch and add tests for algorithms for which the tests are not present in Development

@ales-blaze Please refer README in Development branch

I had read that and i want to know answer of questions like, will you guys going to assign me which algo i have to implement? or may i choose it by my own?

@ales-blaze You can pick up an algorithm present in the master branch for which test cases are yet not implemented and then refactor the code into the module as described on the Development branch along with tests.

@ales-blaze You would need to provide some more details about the issue you are facing while posting a PR

I would suggest you have a look at GitHub PR

@varunu28 I am having issues with pushing my local repo to this repo.
whenever I pushed the local repo, it prompts me authentication window multiple times and after that the response to the request returned is Error 403.
help, please!

commented

I want to contribute as well. Does it matter which algorithm and corresponding tests I choose?

@a2937 You can go ahead by raising a PR. Just check that the algorithm you are choosing is not already present in the development branch.

If you still need a hand, I'd love to help.

hi,guys.can this project be imported into IDEA

@LukeBMorrow You can get started by raising a PR. Please check README on Development branch

@justStarNew Yes. It can be

Hi, Great idea. I also can help if you need.

@Danpatpang Thanks. Go ahead by raising a PR

I have started working on sorting algorithms, search algorithms.
@varunu28 May I implement DepthFirstSearch, BreadthFirstSearch and RadixSort?

@varunu28 I can contribute as well, if needed!Thanks

@varunu28 Is this still on going task?

@smitamoonka @SmitaMoon Yes. This is active. Refer to the README on the development branch and raise a PR against Development.

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.

commented

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.

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

commented

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

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

commented

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.

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.

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 )
commented

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

Hi all,
I raised a pull request to change the build tool from Maven to Gradle. #902

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

Is this still something that needs to be addressed?

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

Excellent Idea!

commented

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.