Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (487)
Games in Android Showcase (110)
games submitted by our members
Games in WIP (552)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1] 2
  ignore  |  Print  
  OO Design - which is better?  (Read 2521 times)
0 Members and 1 Guest are viewing this topic.
Offline Troubleshoots

JGO Knight


Medals: 36
Exp: 7-9 months


Damn maths.


« Posted 2013-12-26 21:20:58 »

I'm creating a buffer object helper class which is usable by a user with little or no knowledge of OpenGL. I have a helper class for creating and handling buffers called NIOBuffer. No solution is going to be pretty but I'm wondering which solution would be best. The first problem is how to deal with inheritance as you cannot pass Buffer to e.g glBufferData - I could either:

  • 1. Eliminate inheritance and create five different classes for each data type.
  • 2. Cast to the correct buffer type.

I'd assume the latter is preferred for ease of use purposes but for design purposes they're both ugly. Now lets consider the actual design of that. Here I have one of three choices:

  • 1. Hold the buffer data as the data type Buffer, like so:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
public class BufferObject extends NIOBuffer {

   private int id;
   private int target;
   private int usage;

   public BufferObject(int target, Buffer buffer, int usage) {
      super(buffer);
      this.id = glGenBuffers();
      this.target = target;
      this.usage = usage;
   }

   //...
}


1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
public class NIOBuffer {

   public Buffer data;

   public NIOBuffer(Buffer buffer) {
      data = buffer;
   }

   //...
}


Pros:
   Easy to read
Cons:
   Type-unsafe (doesn't accept LongBuffer)

  • 2. This is pretty much thrown in as an opportunity to use generics which some would say is better OOD, but I could make the buffer type generic which would still require casting:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
public class BufferObject<T extends Buffer> extends NIOBuffer<T> {

   private int id;
   private int target;
   private int usage;

   public BufferObject(int target, T buffer, int usage) {
      super(buffer);
      this.id = glGenBuffers();
      this.target = target;
      this.usage = usage;
   }

   //...
}


1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
public class NIOBuffer<T extends Buffer> {

   public T data;

   public NIOBuffer(T buffer) {
      data = buffer;
   }

   //...
}


Pros:
   Easy to read
Cons:
   Not fully type-safe (again LongBuffer)

  • 3. Use multiple static nested classes and make it fully type-safe.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
public class BufferObject<T extends NIOBuffer<?>> {

   private int id;
   private int target;
   private int usage;
   private T buffer

   public BufferObject(int target, T buffer, int usage) {
      this.id = glGenBuffers();
      this.target = target;
      this.usage = usage;
      this.buffer = buffer;
   }

   //...
}


1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
public class NIOBuffer<T extends Buffer> {

   public T data;

   public NIOBuffer(T buffer) {
      data = buffer;
   }

      public static class NIOByteBuffer extends NIOBuffer<ByteBuffer> {

         public NIOByteBuffer(ByteBuffer buffer) {
            super(buffer);
         }

      }

      // other classes...

   }
}


Pros:
   Type-safe
Cons:
   Hard to read?

And then here is how I would have to cast everything (prepare to throw up):

Fields:
1  
2  
3  
4  
5  
private Class<ByteBuffer> byteType = null;
private Class<ShortBuffer> shortType = null;
private Class<IntBuffer> intType = null;
private Class<FloatBuffer> floatType = null;
private Class<DoubleBuffer> doubleType = null;


In my constructor I'd have to add:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
if(buffer.data instanceof ByteBuffer) {
   byteType = (Class<ByteBuffer>) buffer.data.getClass();
} else if(buffer.data instanceof ShortBuffer) {
   shortType = (Class<ShortBuffer>) buffer.data.getClass();
} else if(buffer.data instanceof IntBuffer) {
   intType = (Class<IntBuffer>) buffer.data.getClass();
} else if(buffer.data instanceof FloatBuffer) {
   floatType = (Class<FloatBuffer>) buffer.data.getClass();
} else if(buffer.data instanceof DoubleBuffer) {
   doubleType = (Class<DoubleBuffer>) buffer.data.getClass();
} else {
   throw new IllegalStateException(buffer.data.getClass().toString());
}


