Class will teach Android Java / Kotlin, does that help me with plugin development?

Discussion in 'Programming' started by pinkpig, Jul 31, 2020 at 5:01 PM.

  1. I have trouble consistently learning Java online (or via books), especially if I'm trying to do it alongside college. So having it as a class kinda gives me an 'excuse' to put time into learning Java along with my other homework.

    Object Oriented Programming is especially what is making me thoroughly confused. I learned C++ a while ago and am used to thinking how I was taught for C++ (pretty linear, not using objects as much).

    Thus I've been waiting for several years (ik...) to finally qualify for the Java class at my university and I intend to take it in the Fall. However, I received an email they are now going to be teaching "Android Java / Kotlin" and we'll be using the Android IDE.

    Will this still teach me the necessary skills to reach my goals afterwards? Or is it far enough in a new direction that I should drop the class? I'm no longer a Computer Science major and would only be taking the class for my own goals.


    My Goals For Java Development:
    • Plugin Development (Free & Selling Plugins)
    • Minecraft Client stuff (No, I am not referring to hacked clients. But console clients, mods like Optifine, etc intrigue me.)
    • Teaching an AI how to play Minecraft by itself would be awesome, but if it involves a lot of Math I'll probably lose interest quickly. :p

    Feedback would be greatly appreciated. Thank you!
     
  2. I would say no but it depends on how much actually java you will learn and not just concentrated on Android. If you have a good knowledge after this in java it will take probably a bit but sooner or later you will. And i'm not a fan of Kotlin and dont like it with Spigot tbh. (never used it either with spigot)
     
    • Informative Informative x 1
  3. I actually never opened a programming book, and I have been programming for now 5 years

    My only goal was to create bukkit plugins, so I did follow some youtube series about it (well... it was mostly copy/paste at that time ahah)
    My suggestion would be to try to replicate what you see on other servers, its not the most efficient but you'll actually want to learn instead on relying on hundred of annoying pages, this is at least how I did it
     
  4. Well, I appreciate the suggestion and I agree with you that doing a project is probably one of the best ways to learn something. However, in my past experience, I do not have the discipline to learn Java in my free time. :( Especially during the school year. Hence why I waited years to qualify to take this course and now I am discovering it may not even teach me the things I want.

    I've tried to learn it from a book (Oracle 9 book, taking notes, & programming), from a website (Oracle if I recall correctly), and more directly for Spigot plugins (Installing Eclipse and trying to make plugins). Every time I either decided I didn't have enough time, ran out of motivation, or tried to rush it and quickly realized you cannot learn to develop plugins in 1-3 days. Lol.

    Read This Please:
    If you know a great place to learn about Object Oriented Programming, that is what I REALLY am stumped on. After 2 years of learning C++ (we were doing a pretty linear method. Rarely needing objects) now Java just thoroughly confuses me. I just cannot seem to wrap my head around how OOP Java should work. Feedback would be greatly appreciated.
     
    #4 pinkpig, Aug 2, 2020 at 12:24 AM
    Last edited: Aug 2, 2020 at 12:39 AM
  5. The issue is that there is no "all-in-one learning class"

    The reason for that is that not everything (almost nothing in fact) is related to java only. The way everyone learns is by learning step by step what is needed at the moment, for instance, one day you'll hear of threads and it will push you towards typing this into google and reading for hours tips and good practices about them. You will never find any general book going further in this field.

    Basically, you hear about a term/concept, you learn it for hours, you continue your project, you encounter another specific field, etc...
    Well my study isn't about computer science so I don't really know but my guess is that they have the same methodology, you always get homework which focuses on one specific feature and you continue until you don't need to document yourself about anything you have to do

    As for websites not giving you good practices, a personal teacher won't always too (not even your school), it is your goal to document yourself and determine what is the best way to do what you want (you'll almost always hear one thing and its opposite)

    As for the actual topic, learning android will obviously help you, you'll learn the syntax, how to integrate libraries, etc.. And when you'll want to switch to bukkit you'll "only" have to learn about the bukkit API
     
  6. Yeah, I reworded my paragraph but I sent it almost immediately after you commented on the old one. :p What I meant was essentially classes keep me focused and I end up learning 90% of stuff online but the class helps assign me things to help me learn new stuff (& force me to learn them. If I slack off I fail and it hurts my GPA). Most of what I've learned I've learned from online via documentation type sites like cppreference.com and cplusplus.com as well as people on forums that are a lot more experienced than me (such as on cplusplus's forums).

    Yeah, true.

    Haha, yeah I actually learned that the hard way. A fair amount of what my professors taught me I took as fact until I learned otherwise via documentation-type sites (like cppreference.com). Although I did forget about this until you commented about it.

    Ahh okay. Cool. I wasn't sure if Android programming in Java was like 90% programming with an Android library and barely using anything from Java.

    Although now that we've discussed ^ I am kinda curious about learning more directly for what I want to learn (like you did). Do you know a good place to learn about Object Oriented Programming, that is what I REALLY am stumped on. After 2 years of learning C++ (we were doing a pretty linear method. Rarely needing objects) now Java just thoroughly confuses me. I just cannot seem to wrap my head around how OOP Java should be used in my own programming. Feedback would be greatly appreciated. Thanks! :)
     
  7. I also struggled a lot when I first heard of OOP, my plugins only had a single giant class for months.

    I'm pretty sure that you can find a lot of simple examples of OOP evolving animals object and such, I honestly cannot remember where I learn it.
    I'd say that bukkit (and games in general) are pretty good for that since you already know the hierarchy (a player is an entity, a zombie is also one but not the exact same kind as the player)
    What is your problem with it? Inheritance? Or the fact that 1 class can create an infinite amount of objects?

    I'd say that my best tips would be to use objects as a way to separate each block of your code into its own part, for instance, if you are creating a game like Minecraft you need a class which will handle the world, another for the player, a class which will act as a manager for entities so you can have an overview of the count of entities in your world, etc...
     
    • Like Like x 1
  8. Don't let the fact that you're struggling with OOP withhold you from programming. There are plenty of people making (and publishing) plugins who haven't the slightest clue about OOP. OOP is absolutely very useful for programming in Java and without your code quality will likely be average at best, but that doesn't mean it can't be done. No one's code is perfect. Even large and competent code has pieces of code somewhere that you just wish would have been done differently, better designed, etc.

    OOP is difficult. However, from my experience, actually making a project and trying to improve the code over time will allow you to slowly grasp OOP better and better. Examples regarding OOP you usually see are often toy examples: animals, vehicles, shapes, etc. They may help you give a basis of understanding for the concept, but theory and practice often are two completely separate ideas and the type of OOP you see in practice is often a lot more abstract than those examples. This is why I heavily recommend making a project yourself, so you can learn more about applying OOP in practice, rather than just having a theoretical (and likely abstract) background of the concept.

    Whether you'll learn OOP in your course depends entirely on the course itself. Some courses are relatively shallow and you won't learn about it, some courses are more in-depth and you will learn about it. Ask the teacher of the course for a general outline of what is being taught in the course and ask if you'll learn about OOP. That should tell you whether this course is worth doing for you (in my opinion, learning is always good, but if you think this is a course you won't learn much from that interests you, then it can be beneficial to look for something else instead).

    If you still need some more theoretical background regarding OOP, you can take a look at this: https://docs.oracle.com/javase/tutorial/java/concepts/index.html. The Oracle documentation is in my experience usually abstract and difficult to comprehend if you have little to no experience with the given subject, however this one seems pretty decent.
     
    • Informative Informative x 1
    • Useful Useful x 1
  9. Well, rip. I meant to reply to this earlier but got distracted and forgot to click send.. It wiped my response.. So... In short:
    Thank you both for replying @TheMode911 & @Stef. Apologies for the late reply.

    I appreciate the suggestions! As for what I was struggling with specifically, I can't accurately describe it because it's been too long since I last tried learning Java & plugin development. Essentially Java focuses everything around objects while in C++ I learned to only use objects in a few pretty rare instances and even when they are used, they aren't the centerpiece of the code.

    Also, I completely agree that:
    • It's easier to think of objects via Minecraft objects. That makes more sense to me.
    • I also agree that it's very different to apply objects in actual programming compared to just thinking about it like a car or Minecraft mob.
      • For example: write a program that will open each file in X directory and rename the extension to .txt then open it and replace the third line with "hello world!" --- I see no objects in that example.. I suppose the file name could be an object, although in C++ I'd just use a variable.
    Also, I did email my teacher but he is very unreliable when it comes to getting in contact with him. So I figured I'd ask here as well.

    That link you provided Stef is actually one I've read in the past. However, I was less experienced with programming back then so maybe taking a look at it now will be more useful. Thanks!

    Lastly, you both made some very good points that project-based learning is typically most effective and would keep my interested longer. Plus I hadn't realized people develop plugins without using OOP (yeah, their code isn't good. But at least they're making something and learning like you mentioned). :)
     
  10. For writing this yourself, you're partially right. In this case, you won't need to create classes yourself. However, you will make use of a bunch of classes Java will already have for you.

    Path for instance is a Java class and you can create an object for a possible path you have on your pc (and also paths you don't have on your pc if you want to create a new file/directory there; this class is pretty lenient). Let's say you have this program and I type in my directory name in which I want your program to rename the extensions to .txt and replace the third line with "hello world!". You'd first create a Path object to represent the path to the directory I typed. After checking if it actually exists and it's actually a directory, you then get the underlying paths in this directory, which will be a DirectoryStream which is in essence nothing more than just a bunch of paths. So now you have a whole bunch of Paths to work with. So, you go over the paths and rename them: for renaming them you again need to specify a Path, yet another object you'll be creating. Then you get the contents of the file as a list of strings, yet another two objects. Strings are also considered objects in Java and a List is also an object (my C++ is pretty rusty, but I believe this class is similar to std::vector). You get the third line, replace it by your new String and then write it back to the file.

    For this code snippet, you already used objects of four internal classes. As you can see, Java is absolutely filled with objects anywhere you look (in fact there are only eight types of values that are not objects) and even if you won't be creating classes yourself, you'll surely be using ones created by others.
    And it is (String), but also a variable. The concept of variables don't differ here, just the type matters. In Java the type will be either the eight non-class types or a class. In general, any type of data that contains more data inside of it, can be (and probably should be) a class. In this case, a string contains multiple characters inside of it (and in the case of Java, some other miscellaneous stuff), which makes it a good candidate for a class. In C and C++ you have structs for bundling data, however Java doesn't have such a concept, so whenever you want to bundle data, you do so by creating a class. As an example, you can compare a simple base class for a movie in Java and C++:
    Code (Java):
    class Movie {
        String name;
        int year;
    }
    Code (C++):
    struct movie_t {
        string name;
        int year;
    }
    Other than the names being slightly different due to conventions, these two pieces of code are pretty much the same: you group two different pieces of data together in one piece. (Don't know how familiar you are with structs, I used them a bit when writing C, but have no idea if they're really used in C++. Regardless, maybe seeing some "classes" in a language you're more familiar with helps.)
     
    • Winner Winner x 1