Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #53149 > unrolled thread

Object-Oriented Programming is Bad

Started byJulian Fondren <julian.fondren@gmail.com>
First post2016-12-07 03:23 -0800
Last post2016-12-21 23:00 -0800
Articles 6 on this page of 26 — 14 participants

Back to article view | Back to comp.lang.forth


Contents

  Object-Oriented Programming is Bad Julian Fondren <julian.fondren@gmail.com> - 2016-12-07 03:23 -0800
    Re: Object-Oriented Programming is Bad Mark Wills <markwills1970@gmail.com> - 2016-12-07 09:06 -0800
      Re: Object-Oriented Programming is Bad "HAA" <someone@microsoft.com> - 2016-12-09 11:03 +1100
        Re: Object-Oriented Programming is Bad Alex <alex@rivadpm.com> - 2016-12-09 00:17 +0000
          Re: Object-Oriented Programming is Bad "HAA" <someone@microsoft.com> - 2016-12-10 10:14 +1100
            Re: Object-Oriented Programming is Bad hughaguilar96@gmail.com - 2016-12-09 19:54 -0800
              Re: Object-Oriented Programming is Bad "Robert L." <No_spamming@noWhere_7073.org> - 2016-12-10 06:44 +0000
                Re: Object-Oriented Programming is Bad Julian Fondren <julian.fondren@gmail.com> - 2016-12-10 00:37 -0800
                Re: Object-Oriented Programming is Bad polymorph self <jackvanc3@gmail.com> - 2016-12-11 06:39 -0800
            Re: Object-Oriented Programming is Bad Andrew Haley <andrew29@littlepinkcloud.invalid> - 2016-12-10 03:38 -0600
              Re: Object-Oriented Programming is Bad november.nihal@gmail.com - 2016-12-11 08:57 -0800
                Re: Object-Oriented Programming is Bad hughaguilar96@gmail.com - 2016-12-11 10:19 -0800
                Re: Object-Oriented Programming is Bad Paul Rubin <no.email@nospam.invalid> - 2016-12-11 13:25 -0800
                  Re: Object-Oriented Programming is Bad hughaguilar96@gmail.com - 2016-12-11 17:39 -0800
                  Re: Object-Oriented Programming is Bad november.nihal@gmail.com - 2016-12-11 17:49 -0800
                    Re: Object-Oriented Programming is Bad hughaguilar96@gmail.com - 2016-12-11 20:31 -0800
                      Re: Object-Oriented Programming is Bad november.nihal@gmail.com - 2016-12-12 07:01 -0800
                    Re: Object-Oriented Programming is Bad Paul Rubin <no.email@nospam.invalid> - 2016-12-11 21:50 -0800
      Re: Object-Oriented Programming is Bad polymorph self <jackvanc3@gmail.com> - 2016-12-11 06:20 -0800
    Re: Object-Oriented Programming is Bad Paul Rubin <no.email@nospam.invalid> - 2016-12-07 09:26 -0800
    Re: Object-Oriented Programming is Bad Andrew Haley <andrew29@littlepinkcloud.invalid> - 2016-12-07 11:44 -0600
      Re: Object-Oriented Programming is Bad anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-12-08 09:58 +0000
        Re: Object-Oriented Programming is Bad Bernd Paysan <bernd@net2o.de> - 2016-12-21 21:18 +0000
          Re: Object-Oriented Programming is Bad gavinschuette@gmail.com - 2016-12-21 23:00 -0800
    Re: Object-Oriented Programming is Bad franck.bensusan@gmail.com - 2016-12-21 09:41 -0800
    Re: Object-Oriented Programming is Bad gavinschuette@gmail.com - 2016-12-21 23:00 -0800

Page 2 of 2 — ← Prev page 1 [2]


#53165

