C++ vs JAVA

Discussion in 'PC Hardware, Software and Displays' started by K.I.L.E.R, Aug 27, 2003.

  1. K.I.L.E.R

    K.I.L.E.R Retarded moron
    Veteran

    Joined:
    Jun 17, 2002
    Messages:
    2,952
    Likes Received:
    50
    Location:
    Australia, Melbourne
    Ahh, thanks.

    I think you missed a bracket? ;)
     
  2. Typedef Enum

    Regular

    Joined:
    Feb 10, 2002
    Messages:
    457
    Likes Received:
    0
    Hmm...I don't think I did?

    In reading my post again, it didn't seem very clear. For the heck of it, let me try again with a more clear head.

    C# allows you to define properties for classes, unlike Java. What's a property? Try this.

    class Employee
    {
    private string m_name = "";

    public string Name
    {
    get { return m_name; }
    set { m_name = value; }
    }
    }

    If I were to create an Employee object:

    Employee emp = new Employee();

    ...I could now easily get/set the value:

    emp.Name = "Typedef Enum"; // Set the value

    Console.WriteLine("Employee name: " + emp.Name); // Get the value

    OK. If I wanted to use reflection to, say, query an object of type Employee:

    System.Type t = emp.GetType();

    Likewise, if I didn't have an employee object instanciated, I could also achieve the same thing with the following:

    System.Type t = typeof(Employee);

    Either way, I now have a type object. With a type object, you can now use reflection in a variety of ways to discover "things" about the type, such as:

    - Is it an interface?
    - Is it an abstract class?
    - What are the property(s) names?
    - What are the member function names?
    - What are the fields?

    etc. etc.

    Using the example I gave before, I could do something like this.

    (Note: Calling the GetProperties() function on class Type will return an array of PropertyInfo objects)

    foreach (PropertyInfo pi in t.GetProperties())
    {
    Console.WriteLine("This property name is: " + pi.Name);
    }

    If I were to execute that code, it would spit out:

    "This property name is: Name"

    It's a very powerful feature, and one that's used throughout .NET (in particular), as well as Java. In fact, .NET Studio 2003 uses reflection a _lot_ in order to accomplish a lot of "things" within the IDE itself. It's also used quite a bit once you start using ADO.NET, especially once you begin the process of binding Control objects/classes with Data objects. That is to say, it's used to link pure data classes (collections, DataSets, tables, databases, etc) and UI components that display the data, even when the UI components have no preconceived knowledge about the structure of the data. The prime example is the DataGrid.

    The DataGrid UI component is able to present data in a table, with column headers/etc. because it uses reflection to "inspect" the data structures to pull out this information.
     
  3. Anonymous

    Veteran

    Joined:
    May 12, 1978
    Messages:
    3,263
    Likes Received:
    0
    Saem I completely agree with your words.
     
  4. K.I.L.E.R

    K.I.L.E.R Retarded moron
    Veteran

    Joined:
    Jun 17, 2002
    Messages:
    2,952
    Likes Received:
    50
    Location:
    Australia, Melbourne
    Dig up a very old thread in order to say that?

    Either way, Java OpenGL apps have great speed on a gaming PC and games can be made using Java from the ground up and have excellent performance.

    Try LWJGL, JOGL, jME, Java3D, Xith3D.
     
  5. Fox5

    Veteran

    Joined:
    Mar 22, 2002
    Messages:
    3,674
    Likes Received:
    5
    No! Not Java3D!
    Eh, my final project for my AP Computer Science class was in Java3D, and it wasn't anything like I'd done before. It is an evil wrapper class, EVIL!
    Not sure about the performance, but in comparison to normal Java programs I'd seen in my class it had very good performance for what it was doing.
     
  6. K.I.L.E.R

    K.I.L.E.R Retarded moron
    Veteran

    Joined:
    Jun 17, 2002
    Messages:
    2,952
    Likes Received:
    50
    Location:
    Australia, Melbourne
    There are like 100 alternatives to Java3D.
    Try one of them, they're all different to suit different tastes.

     
Loading...

Share This Page

  • About Us

    Beyond3D has been around for over a decade and prides itself on being the best place on the web for in-depth, technically-driven discussion and analysis of 3D graphics hardware. If you love pixels and transistors, you've come to the right place!

    Beyond3D is proudly published by GPU Tools Ltd.
Loading...