I've recently created a polynomial library as a learning experience. I feel like its very badly coded, since I'm a beginner, would someone be happy to check it out and maybe recommend some ways I can improve it or different ways I can do something. That would be helpful
(I've used C#)

  • 4
    I just quickly skimmed over it (and I don't often do C#). Here's some stuff I noticed:

    1. don't commit build artifacts and other junk the IDE generates into git.

    2. You tried to put a lot of comments in the first half of the main file, but most of them don't help to understand the code. Commenting is very tricky actually, and very easy to get wrong.

    If you variable is a list and is called "powers", I don't need a comment telling me the same thing.

    Or if there is an "if" which compares the lengths of two lists, I don't want to read a long ass comment telling me exactly that, but rather one which tells me *why*.

    Also, if your variables or functions need comments, better think about a better name.

    I'm not saying "don't comment", but rather "comment the why, not the what". Make the "what" obvious through good code.

    3. Please leave at least one empty line between function blocks. Looks very crowded.
  • 4
    4. The Readme neeeeds examples! It's the very first thing I look in a repository for a library!

    5. Your library is not actually a library, but rather an application. I think you should do a csproj for the library and one for the usage example.

    6. There is a weird goto in program.cs. Get rid of it. Most people dislike the usage of goto.

    7. The roots method writes to the console. You should let the caller know some other way that something went wrong.

    Keep it going, doing good small projects will improve your skills greatly!
  • 1
    @Embeddeded Thanks so much! Im very new to github so thanks for helping with that too. :)
  • 1
    @AwkwardBanana Glad I can help.

    By the way, there are still some files you don't want to have in your repository. Just take a look at your last commit: https://github.com/AwkwardBanana/...

    Basically everything which is not Sourcecode can go. After that, get a ".gitignore" template for visual Studio projects and those pesky files will never make their way into your repository again.
  • 0
    @Embeddeded thank you very much :)
  • 0
    Pro tip for next time: use the VCS tools built into Visual Studio and it will automatically give you a good .gitignore
Add Comment