FromAndrew Haley <andrew29@littlepinkcloud.invalid>
Date2016-12-07 11:44 -0600
Message-ID<tZKdnYcLYucW19XFnZ2dnUU7-UfNnZ2d@supernews.com>
In reply to#53149
Julian Fondren <julian.fondren@gmail.com> wrote:
> Youtube vid: https://www.youtube.com/watch?v=QM1iUe6IofM
> 
> Probably not that interesting for us, but I did note that the feature
> he wants at the end, which he doesn't think any existing language has,
> is actually what quotations are. Non-Hugh quotations: he explicitly
> doesn't want any of the outer function's environment to seep through
> into the inner function, except by argument passing.

Indeed.

It's not a terrible talk, but it does have a rather flamebaity title,
and he doesn't get to the meat until about 19:00.

Some things are clear, e.g. don't export state by reference from
inside an object.  But we already knew that shared mutable state is at
the very least a Bad Thing to be avoided where possible, and that
immutability should be the default.

Some things are just not modelled well as objects: for a silly
example, Java has a function which calculates sin x, and because
everything is a method you have to write Math.sin(x), which makes no
sense at all.  You could implement sin x as passing a message to a
number x which calculates its own sine, but that means that a number
has to know how to calculate every possible mathematical function.
No, from a code organization point of view this is a terrible idea: it
makes much more sense to have a library of trig functions.

But the suggestion that you solve the problem of poor isolation by not
having any isolation is an overreach.

Perhaps he's really arguing against OO as a religion rather than a
technique; but this is c.l.f, and Forth doesn't do purity, so we have
no problem with that.

Object-orientation is essentially two things: strong encapsulation of
state and late binding. [1]  These things are sometimes useful, and can
make programs easier to write and maintain.  But not every little bit
of code needs to be bound to some data, and some code doesn't need
late binding.

Andrew.


[1] "OOP to me means only messaging, local retention and protection
and hiding of state-process, and extreme late-binding of all things."

Alan Kay, http://userpage.fu-berlin.de/~ram/pub/pub_jf47ht81Ht/doc_kay_oop_en

[toc] | [prev] | [next] | [standalone]


#53194

Fromanton@mips.complang.tuwien.ac.at (Anton Ertl)
Date2016-12-08 09:58 +0000
Message-ID<2016Dec8.105831@mips.complang.tuwien.ac.at>
In reply to#53165
Andrew Haley <andrew29@littlepinkcloud.invalid> writes:
>Some things are just not modelled well as objects: for a silly
>example, Java has a function which calculates sin x, and because
>everything is a method you have to write Math.sin(x), which makes no
>sense at all.

This has nothing to do with objects, though, but something with how
Java resolves scoping.  See how we can have "sin" without any
qualifier in the main method below:

public class Aufgabe1{
    public static double sin(double x) {
        return Math.sin(x);
    }
    public static void main(String[] args) {
        System.out.println(sin(1.));
     }
}

It's unclear to me why "import java.lang.Math" does not allow me to
refer to Math.sin with sin, though.

>You could implement sin x as passing a message to a
>number x which calculates its own sine, but that means that a number
>has to know how to calculate every possible mathematical function.
>No, from a code organization point of view this is a terrible idea: it
>makes much more sense to have a library of trig functions.

Sorry, I don't see any difference in code organization from that.  Now
you have a Math class that contains all this stuff, and if you made
them methods of the Double class, the organization would not change
much.

A bigger issue for Java is probably the support for overloading and
automatic conversion, and the lack of support for
method-not-understood.  To get the same functionailty, you would have
to add sin (and every other such function) to java.lang.Number, too,
with an implementation like:

Double sin() {
  return doubleValue().sin();
}

With a method-not-understood mechanism, all of these definitions in
Number could be subsumed by one:

Double notUnderstood(Method m) {
  return doubleValue().m()
}

(or maybe a bunch for different arities).

Anyway, yes, if you only support sin for doubles, as in Java, objects
don't buy anything.

- anton
-- 
M. Anton Ertl  http://www.complang.tuwien.ac.at/anton/home.html
comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
     New standard: http://www.forth200x.org/forth200x.html
   EuroForth 2016: http://www.euroforth.org/ef16/

[toc] | [prev] | [next] | [standalone]


#53475

