The Artima Developer Community
Sponsored Link

Weblogs Forum
Authors and Computer Scientists Scared of Definitions?

53 replies on 4 pages. Most recent reply: Sep 15, 2006 2:09 PM by Mumtaz Shah

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 53 replies on 4 pages [ « | 1 2 3 4 | » ]
Steve Loughran

Posts: 9
Nickname: stevel
Registered: Feb, 2006

Re: Authors and Computer Scientists Scared of Definitions? Posted: Sep 9, 2006 1:27 PM
Reply to this message Reply
Advertisement
As an author, I believe we have to choose what the target audience is. If I'm targeting late year undergrads, I can talk about "n-tuples", "arity", "s-expressions", "polynominal time", and "finite state machine". If I'm talking to mainstream software develpers I'd only use the latter two when appropriate and have to think carefully whether or not to use it.

But here's a harder one. "graph" and "tree". They get used all over the place, but they have specific meanings in CS, especially when words like directed and acyclic come up. Ant build files, valid ones are a Directed Acyclic Graph, if you have a cycle the tool tells you off. It doesnt say "this is not a DAG", as that would scare off end users. End users get warned of loops. But come join the dev team and yes, graph sorting is a topic that can be discussed and which nobody feels bad about using the terms, though anyone who doesnt know what they mean is free to ask -and get three or four different interpretations in return.,

Cleo Saulnier

Posts: 77
Nickname: vorlath
Registered: Dec, 2005

Re: Authors and Computer Scientists Scared of Definitions? Posted: Sep 9, 2006 7:31 PM
Reply to this message Reply
> Above, you said: "I mean how the data in question is to
> be
> used along with what operations are valid on it."
>
> "int" is a representation of integral numbers. The
> operations on it loosely matches those you may do in
> mathematics on integral numbers.
>
> I think describes it as a type, just fine: It's a type
> that may be used to model integral numbers.

Yeah, but using integral numbers for their sake alone is very seldom done unless you're into number theory. Every time I use a number, it's meant for a specific purpose, yet I know of no one that would define another type just to qualify its use. The reason for this is simple. It adds nothing to the execution and take extra time to write out, not to mention that many languages don't have facilities for this or at least don't define a standard way to do this.

>
> > Is it a distance, pixels, socket number, etc?
>
> Those are different concepts, and typically better
> modelled by separate types.

Like I said, who actually does that? And no, they are not different concepts. They are still numbers. They just have additional interpretations.

>
> > If that were also defined, then it'd
> > be more of a true type, IMNSHO. Classes don't qualify
> > because the members don't tell anything to the
> compiler.
>
> Huh? Classes tell the compiler what operations may be
> possible on them, and their results, if any. In other
> words, how values of a given class may be used.

No they don't. Add a member to a class and the compiler can't infer anything from that member. All it knows is that there's an extra value there. Classes don't tell what operations are possible on them, their methods do. I find this to be a half solution too. Double dispatch for example.

>
> > You can overload operators, but it's an ad-hoc
> solution.
>
> Why is that an ad-hoc solution, and solution to what?

To specifying operations. Methods are also ad-hoc. We really have to get away from this Turing concept that everything is a mini-machine. We have to stop telling the machine what to do and instead specify what operations need be done (and their dependencies) and let the machine figure out what resources it has available to accomplish theses tasks in the best way and order it sees fit.

Alex Stojan

Posts: 95
Nickname: alexstojan
Registered: Jun, 2005

Re: Authors and Computer Scientists Scared of Definitions? Posted: Sep 9, 2006 11:12 PM
Reply to this message Reply
> We have to stop telling the
> machine what to do and instead specify what operations
> need be done (and their dependencies) and let the machine
> figure out what resources it has available to accomplish
> theses tasks in the best way and order it sees fit.

So you basically want the machine to understand the problem you're trying to solve? Let's take a simple example: I want to sort a sequence of numbers. Now I can go ahead and describe to the machine that the new sequence should satisfy the relation I1 < I2 < I3 < ... < In (for all the numbers in the sequence). Would the machine be able to find the best sorting algorithm for this, preferrably the one that isn't O(n^2)?

Alex Stojan

Posts: 95
Nickname: alexstojan
Registered: Jun, 2005

Re: Authors and Computer Scientists Scared of Definitions? Posted: Sep 9, 2006 11:19 PM
Reply to this message Reply
(Minor correction, I meant I1 <= I2 <= I3 <= ... <= In.)

robert young

Posts: 361
Nickname: funbunny
Registered: Sep, 2003