For a single OpenGL function...
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
if(byteType != null) {
   glBufferData(target, (byteType.cast(buffer.data)), usage);
} else if(shortType != null) {
   glBufferData(target, (shortType.cast(buffer.data)), usage);
} else if(intType != null) {
   glBufferData(target, (intType.cast(buffer.data)), usage);
 else if(floatType != null) {
   glBufferData(target, (floatType.cast(buffer.data)), usage);
} else if(doubleType != null) {
   glBufferData(target, (doubleType.cast(buffer.data)), usage);
}


So... have fun answering. Please give some other design alternatives too. Oh and if anyone has any better methods of casting stuff please post them below. This is just what I could think from off the top of my head.

Why are all OpenGL tutorials written in Brainf**k?
Offline Danny02
« Reply #1 - Posted 2013-12-26 22:09:21 »

Only use ByteBuffer in your API.
A user can always convert a ByteBuffer to any other data-type-buffer.

Alway remember the KISS principle Smiley
Offline 65K
« Reply #2 - Posted 2013-12-26 22:16:25 »

Hard to comment without knowing what your helper stuff shall actually do which is pretty unclear from your snippets and description.

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Troubleshoots

JGO Knight


Medals: 36
Exp: 7-9 months


Damn maths.


« Reply #3 - Posted 2013-12-26 22:22:10 »

Only use ByteBuffer in your API.
A user can always convert a ByteBuffer to any other data-type-buffer.

Alway remember the KISS principle Smiley

Ah I never even realised that you could do that with ByteBuffer. However that would give me the exact same problem. I'd have to cast it if the buffer type was changed.

Hard to comment without knowing what your helper stuff shall actually do which is pretty unclear from your snippets and description.

The helper class just holds the buffer data and provides helper methods which allows easy creation of a buffer from a set of floats, e.g:

1  
2  
3  
4  
   public static NIOShortBuffer createShortBuffer(short... contents) {
      return new NIOShortBuffer((ShortBuffer) ShortBuffer
            .allocate(contents.length).put(contents).flip());
   }
.

Why are all OpenGL tutorials written in Brainf**k?
Offline 65K
« Reply #4 - Posted 2013-12-26 22:45:13 »

Hard to comment without knowing what your helper stuff shall actually do which is pretty unclear from your snippets and description.

The helper class just holds the buffer data and provides helper methods which allows easy creation of a buffer from a set of floats, e.g:
And what does a NIOBuffer do, what a BufferObject ?

Offline Danny02
« Reply #5 - Posted 2013-12-26 23:03:06 »

no need for any casting, let me give you an example:

1  
2  
3  
4  
5  
6  
float[] data = ...;
ByteBuffer buffer = BufferUtil.createByteBuffer(4 * data.length);
FloatBuffer floats = buffer.asFloatBuffer();
floats.put(data);

new BufferObject(TARGET, buffer, USAGE);


just force your user to provide a ByteBuffer and everybody is happy.
Offline davedes
« Reply #6 - Posted 2013-12-27 02:19:07 »

I agree with Danny02 -- KISS.

If your library is bloated and over-engineered, and doesn't even provide any high-level features, then it sounds pretty useless. I would steer away from trying to wrap GL concepts exactly 1:1, and instead aim to provide a useful library. If a user needs to provide some obscure and specific parameters to accomplish a particular optimization, they can just call GL directly. See LibGDX's glutils for reference.

Offline Troubleshoots

JGO Knight


Medals: 36
Exp: 7-9 months


Damn maths.


« Reply #7 - Posted 2013-12-27 11:08:07 »

no need for any casting, let me give you an example:

1  
2  
3  
4  
5  
6  
float[] data = ...;
ByteBuffer buffer = BufferUtil.createByteBuffer(4 * data.length);
FloatBuffer floats = buffer.asFloatBuffer();
floats.put(data);

new BufferObject(TARGET, buffer, USAGE);


just force your user to provide a ByteBuffer and everybody is happy.

How would that work? Java is pass by value.

I agree with Danny02 -- KISS.

If your library is bloated and over-engineered, and doesn't even provide any high-level features, then it sounds pretty useless. I would steer away from trying to wrap GL concepts exactly 1:1, and instead aim to provide a useful library. If a user needs to provide some obscure and specific parameters to accomplish a particular optimization, they can just call GL directly. See LibGDX's glutils for reference.

That's the exact opposite of what I'm trying to do. I'm trying to create a library which is usable by someone without any past experience of OpenGL. I'm not trying to make them have to pass obscure and specific parameters but to simply pass a buffer of any kind.

And what does a NIOBuffer do, what a BufferObject ?

NIOBuffer holds a java.nio.[datatype]Buffer. A BufferObject is an object which holds data on the GPU. LWJGL has several overloaded methods which pass either a ByteBuffer, ShortBuffer, IntBuffer, FloatBuffer or DoubleBuffer to the GPU. What I'm trying to do is allow the user to use one of the helper methods in NIOBuffer which returns a sub-class of NIOBuffer that holds the buffer data and then the user can use that as the generic type parameter of BufferObject and pass that subclass to the constructor which uses that to obtain the buffer data.

Since LWJGL cannot accept java.nio.Buffer as a parameter (since LongBuffer is not supported) I have to cast that Buffer to the correct buffer type. That however requires the horrible bloated code which I posted above. What I want is to either find a more efficient and easier way of casting the Buffer to the correct buffer type which I don't think is possible or an alternative design for my library which is still usable by a user with no knowledge of how to use OpenGL.

Why are all OpenGL tutorials written in Brainf**k?
Offline Danny02
« Reply #8 - Posted 2013-12-27 11:19:23 »

How would that work? Java is pass by value.

what has this to do with pass by value in your mind?
Take a look at the docs:
Quote
asFloatBuffer
Creates a view of this byte buffer as a float buffer.
The content of the new buffer will start at this buffer's current position. Changes to this buffer's content will be visible in the new buffer, and vice versa; the two buffers' position, limit, and mark values will be independent.

The new buffer's position will be zero, its capacity and its limit will be the number of bytes remaining in this buffer divided by four, and its mark will be undefined. The new buffer will be direct if, and only if, this buffer is direct, and it will be read-only if, and only if, this buffer is read-only.
Offline 65K
« Reply #9 - Posted 2013-12-27 11:23:03 »

NIOBuffer holds a java.nio.[datatype]Buffer. A BufferObject is an object which holds data on the GPU. LWJGL has several overloaded methods which pass either a ByteBuffer, ShortBuffer, IntBuffer, FloatBuffer or DoubleBuffer to the GPU. What I'm trying to do is allow the user to use one of the helper methods in NIOBuffer which returns a sub-class of NIOBuffer that holds the buffer data and then the user can use that as the generic type parameter of BufferObject and pass that subclass to the constructor which uses that to obtain the buffer data.
Take a step back, re-read by yourself, and think whether this concept is suitable for OpenGL newbies and simplifies its usage.

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Troubleshoots

JGO Knight


Medals: 36
Exp: 7-9 months


Damn maths.


« Reply #10 - Posted 2013-12-27 12:18:37 »

@Danny02: I don't quite understand. How does the ByteBuffer share the modified data of the FloatBuffer? I wrote this simple code;

1  
2  
3  
4  
ByteBuffer bb = (ByteBuffer) BufferUtils.createByteBuffer(2 << 2);
FloatBuffer fb = bb.asFloatBuffer();
fb.put(3f).put(4f).rewind();
System.out.println(fb.get() +", "+ bb.get() +", "+ fb.position() +", "+ bb.position());

Result:
3.0, 0, 1, 1


According to the docs the result should be 3.0, 3.0, 1, 1 should it not?

Quote
changes to this buffer's content will be visible in the new buffer, and vice versa

@65K: Do you have any other alternative designs which allow the user to create a buffer object with no knowledge of using OpenGL? It seems simple enough to me. Anyone with a good knowledge of the Java language should grasp the idea quite easily if it's well documented.

Why are all OpenGL tutorials written in Brainf**k?
Offline 65K
« Reply #11 - Posted 2013-12-27 12:28:30 »

@65K: Do you have any other alternative designs which allow the user to create a buffer object with no knowledge of using OpenGL? It seems simple enough to me. Anyone with a good knowledge of the Java language should grasp the idea quite easily if it's well documented.
What kind of knowledge do we not need when we use this buffer stuff ?
Give us a line of code what you would users like to type to use it.

Offline Troubleshoots

JGO Knight


Medals: 36
Exp: 7-9 months


Damn maths.


« Reply #12 - Posted 2013-12-27 12:46:08 »

What kind of knowledge do we not need when we use this buffer stuff ?
Give us a line of code what you would users like to type to use it.

If you wanted to create a simple vbo and fill it with data,

With LWJGL:

1  
2  
3  
4  
5  
int vboId = glGenBuffers();
float[] data = {...};
glBindBuffer(GL_ARRAY_BUFFER, vboId);
glBufferData(GL_ARRAY_BUFFER, (FloatBuffer) BufferUtils.createFloatBuffer(data.length).put(data).flip(), GL_STATIC_DRAW);
glBindBuffer(GL_ARRAY_BUFFER, 0);

With my library:

1  
2  
float[] data = {...};
BufferObject<NIOFloatBuffer> vbo = new BufferObject<NIOFloatBuffer>(BufferObject.Target.ARRAY_BUFFER, NIOBuffer.createFloatBuffer(data), BufferObject.Usage.STATIC_DRAW);


Everything would be fully documented and I'd include method chaining. Overall my main purpose is to create a library that someone familiar with Java but not familiar with OpenGL could use.

Why are all OpenGL tutorials written in Brainf**k?
Offline Longor1996
« Reply #13 - Posted 2013-12-27 14:21:42 »


With LWJGL:
1  
2  
3  
4  
5  
int vboId = glGenBuffers();
float[] data = {...};
glBindBuffer(GL_ARRAY_BUFFER, vboId);
glBufferData(GL_ARRAY_BUFFER, (FloatBuffer) BufferUtils.createFloatBuffer(data.length).put(data).flip(), GL_STATIC_DRAW);
glBindBuffer(GL_ARRAY_BUFFER, 0);


With my library:
1  
2  
float[] data = {...};
BufferObject<NIOFloatBuffer> vbo = new BufferObject<NIOFloatBuffer>(BufferObject.Target.ARRAY_BUFFER, NIOBuffer.createFloatBuffer(data), BufferObject.Usage.STATIC_DRAW);


Everything would be fully documented and I'd include method chaining. Overall my main purpose is to create a library that someone familiar with Java but not familiar with OpenGL could use.

I never used VBO's, and thus don't know how to use them correctly, and the pure LWJGL-Code seems much simpler than your code.
You are making the interfacing with OpenGL even harder than before!

You should better make a class that lets you create a 'Mesh', to which you can then add vertices in any way you wan't.
The class itself then handles the VBO stuff in the background, so the user will only have to call simple 'addVertex' 'addTriangle' 'addQuad' 'renderMesh' methods.

That would be much more user friendly than your current approach.

Have a nice day.

- Longor1996

Sorry for my bad English! That's because i am from Germany.
Offline Troubleshoots

JGO Knight


Medals: 36
Exp: 7-9 months


Damn maths.


« Reply #14 - Posted 2013-12-27 14:37:13 »

@Longor1996 Buffer objects aren't just for vertices. That's just one usage of them. They have many uses; their purpose is to store data on the GPU. They can be used for other things like texture coordinates. I do however like your idea of adding helper methods for creating simple shapes. I'll find a way to implement that in the future.

Why are all OpenGL tutorials written in Brainf**k?
Offline davedes
« Reply #15 - Posted 2013-12-27 14:38:34 »

If you wanted to create a simple vbo and fill it with data,

With LWJGL:

1  
2  
3  
4  
5  
int vboId = glGenBuffers();
float[] data = {...};
glBindBuffer(GL_ARRAY_BUFFER, vboId);
glBufferData(GL_ARRAY_BUFFER, (FloatBuffer) BufferUtils.createFloatBuffer(data.length).put(data).flip(), GL_STATIC_DRAW);
glBindBuffer(GL_ARRAY_BUFFER, 0);

With my library:

1  
2  
float[] data = {...};
BufferObject<NIOFloatBuffer> vbo = new BufferObject<NIOFloatBuffer>(BufferObject.Target.ARRAY_BUFFER, NIOBuffer.createFloatBuffer(data), BufferObject.Usage.STATIC_DRAW);


Everything would be fully documented and I'd include method chaining. Overall my main purpose is to create a library that someone familiar with Java but not familiar with OpenGL could use.
All of this to save a couple lines of code. When the reality is that nobody will use your BufferObject class if you give them a VertexBuffer and IndexBuffer utility, like LibGDX.

IMHO this is an example of over-engineering. You're adding unnecessary bloat and complexity to a library instead of focusing on what really matters.

Offline 65K
« Reply #16 - Posted 2013-12-27 14:41:14 »

IMHO this is an example of over-engineering. You're adding unnecessary bloat and complexity to a library instead of focusing on what really matters.
That was my point as well.
And the approach does not free you from OpenGL knowledge at all.

Offline Danny02
« Reply #17 - Posted 2013-12-27 14:43:32 »

pls read the docs^^ and then try getFloat on the ByteBuffer or you will get only the first byte of the float which is 0 as it seems for 3f.


btw as a general thought, in my framework I can do something like this. I will probably change my code in the near future quite drasticly, but I think as a first try it was quite a nice api.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
VectorType FLOAT3 = new GenericVector(FLOAT, 3);
Element POSITION = new Element(FLOAT3, "position");
Element COLOR = new Element(FLOAT3, "color");

DataLayout layout = new DataLayout(INTERLEAVE32, POSITION, COLOR);

VertexBuffer buffer = new VertexBuffer(layout, 3);

for(Vertex v: buffer)
{
  v.set(POSITION, 2, 3.4f, 1);
  v.set(COLOR, 0.3f, 0.8f, 0.9f);
}
Online Riven
« League of Dukes »

JGO Overlord


Medals: 781
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #18 - Posted 2013-12-27 14:45:32 »

@Troubleshoots: you should drop the idea of writing a library, and reconsider it after at least a year, when you have more experience. You can only build tools for others when you have a solid understanding of the underlying mechanics. My impression is that you're just starting out and still discover new things and concepts every day. My advice to you is to use libraries, not make them. By the time you understand how these libraries work, and more importantly, why they were designed that way, you will have enough information to roll your own - if you still feel like it's the way to go.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline Troubleshoots

JGO Knight


Medals: 36
Exp: 7-9 months


Damn maths.


« Reply #19 - Posted 2013-12-27 15:03:16 »

All of this to save a couple lines of code. When the reality is that nobody will use your BufferObject class if you give them a VertexBuffer and IndexBuffer utility, like LibGDX.

IMHO this is an example of over-engineering. You're adding unnecessary bloat and complexity to a library instead of focusing on what really matters.

I hate the state based structure of OpenGL which is the main reason why I'm writing this library. It's mainly for personal use.

@Troubleshoots: you should drop the idea of writing a library, and reconsider it after year, when you have more experience. You can only build tools for others when you have a solid understanding of the overlaying mechanics. My impression is that you're just starting out and still discover new things and concepts every day. My advice to you is to use libraries, not make them. By the time you understand how these libraries work, and more importantly, why they were designed that way, you will have enough information to roll your own - if you still feel like it's the way to go.

Writing my own library will help me learn. Design can be changed. I don't see the point of using a library if my goal is to create a library. Using a library is a short-cut. I feel that I'll learn more by going the longer route; after all, I have the time.

pls read the docs^^ and then try getFloat on the ByteBuffer or you will get only the first byte of the float which is 0 as it seems for 3f.

Oh thanks I've got it to work. I'll change my design.

Why are all OpenGL tutorials written in Brainf**k?
Online Riven
« League of Dukes »

JGO Overlord


Medals: 781
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #20 - Posted 2013-12-27 15:06:43 »

Its a huge misconception that you learn faster by disregarding knowledge gathered by others.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline Troubleshoots

JGO Knight


Medals: 36
Exp: 7-9 months


Damn maths.


« Reply #21 - Posted 2013-12-27 15:17:41 »

Its a huge misconception that you learn faster by disregarding knowledge gathered by others.

I didn't imply that. Re-read it.

Why are all OpenGL tutorials written in Brainf**k?
Online Riven
« League of Dukes »

JGO Overlord


Medals: 781
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #22 - Posted 2013-12-27 15:36:11 »

When I visit China, I enter the realm of secluded Chinese poets, to learn to express myself with the subtleties of the language. Getting food on my plate and finding shelter is tough as I struggle with verbs, but this particular route will help me in the long run. I also repeatedly told some local English teacher in my best Chinese to get off my lawn.

So long, and thanks for all the fish!

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline Troubleshoots

JGO Knight


Medals: 36
Exp: 7-9 months


Damn maths.


« Reply #23 - Posted 2013-12-27 16:27:52 »

Sorry I'm useless with poetry.

Everyone has their own opinion of which affects their views. Their views affect the way that they interpret things which is driven more by assumption than by understanding.

Quote
I don't see the point of using a library if my goal is to create a library. Using a library is a short-cut. I feel that I'll learn more by going the longer route

Saying that not using a library does not relate to disregarding knowledge. A library can be thought of as a mask; it hides required knowledge. By creating my own library I gather that hidden knowledge, thus I learn more.

Anyway, this meaningless conversation is going way off topic.

Why are all OpenGL tutorials written in Brainf**k?
Offline Danny02
« Reply #24 - Posted 2013-12-27 16:40:50 »

The thing is this, everybody starts out creating his own library, because they think in the same way as you. But after a while all agree that it is better to just use a lib instead of creating an own.
Online Riven
« League of Dukes »

JGO Overlord


Medals: 781
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #25 - Posted 2013-12-27 16:58:58 »

Let me try to convince you with another analogy -

How would you rather learn a foreign language?
  • by writing a book in said language
  • by reading a book in said language

When writing the book, you always find yourself being held back by your current knowledge. You'll barely make progress, and if any, often in the wrong direction. When reading the book, you find yourself quickly gaining knowledge, allowing you to write a much better book much later.

TLDR: don't write libraries for things you don't grasp yet, if you want to get anywhere.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline Troubleshoots

JGO Knight


Medals: 36
Exp: 7-9 months


Damn maths.


« Reply #26 - Posted 2013-12-27 17:01:16 »

Let me try to convince you with another analogy -

How would you rather learn a foreign language?
  • by writing a book in said language
  • by reading a book in said language

When writing the book, you always find yourself being held back by your current knowledge. You'll barely make progress, and often in the wrong direction. When reading the book, you find yourself quickly gaining knowledge, allowing you to write a much better book much later.

TLDR: don't write libraries for things you don't grasp yet, if you want to get anywhere.

Actually you wouldn't be able to read the book.
I'll learn the way I decide to learn.

Why are all OpenGL tutorials written in Brainf**k?
Online Riven
« League of Dukes »

JGO Overlord


Medals: 781
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #27 - Posted 2013-12-27 17:05:15 »

I learned freaking French in high school with a book that only had French words in the first dozen pages.

    Au secours! Au secours!
    - Qu'est-ce c'est?
    Un serpent!
    - Non, c'est un tuyau...
    


I guess some people want to make their own mistakes.
Each and every one of 'em, ofcourse. Have fun!

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline Jimmt
« League of Dukes »

JGO Kernel


Medals: 128
Projects: 4
Exp: 3 years



« Reply #28 - Posted 2013-12-27 17:32:31 »

Huh, I never wanted to make my own library Tongue
Probably because I'm too lazy...
Offline Ghidra

Senior Newbie


Medals: 3



« Reply #29 - Posted 2013-12-29 23:26:43 »

Its a huge misconception that you learn faster by disregarding knowledge gathered by others.

It doesn't sound like he is disregarding existing libraries.  A tremendous amount of understanding and (especially) confidence can be gained by implementing one's own approach to a solution and then comparing it with what is considered to be the accepted solution.  For example, if I am writing a function that mostly mimics the behavior of a function in a given library, then through comparison I can see what it was about my approach that works and meanwhile isolate whatever it was that I was trying to do differently.  Does another function exist in the library that will cover this extra utility?  If so then great.  If not then you just uncovered some valuable work to be done.

It is incredibly foolish to be learning a language and expect that you will be able to improve what the general purpose libraries have to offer--they benefit from the input and review of numerous people, each with ample experience, and are there for a reason.  This seems to be the argument that most of you are making, but that doesn't seem to be what is going on here:  he is creating his own personal set of tools which he will refine as he gains more experience.  If they serve some utility then he will keep using them.  If not then he will toss them out and either use that which has already been made available by others or fine tune his approach and start again.
Pages: [1] 2
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

CopyableCougar4 (23 views)
2014-08-22 19:31:30

atombrot (34 views)
2014-08-19 09:29:53

Tekkerue (30 views)
2014-08-16 06:45:27

Tekkerue (28 views)
2014-08-16 06:22:17

Tekkerue (18 views)
2014-08-16 06:20:21

Tekkerue (27 views)
2014-08-16 06:12:11

Rayexar (65 views)
2014-08-11 02:49:23

BurntPizza (41 views)
2014-08-09 21:09:32

BurntPizza (31 views)
2014-08-08 02:01:56

Norakomi (41 views)
2014-08-06 19:49:38
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!