How to improve at coding

Discussion in 'Spigot Discussion' started by viuw, May 1, 2020.

  1. Hello, I code Java & Plugins for like an year now and I already coded some decent plugins / programs but when I read other people code I find my self struggling to understand most of the time and I don't think my skills are enough to make "big" plugins, my biggest plugin was a uhc plugin but the code was really messy, I tried to code a practice plugin like 2 weeks ago but after short time I got stuck, how can I improve and what in your opinion is a "must" for a developer to know?
  2. You can only get better by doing this again and again. In doing so, you can then copy ideas from others (which you are already doing) and take out the best things from your point of view.

    What can also help is to look at the things you have programmed in the past and think about why you don't like them.

    Simple example:

    I don't like the „ IF (true)“. Then you look at what you would have to do differently to be more satisfied with it. The important thing is not just to imagine it, but to do it. Then you compare the two versions. You can then use the one you like better in the end.

    If you would like to have some ideas, you can have a look at the topic "Design Pattern". Here I have put an example link for you:

    There is also a kind of "etiquette" in programming and also especially for Java. These things are often also helpful for "nice" and "readable" source code.

    Another point is the topic object orientation. This goes into the "Design Pattern" section, but is a bit smaller:

    I hope this helps you a bit.
    • Winner Winner x 1
    • Informative Informative x 1
  3. thank you!
  4. I don't think there are any musts for developing. The skill you need will probably always be in relation to the goals you want to achieve. So it's kinda about your goals I think.
    Things I found useful for improving, though were:
    • Design patterns of course, reading about them is boring but some of them were pretty useful for me.
    • Letting a more advanced friend look at some parts of my code and getting some input on how to improve it. For me it was refreshing to get an opinion from a different point of view.
    • Trying work with someone else together. It can be a funny challenge to split task properly between people and find a consence especially when it comes to formatting xD
    • Trying to describe your porjects to other people, who are maybe not familiar with coding. It kinda felt stupid for me in the first place because I didn't think they can appreciate what I am creating. But the more often I did (and still do) it, the more I have the feeling that they can make more sense out of what I am gibbering. That's also a useful skill.
    Maybe some of these things sound interesting to you to try out. Anyway, just enjoy creating what's on your mind.
    • Informative Informative x 1
  5. Thanks!
  6. A lot of the "confusing" code you might see in larger plugins really isn't that bad once you actually look into what it's doing a bit deeper. Trying to understand code someone else wrote is always going to be more difficult than understanding your own code because your thought processes and development went into making it-- you already have it all mapped out in your head.

    But yes, they do implement more complex language features and design patterns, which can be a bit confusing at first.

    If you'd like me to give you some tips or just help you out overall my Discord is Tau#0951 :)
    • Informative Informative x 1
    • Friendly Friendly x 1
  7. Added, thanks a lot!
  8. Look at TheSourceCode on YouTube. Recently they have been doing walk through’s, showing how they code plugins. I feel watching this would help give context, they aren’t trivial plugins. They also have Bukkit/Spigot courses I would recommend.
  9. I know to code, my problem is clean coding
  10. Before my post just wanna say idk what your knowledge is so if you already know some of this stuff good for you ;)

    If you want to learn clean coding, take a project that you already made and look at it from a different angle, try something new like classes, functions and optimization. So how to make a plugin where you can read your own code and can easly expand on.

    My advice get a plugin that you already made and just try new stuff, you know those things are possible what you made in your previous plugin but try to make it with new ideas.

    I have been programming for over 5 years and I am now starting to use classes without using static abuse and it's working for me. ;)
    • Informative Informative x 1
  11. Thank you
  12. It's mainly exploring, try out new stuff. Try cleaning up your code according to Java OOP like Encapsulation etc.
    Go for a crash course in Java and work on things you don't think you fully got the hang of.
    Get methods to make your code cleaner like for example:
    instead of
    Code (Java):

    List<String> stringlist = new ArrayList<>();
    You could do something like:
    Code (Java):

    List<String> stringlist = Arrays.asList("1", "4", "51", "3445", "2", "61", "16", "100");
    Find more methods like this and your code could also look neater.
    • Informative Informative x 1
    • Informative Informative x 1
  13. Thanks!
  14. Thanks!