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


Groups > comp.programming > #3384 > unrolled thread

Object oriented programming?

Started byroot <NoEMail@home.org>
First post2013-05-29 14:25 +0000
Last post2013-06-03 11:06 -0700
Articles 4 on this page of 24 — 13 participants

Back to article view | Back to comp.programming


Contents

  Object oriented programming? root <NoEMail@home.org> - 2013-05-29 14:25 +0000
    Re: Object oriented programming? Melzzzzz <mel@zzzzz.com> - 2013-05-29 18:19 +0200
      Re: Object oriented programming? root <NoEMail@home.org> - 2013-05-30 13:51 +0000
        Re: Object oriented programming? Melzzzzz <mel@zzzzz.com> - 2013-05-30 19:48 +0200
    Re: Object oriented programming? Patricia Shanahan <pats@acm.org> - 2013-05-29 09:21 -0700
      Re: Object oriented programming? root <NoEMail@home.org> - 2013-05-30 13:56 +0000
    Re: Object oriented programming? James Harris <james.harris.1@gmail.com> - 2013-05-29 13:05 -0700
      Re: Object oriented programming? root <NoEMail@home.org> - 2013-05-30 14:07 +0000
        Re: Object oriented programming? "osmium" <r124c4u102@comcast.net> - 2013-05-30 10:49 -0500
        Re: Object oriented programming? James Harris <james.harris.1@gmail.com> - 2013-06-01 12:18 -0700
    Re: Object oriented programming? Kicer <a@b.c> - 2013-05-29 22:13 +0200
      Re: Object oriented programming? root <NoEMail@home.org> - 2013-05-30 14:22 +0000
        Re: Object oriented programming? Kicer <a@b.c> - 2013-06-01 02:54 +0200
          Re: Object oriented programming? Patricia Shanahan <pats@acm.org> - 2013-06-01 07:43 -0700
            Re: Object oriented programming? Kicer <a@b.c> - 2013-06-05 18:16 +0200
    Re: Object oriented programming? rugxulo@gmail.com - 2013-05-30 22:22 -0700
      Re: Object oriented programming? root <NoEMail@home.org> - 2013-05-31 14:05 +0000
        Re: Object oriented programming? "Charles Hottel" <chottel@earthlink.net> - 2013-05-31 12:12 -0400
          Re: Object oriented programming? root <NoEMail@home.org> - 2013-05-31 20:31 +0000
            Re: Object oriented programming? "BartC" <bc@freeuk.com> - 2013-06-01 00:59 +0100
    Re: Object oriented programming? Willem <willem@turtle.stack.nl> - 2013-06-01 07:54 +0000
      Re: Object oriented programming? Jongware <jongware@no-spam.plz> - 2013-06-07 11:05 +0200
    Re: Object oriented programming? Paul N <gw7rib@aol.com> - 2013-06-02 13:11 -0700
      Re: Object oriented programming? Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2013-06-03 11:06 -0700

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


#3405

FromWillem <willem@turtle.stack.nl>
Date2013-06-01 07:54 +0000
Message-ID<slrnkqja6d.30p2.willem@turtle.stack.nl>
In reply to#3384
root wrote:
) My programming experience began before the advent of Object Oriented
) Programming so the concepts are vague to me. It would help if
) someone could sketch out how OOP would enter into some of tasks
) I have done.

In my personal experience with OO programming, 90% of the time, in
application programming, you just *use* the objects that exist in the
framework (or in additional libraries you need for the app) and only 10% of
the time, you have to create your own objects.  And in only 10% of those
cases where you create objects, it's beneficial to use OOP stuff like
inheritance.

Now, in C# there is the concept of extension methods, which means you don't
have to inherit classes if you want to add one or two helper functions to
them.

I've seen business applications that were modeled from an OOP standpoint,
with inheritance and the whole shebang, and they were a nightmare.

So, my advice is: First start to learn by *using* objects.  Then you
gradually see how the objects in the framework work together, and then
at some later point you will probably realise that there are some things
in your own app that could benefit from OOP thinking.


SaSW, Willem
-- 
Disclaimer: I am in no way responsible for any of the statements
            made in the above text. For all I know I might be
            drugged or something..
            No I'm not paranoid. You all think I'm paranoid, don't you !
#EOT

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


#3417

