The Tdarcos/Ben Pork Wager

Arcade Games & Cooking.

Moderators: AArdvark, Ice Cream Jonsey

User avatar
pinback
Posts: 17849
Joined: Sat Apr 27, 2002 3:00 pm
Contact:

Post by pinback »

I just want him to admit that it's not a bug, and he just hasn't understood any advances in computer language development in the last 30 years.
Am I a hero? I really can't say. But, yes.

User avatar
Ice Cream Jonsey
Posts: 30067
Joined: Sat Apr 27, 2002 2:44 pm
Location: Colorado
Contact:

Post by Ice Cream Jonsey »

Tdarcos wrote:Okay, fine. Show me how you change the value of the string object to something else. The one characteristic that makes something an object (as opposed to a constant) is that the object can be changed.
Strings are objects in modern computer languages, dude.

http://download.oracle.com/javase/1.4.2 ... tring.html

Says right there that the String class extends Object.

I said it before and I didn't mean it as an insult: there's 30 years of development in computer programming that you are not necessarily up on. That's not anyone saying that you aren't up on ANY thing languages do these days, but that they do stuff you aren't aware of.

(They do stuff I am not aware of, that Ben is not aware of, that any programmer here is not aware of. It includes others than you, but make no mistake, it does include you.)

No insult is implied. That's just the way it is, and it's going to get worse for programmers are more languages are developed and older languages go by the wayside.
the dark and gritty...Ice Cream Jonsey!

User avatar
Tdarcos
Posts: 9529
Joined: Fri May 16, 2008 9:25 am
Location: Arlington, Virginia
Contact:

Post by Tdarcos »

Ice Cream Jonsey wrote:
Tdarcos wrote:Okay, fine. Show me how you change the value of the string object to something else. The one characteristic that makes something an object (as opposed to a constant) is that the object can be changed.
Strings are objects in modern computer languages, dude.

http://download.oracle.com/javase/1.4.2 ... tring.html
Says right there that the String class extends Object.
Oracle can say anything they want. Does not mean they're correct. As Abraham Lincoln supposedly said, "If we take a horse and call its tail a leg, it does not mean the horse has 5 legs. Calling a tail a leg does not make it one."

Calling a constant with no properties, no methods, no changeable values and no way to add or remove anything an object, doesn't make it one. Basically, then, you could call a number an object then, which means basically everything is an object whether or not it has any characteristics of one.

This may be what Oracle wants to do, because it simplifies the programming paradigm by making everything an object. They can choose to do this if they want, but, to paraphrase my presidential quote, calling a manifest constant an object doesn't make it so.

It might be for political or technical reasons Oracle is doing this. Oracle apparently has had either a neutral or hostile relationship with Java ever since they got ownership of it when they bought Sun. A number of people have said that Oracle does not have the best intentions for the Java community with the way it has been acting lately.

So doing things this way could be anything. Declare a constant as an object and you eliminate distinctions, you're basically making everything that is a standalone element into an object as opposed to distinguishing between different things.

And in my opinion that's a bad idea, because strong typing, in which two things must be equal to the same thing to be equivalent, allows better code development because it improves the way programmers think. This has been one of the biggest reasons for attack vectors in C++ programs because the number of very complicated constructions you can use or misuse because there's no safety checks and you can get away with just about anything.

Preventing programmers from doing the wrong thing improves software development and reduces the possibility of an attacker injecting changes into your application. When you use different things for different purposes and can't "mix apples and oranges" you can't use conflicting constructs together and cause errors.

Now, if you're going to define an object as every self-contained element in a program then basically the term means everything... and nothing.
"Baby, I was afraid before
I'm not afraid, any more."
- Belinda Carlisle, Heaven Is A Place On Earth

User avatar
Ice Cream Jonsey
Posts: 30067
Joined: Sat Apr 27, 2002 2:44 pm
Location: Colorado
Contact:

