Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 11 of 11

Thread: VBA programmer trying to learn Java

  1. #1
    Junior Member
    Join Date
    Sep 2014
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default VBA programmer trying to learn Java

    I have been doing a lot of VBA for quite a long time (coding millions of lines), but trying to learn the syntax and grammar of Java seems to be completely throwing me.

    I look at snippets of code here and there on the Internet but it all seems to just be functions calling each other and not actually performing any actual actions. I can see how to build classes, understand methods and instances, but how to get it to do anything seems to be eluding me.

    It is like there is some missing piece that is eluding me and preventing me from understanding this entire concept. A grammar key, if you will.

    I am hoping someone else might have similar background in VB and can help me find the key I am missing.


  2. #2
    Junior Member
    Join Date
    Sep 2014
    Posts
    21
    My Mood
    Cheeky
    Thanks
    1
    Thanked 1 Time in 1 Post

    Default Re: VBA programmer trying to learn Java

    I'm a VB programmer by trade self learning Java. I was very WTF? about it for a while. Now my VB code looks like a bunch of functions and subs all calling each other.

  3. #3
    Senior Member
    Join Date
    Jul 2013
    Location
    Europe
    Posts
    666
    Thanks
    0
    Thanked 121 Times in 105 Posts

    Default Re: VBA programmer trying to learn Java

    What exactly do you mean? What kind of code were you looking at?
    Code usually does quite a lot, of course, what you define as "doing something" is the more important question.

  4. #4
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,517
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: VBA programmer trying to learn Java

    Welcome to the Forum! Please read this topic to learn how to post code correctly and other useful tips for newcomers.

  5. #5
    Junior Member
    Join Date
    Sep 2014
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: VBA programmer trying to learn Java

    Quote Originally Posted by Cornix View Post
    What exactly do you mean? What kind of code were you looking at?
    Code usually does quite a lot, of course, what you define as "doing something" is the more important question.
    It was some word-scramble 'game' that came with NetBeans. Couldn't figure out HOW it was doing anything.

    What I am trying to do is figure out how to make a 'decision tree' that a user would walk though. The decisions they make alter a given object's properties.

    I can figure out how to make the object, and understand how to increment the variables within, but cannot figure out how to do the decision tree part. It isn't part of the object, so it doesn't belong in the class, but it doesn't really belong in any class because it only happens once. In VB I'd just make a linear-ish function that alters the variables and call it once but not sure how that works under Java.

  6. #6
    Senior Member
    Join Date
    Jul 2013
    Location
    Europe
    Posts
    666
    Thanks
    0
    Thanked 121 Times in 105 Posts

    Default Re: VBA programmer trying to learn Java

    What *is* a "decision tree'? You have to define the things you want to work with. How does the user interact with it, and how is anything altered? What kind of object is altered? How do you connect these things?

  7. #7
    Junior Member
    Join Date
    Sep 2014
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: VBA programmer trying to learn Java

    A decision tree is where each decision controls what possible decisions are next available. Similar to an If-Then tree, but dependent upon variables.

    For now, I am trying to design a list where the user picks from a selection. Each selection alters one property of the object. There are 6 levels of choices, the last three of which depend on the first three.

  8. #8
    Senior Member
    Join Date
    Jul 2013
    Location
    Europe
    Posts
    666
    Thanks
    0
    Thanked 121 Times in 105 Posts

    Default Re: VBA programmer trying to learn Java

    But how would the user do that? Do you want to have a GUI, do it via command line, read a text-document? Any part of a program which relies on interaction is more complicated by default.

  9. #9
    Junior Member
    Join Date
    Sep 2014
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: VBA programmer trying to learn Java

    If I am understanding your question correctly, I need to create a class that has the choices somehow embedded within it. Each object would then call the others in accordance with their place on the tree.

    Again, if I am understanding, EVERYTHING is an object or part of an, even processes. Something which is purely process seems to still require an object, even if it is a temporary one.

  10. #10
    Senior Member
    Join Date
    Jul 2013
    Location
    Europe
    Posts
    666
    Thanks
    0
    Thanked 121 Times in 105 Posts

    Default Re: VBA programmer trying to learn Java

    Not quite what I was saying but still somewhat correct.
    Not everything is an Object in java, there are primitive data types like int, float, double, boolean, etc, and there are static methods which can be called on classes instead of objects. The main method is static for example.
    But ideally everything else would be an object. You try to replicate reality with these objects.



    What I try to tell you is that its very easy to make a decision tree like what you have defined. There are millions of ways how to do it and most of them are rather simple. But just having a tree-based data structure is not really that helpful if you have no means of interacting with it. You have to break your problem down into several smaller tasks, for example:
    1) Define how the data structure looks like
    2) Define how the data structure is manipulated
    3) Define how the data structure is displayed to the user
    4) Define how the user can make decisions and feed them back into your program
    5) Define how the user input is translated into modifications to the data structure

  11. #11
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,517
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: VBA programmer trying to learn Java

    I think you're trying to fit Java and the little bit you know about it into a programming paradigm you know well from your VBA experience, and it's not going to fit.

    Classes provide the framework for defining the characteristics, actions, and external interfaces of objects which are instances of the class. Your fundamental concept of what a class is, does, and can be used for is not yet right, and I don't think you're going to get it right in this venue, primarily because we don't have a common language to use to discuss the topic.

    If you pick up a modern Java book and work through the first 5 to 7 chapters, which shouldn't take you that long, you should begin to understand OOP, classes, and objects and develop a common language we can then use to share ideas and concepts.

    You might also pick and choose topics from the Oracle Tutorials to read through to help you understand these concepts as well as how Java code does things.

Similar Threads

  1. Help me to learn java
    By leecher in forum Member Introductions
    Replies: 2
    Last Post: March 17th, 2022, 03:42 AM
  2. learn java
    By dhingraneha24 in forum What's Wrong With My Code?
    Replies: 25
    Last Post: March 24th, 2014, 06:24 AM
  3. Replies: 7
    Last Post: August 17th, 2013, 07:55 PM
  4. Hello, Why i want to learn Java
    By seal308 in forum Member Introductions
    Replies: 1
    Last Post: May 15th, 2012, 06:32 PM
  5. Easiest transition from VBA?
    By Milothicus in forum Java Theory & Questions
    Replies: 1
    Last Post: June 12th, 2010, 03:30 PM