FromJongware <jongware@no-spam.plz>
Date2013-06-07 11:05 +0200
Message-ID<51b1a24e$0$15877$e4fe514c@news2.news.xs4all.nl>
In reply to#3405
On 01-Jun-13 9:54 AM, Willem wrote:
> root wrote:
> ) My programming experience began before the advent of Object Oriented
> ) Programming so the concepts are vague to me. It would help if
> ) someone could sketch out how OOP would enter into some of tasks
> ) I have done.
>
> In my personal experience with OO programming, 90% of the time, in
> application programming, you just *use* the objects that exist in the
> framework (or in additional libraries you need for the app) and only 10% of
> the time, you have to create your own objects.  And in only 10% of those
> cases where you create objects, it's beneficial to use OOP stuff like
> inheritance.

So the OP's design

 > [...] my own text editor, the general structure is:
 >
 > Initialize stuff
 > read in any starting text
 >
 > while(1)
 > 	display text
 > 	accept user command
 > 	process user command
 >
 > If one were to use OOP concepts and start writing a new text
 > editor, how would objects change this picture?

would be re-written as

stuff.initialize
text.readin

while (1)
      text.display
      usercommand.accept
      usercommand.process

Correct?

[Jw]

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


#3409

FromPaul N <gw7rib@aol.com>
Date2013-06-02 13:11 -0700
Message-ID<bfd5b1e4-31d5-4673-8058-38ba3fec9817@k3g2000vbn.googlegroups.com>
In reply to#3384
On May 29, 3:25 pm, root <NoEM...@home.org> wrote:
> My programming experience began before the advent of Object Oriented
> Programming so the concepts are vague to me. It would help if
> someone could sketch out how OOP would enter into some of tasks
> I have done.

The examples you've given don't really lend themselves to OOP in my
humble opinion, but I couldn't think of any better examples.

However, an example of a useful object did occur to me. Dates. Suppose
you are writing a program that involves dates in some way. One
function could pass a date to another simply as a set of three
numbers. But if you create a Date class, it means you can pass a date
as a single value. Plus you can include routines within the object for
checking whether the three values do indeed form a valid date or not.
And if you wanted to get fancy, you could use operator overloading to
add a number to a date to get x days later than it, or subtract two
dates to get the number of days between them.Once you've written this
stuff, the code which uses the dates will (hopefully!) be much
clearer. And if you want to introduce a new date format, you only need
to write it in one place.

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


#3410

FromDaniel Pitts <newsgroup.nospam@virtualinfinity.net>
Date2013-06-03 11:06 -0700
Message-ID<xW4rt.49439$cs.48412@newsfe03.iad>
In reply to#3409
On 6/2/13 1:11 PM, Paul N wrote:
> On May 29, 3:25 pm, root <NoEM...@home.org> wrote:
>> My programming experience began before the advent of Object Oriented
>> Programming so the concepts are vague to me. It would help if
>> someone could sketch out how OOP would enter into some of tasks
>> I have done.
>
> The examples you've given don't really lend themselves to OOP in my
> humble opinion, but I couldn't think of any better examples.
>
> However, an example of a useful object did occur to me. Dates. Suppose
> you are writing a program that involves dates in some way. One
> function could pass a date to another simply as a set of three
> numbers. But if you create a Date class, it means you can pass a date
> as a single value. Plus you can include routines within the object for
> checking whether the three values do indeed form a valid date or not.
> And if you wanted to get fancy, you could use operator overloading to
> add a number to a date to get x days later than it, or subtract two
> dates to get the number of days between them.Once you've written this
> stuff, the code which uses the dates will (hopefully!) be much
> clearer. And if you want to introduce a new date format, you only need
> to write it in one place.
>

A Date class isn't a bad idea for an abstraction, but it is an 
unfortunate idea for a teaching exercise.  The generic concept of a date 
is an extremely irregular concept, as evidenced by the JDK having 
multiple flawed ways to interact with Dates.

Many implementations store dates as time-units-since-absolute-epoch. 
Even this implementation is somewhat flawed, though easier to work with 
than using 3 numbers.

<rant>
Another thing that has always bothered me is the lack of distinction 
between absolute units and relative units.  Angles for example. You can 
perform multiplication and addition of Relative Angles, but for absolute 
angles, these are nonsensical operations. If you don't believe me, than 
what is the double of "North"? or "North plus East".  If you just use 
the numeric representation of those direction, then you've unwittingly 
tied yourself to an orientation.
</rant>

[toc] | [prev] | [standalone]


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

Back to top | Article view | comp.programming


csiph-web