Re: Authors and Computer Scientists Scared of Definitions? Posted: Sep 10, 2006 12:21 AM
Reply to this message Reply
> > We have to stop telling the
> > machine what to do and instead specify what operations
> > need be done (and their dependencies) and let the
> machine
> > figure out what resources it has available to
> accomplish
> > theses tasks in the best way and order it sees fit.
>
> So you basically want the machine to understand the
> problem you're trying to solve? Let's take a simple
> example: I want to sort a sequence of numbers. Now I can
> go ahead and describe to the machine that the new sequence
> should satisfy the relation I1 < I2 < I3 < ... < In (for
> all the numbers in the sequence). Would the machine be
> able to find the best sorting algorithm for this,
> preferrably the one that isn't O(n^2)?

the answers: Prolog, and no

Alex Stojan

Posts: 95
Nickname: alexstojan
Registered: Jun, 2005

Re: Authors and Computer Scientists Scared of Definitions? Posted: Sep 10, 2006 12:31 AM
Reply to this message Reply
> the answers: Prolog, and no

Prolog can only do a tree search based on the rules and facts provided by the programmer, it cannot come up with its own rules based on some knowledge or understanding of the problem. The only difference here from "conventional" programming is that the mechanics of the search is predefined in the language itself. You can easily achieve the same thing in LISP (or any other language), but in the end everything is up to the programmer (either the one who invented/implemented Prolog or the one who uses it).

Mumtaz Shah

Posts: 10
Nickname: mumtaz
Registered: Feb, 2006

Re: Authors and Computer Scientists Scared of Definitions? Posted: Sep 10, 2006 6:03 AM
Reply to this message Reply
To me, Godel's theorem of incompleteness is the root cause of errorism !

Terje Slettebø

Posts: 205
Nickname: tslettebo
Registered: Jun, 2004

Re: Authors and Computer Scientists Scared of Definitions? Posted: Sep 10, 2006 6:49 AM
Reply to this message Reply
> > Above, you said: "I mean how the data in question is to
> > be
> > used along with what operations are valid on it."
> >
> > "int" is a representation of integral numbers. The
> > operations on it loosely matches those you may do in
> > mathematics on integral numbers.
> >
> > I think describes it as a type, just fine: It's a type
> > that may be used to model integral numbers.
>
> Yeah, but using integral numbers for their sake alone is
> very seldom done unless you're into number theory. Every
> time I use a number, it's meant for a specific purpose,
> yet I know of no one that would define another type just
> to qualify its use. The reason for this is simple. It
> adds nothing to the execution and take extra time to write
> out, not to mention that many languages don't have
> facilities for this or at least don't define a standard
> way to do this.

Well, it adds intention and type checking to the code, and is in particular useful for entities that in itself are insufficiently represented by an int (such as your example "distance", which is meaningless without a unit, such as "meters"), and failure to account for this can lead to tremendously expensive bugs, such as the $125 million loss of the Mars Orbiter... (http://www.cnn.com/TECH/space/9909/30/mars.metric/)

As for people often not doing this (using specific types for concepts): Unfortunately, no...

> > > Is it a distance, pixels, socket number, etc?
> >
> > Those are different concepts, and typically better
> > modelled by separate types.
>
> Like I said, who actually does that? And no, they are not
> different concepts. They are still numbers. They just
> have additional interpretations.

I think we should make a distinction between the concepts and their representation. "distance" may be _represented_ by an int, or preferably by a type incorporating both numerical value and unit. However, I'd still argue that "1 meter" is a different concept than, say "1 pixel". Yes, they both use "1", but that's about it. :)

> > > If that were also defined, then it'd
> > > be more of a true type, IMNSHO. Classes don't
> qualify
> > > because the members don't tell anything to the
> > compiler.
> >
> > Huh? Classes tell the compiler what operations may be
> > possible on them, and their results, if any. In other
> > words, how values of a given class may be used.
>
> No they don't. Add a member to a class and the compiler
> can't infer anything from that member. All it knows is
> that there's an extra value there. Classes don't tell
> what operations are possible on them, their methods do. I
> find this to be a half solution too. Double dispatch for
> example.

We may be talking on cross purposes, here: When I talk about "classes", I include of course its member variables and functions/methods, which means that "classes" (or more accurately, the compiler) indeed "knows" what possible operations can be done on instances of this class, the types of any parameters, and their return value types (in a statically typed language).

As for double dispatch: Yes, it's a shame that's not available in more of the mainstream languages. There's a proposal for it for e.g. C++, but with all the committee has on its plate (in particular support for "concepts"), it's unfortunately not much of a chance of it making it into the next C++ standard...