FromBernd Paysan <bernd@net2o.de>
Date2016-12-21 21:18 +0000
Message-ID<o3erk0$507$1@dont-email.me>
In reply to#53194
Am Thu, 08 Dec 2016 09:58:31 +0000 schrieb Anton Ertl:

> It's unclear to me why "import java.lang.Math" does not allow me to
> refer to Math.sin with sin, though.

IIRC, if your class extends Math, it would work without explicit scope.  
However, you can't do that here, as Math is final.  At least in the Java 
world, no progress on Math is expected.

-- 
Bernd Paysan
"If you want it done right, you have to do it yourself"
net2o ID: kQusJzA;7*?t=uy@X}1GWr!+0qqp_Cn176t4(dQ*
http://bernd-paysan.de/

[toc] | [prev] | [next] | [standalone]


#53483

Fromgavinschuette@gmail.com
Date2016-12-21 23:00 -0800
Message-ID<e48b8bf8-2139-4c1e-b058-ff5ba40faee9@googlegroups.com>
In reply to#53475
On Wednesday, December 21, 2016 at 4:20:25 PM UTC-5, Bernd Paysan wrote:
> Am Thu, 08 Dec 2016 09:58:31 +0000 schrieb Anton Ertl:
> 
> > It's unclear to me why "import java.lang.Math" does not allow me to
> > refer to Math.sin with sin, though.
> 
> IIRC, if your class extends Math, it would work without explicit scope.  
> However, you can't do that here, as Math is final.  At least in the Java 
> world, no progress on Math is expected.
> 
> -- 
> Bernd Paysan
> "If you want it done right, you have to do it yourself"
> net2o ID: kQusJzA;7*?t=uy@X}1GWr!+0qqp_Cn176t4(dQ*
> http://bernd-paysan.de/

Bernd how is everything going?
How would you compare your web server with facter furnace?
http://concatenative.org/wiki/view/Factor/Furnace

[toc] | [prev] | [next] | [standalone]


#53467

Fromfranck.bensusan@gmail.com
Date2016-12-21 09:41 -0800
Message-ID<58ce6a80-4f5e-45f1-9879-199ae4806c3f@googlegroups.com>
In reply to#53149
Le mercredi 7 décembre 2016 12:23:21 UTC+1, Julian Fondren a écrit :
> Youtube vid: https://www.youtube.com/watch?v=QM1iUe6IofM
> 
> Probably not that interesting for us, but I did note that the feature
> he wants at the end, which he doesn't think any existing language has,
> is actually what quotations are. Non-Hugh quotations: he explicitly
> doesn't want any of the outer function's environment to seep through
> into the inner function, except by argument passing.
> 
> 
> -- Julian

Basically, this video says that OOP with mutable objects is inconsistent
because this kills encapsulation.

This is a good point and I agree with that : one has to be very
carefull with mutable objects encapsulated into other objects.

But the conclusion is that OOP is bad ?! (and to ... not factorize).
The conclusion is just that OOP + mutability is tricky.

With an OOP system + immutability, encapsulation is guarantee (Oforth is such
a system).

Franck

[toc] | [prev] | [next] | [standalone]


#53484

Fromgavinschuette@gmail.com
Date2016-12-21 23:00 -0800
Message-ID<523fae87-11cb-4d48-b8c1-eb93997b8c47@googlegroups.com>
In reply to#53149
On Wednesday, December 7, 2016 at 6:23:21 AM UTC-5, Julian Fondren wrote:
> Youtube vid: https://www.youtube.com/watch?v=QM1iUe6IofM
> 
> Probably not that interesting for us, but I did note that the feature
> he wants at the end, which he doesn't think any existing language has,
> is actually what quotations are. Non-Hugh quotations: he explicitly
> doesn't want any of the outer function's environment to seep through
> into the inner function, except by argument passing.
> 
> 
> -- Julian

Why did Djikstra say 
“Object-oriented programming is an exceptionally bad idea which could only have originated in California.” – Edsger Dijkstra

[toc] | [prev] | [standalone]


Page 2 of 2 — ← Prev page 1 [2]

Back to top | Article view | comp.lang.forth


csiph-web