Post by Ice Cream Jonsey »

Tdarcos wrote:Oracle can say anything they want. Does not mean they're correct. As Abraham Lincoln supposedly said, "If we take a horse and call its tail a leg, it does not mean the horse has 5 legs. Calling a tail a leg does not make it one."
Extending object means it's an object. Which I know you know. But that's where it's headed.
the dark and gritty...Ice Cream Jonsey!

User avatar
Tdarcos
Posts: 9529
Joined: Fri May 16, 2008 9:25 am
Location: Arlington, Virginia
Contact:

Post by Tdarcos »

Ice Cream Jonsey wrote:
Tdarcos wrote:Oracle can say anything they want. Does not mean they're correct. As Abraham Lincoln supposedly said, "If we take a horse and call its tail a leg, it does not mean the horse has 5 legs. Calling a tail a leg does not make it one."
Extending object means it's an object. Which I know you know. But that's where it's headed.
Again, they can call it an object or claim it's descended from one, but that does not make it so. The guy who designed Brainfuck can call it a programming language or claim it is one, but it's so ridiculously convoluted (hence the name) that no serious person would do so. (In fact, the Wikipedia article I pointed to above says it's "not suitable for practical use.")

Oh, speaking of Wikipedia, let's look at the first two sentences of the article on objects in computer programming: http://en.wikipedia.org/wiki/Object_%28 ... science%29
Wikipedia wrote:In computer science, an object is any entity that can be manipulated by the commands of a programming language, such as a value, variable, function, or data structure. (With the later introduction of object-oriented programming the same word, "object", refers to a particular instance of a class)[.] In the domain of object-oriented programming an object is usually taken to mean an ephemeral compilation of attributes (object elements) and behaviors (methods or subroutines) encapsulating an entity
How can a quoted string be manipulated? As far as I know, a quoted string is immutable. You can modify a variable containing a string, but a string constant itself cannot be modified because there is no capability to do so. Where are the attributes? What behaviors does it have?

Later it says
Three properties characterize objects:
Identity: the property of an object that distinguishes it from other objects
State: describes the data stored in the object
Behavior: describes the methods in the object's interface by which the object can be used
Where is the "idenity", "state" or "behavior" of a string constant that makes it an object? It has none of these.

I understand what they are doing, having read this. They are treating strings as a class, in which case then you can use methods of it, such as when you declare a string with the name "astring", then instead of using len(astring), left(astring,5), right(astring,6), mid(astring,10,5) you use methods of the string class such as astring.len, astring.left(5), astring.right(6), astring.mid(10,5), in which case you use methods of a string class to work on it instead of calling explicit functions that operate on strings. Okay, I'll buy that for variables which are strings or potentially for constants which are assigned a string value. It's just changing the syntax for manipulating string variables.

This you could do for a variable or constant which is instantiated to a string object.

But this is not the same as an item which is an unnamed manifest constant. It can't be accessed, cannot be modified and cannot have any actions performed on it. Now, if the compiler wants to change this manifest constant internally into a private named object/class that is a string constant, so that it can just treat it the same as any other object in order to manipulate it as such, that's an entirely different matter where the compiler redefines something as something else. Or where it changes something to make it easier on itself or for its own convenience.

On the IBM 360/370 mainframe, if you used a constant in an instruction, such as

Code: Select all

           L      12,=F'5'
           MVC  XRAY,="YES"
          ...
           MVC  ZULU,="YES"
It does not insert this where it is declared. The assembler creates these constants at the bottom of the program, creates an address for them, goes back and inserts the address, then when multiple references to a constant occur, it uses the same address for all of them.

Here, the compiler does this for its own convenience.

So I stand by my comments, a manifest constant can be called an object but just because someone is calling a manifest constant an object does not make it one.
"Baby, I was afraid before
I'm not afraid, any more."
- Belinda Carlisle, Heaven Is A Place On Earth

Post Reply