> > > You can overload operators, but it's an ad-hoc
> > solution.
> >
> > Why is that an ad-hoc solution, and solution to what?
>
> To specifying operations. Methods are also ad-hoc. We
> really have to get away from this Turing concept that
> everything is a mini-machine. We have to stop telling the
> machine what to do and instead specify what operations
> need be done (and their dependencies) and let the machine
> figure out what resources it has available to accomplish
> theses tasks in the best way and order it sees fit.

I have a little difficulty following you, here. Could you perhaps give a concrete example (both showing things as done today, and how you think it could improved)? You may have a good point, I just have a problem seeing it.

Terje Slettebø

Posts: 205
Nickname: tslettebo
Registered: Jun, 2004

Re: Authors and Computer Scientists Scared of Definitions? Posted: Sep 10, 2006 6:51 AM
Reply to this message Reply
> To me, Godel's theorem of incompleteness is the root cause
> of errorism !

Could you elaborate on why you think so?

Mumtaz Shah

Posts: 10
Nickname: mumtaz
Registered: Feb, 2006

Re: Authors and Computer Scientists Scared of Definitions? Posted: Sep 10, 2006 8:38 AM
Reply to this message Reply
No.

Mumtaz Shah

Posts: 10
Nickname: mumtaz
Registered: Feb, 2006

Re: Authors and Computer Scientists Scared of Definitions? Posted: Sep 10, 2006 8:45 AM
Reply to this message Reply
> > To me, Godel's theorem of incompleteness is the root
> cause
> > of errorism !
>
> Could you elaborate on why you think so?


No.

Eivind Eklund

Posts: 49
Nickname: eeklund2
Registered: Jan, 2006

Re: Authors and Computer Scientists Scared of Definitions? Posted: Sep 11, 2006 5:08 AM
Reply to this message Reply
> I firmly believe that if a programmer is using an integer to
> represent a measurement, or an identifier, then they should
> define a new type.

I firmly believe that most of the time, the cost of the type declarations (in terms of programmer attention) is not worth it. The benefits are too small compared to the cost in text size (ie, distractions).

I also believe that most mainstream languages make it a hassle to define integer types that handle units properly, and that these particular declarations thus are even more disruptive than most type declarations.

Of course, if you're programming in a language where this is made easy, like Ada, go for it. But DO evaluate it in terms of cost/benefit, not just "should".

James Watson

Posts: 2024
Nickname: watson
Registered: Sep, 2005

Re: Authors and Computer Scientists Scared of Definitions? Posted: Sep 11, 2006 9:06 AM
Reply to this message Reply
> Maybe I misunderstood you. You seemed to implicitly say
> that there may be properties of a program, that may not
> (at least easily) be considered related to type. I
> mentioned that your example, halting, may be determined by
> a type system.
>
> If not this, what then was your point?

Sorry, I didn't follow. I thought you were just explaining the halting problem.

I'm struggling to understand how what you suggest would be so but I haven't finished my coffee yet.

Assuming this is true, is saying that it could be determined by a type system the same as saying that halting is a type?

I can come up with some other possible 'properties' of a program: correct, efficient, backwards-compatible, multi-platform, beta, production-ready, state-of-the-art, exciting, boring, annoying... I think it's pretty clear that without defining property in this context, that definition cannot be correct.

Even without going out into absurditities and assuming a intuitive definition of property, it's not clear to me that this definition is useful or that it's correct.

Michael Feathers

Posts: 448
Nickname: mfeathers
Registered: Jul, 2003

Re: Authors and Computer Scientists Scared of Definitions? Posted: Sep 11, 2006 9:58 AM
Reply to this message Reply
If you had a definition for 'type' how would you act differently?

James Watson

Posts: 2024
Nickname: watson
Registered: Sep, 2005

Re: Authors and Computer Scientists Scared of Definitions? Posted: Sep 11, 2006 10:31 AM
Reply to this message Reply
> If you had a definition for 'type' how would you act
> differently?

When he communicates with other computer scientists, he uses the accepted definition and assumes they are also using that definition. This facilitates understanding. I'm not sure why this desire is considered questionable by so many. Physicists and other scientists would never consider using terms that are not clearly defined in technical discussions or documents. Pretty much the first topic in any introductory Physics course is the exact definition of 'mass' and the distinction between mass and weight.

Flat View: This topic has 53 replies on 4 pages [ « | 1  2  3  4 | » ]
Topic: Authors and Computer Scientists Scared of Definitions? Previous Topic   Next Topic Topic: Offensive Coding


Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2014 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us