Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.programming > #3403
| From | "BartC" <bc@freeuk.com> |
|---|---|
| Newsgroups | comp.programming |
| References | <ko5341$heu$1@news.albasani.net> <f944fd26-df63-4dc1-ba36-7af2b8062015@googlegroups.com> <koaao7$iec$2@news.albasani.net> <ReOdnVRP6v1lVjXMnZ2dnUVZ_gWdnZ2d@earthlink.com> <kob1bq$2a5$2@news.albasani.net> |
| Subject | Re: Object oriented programming? |
| Message-ID | <3Raqt.14661$2x3.1243@fx01.am4> (permalink) |
| Organization | virginmedia.com |
| Date | 2013-06-01 00:59 +0100 |
"root" <NoEMail@home.org> wrote in message news:kob1bq$2a5$2@news.albasani.net... > I know I can go the rest of my life without OOP. I've managed to avoid using it for quite a few years. When I first looked at it to see what it could do for me, the first examples where what I'd been doing for years with dynamically typed languages anyway! So it didn't buy me too much. > Someone suggested that I try to write a string class. Good suggestion. > Instead, I pulled up the Java string class to see what is what. > Except for the fact that strings are constant, almost all of the > operations on strings correspond to something that a user might > want to do with a text file. It seems that I might start by > defining a TEXT class as a malloced region which will contain Or you could just create a bunch of functions to work on strings; you don't need a class. OO provides neat ways of encapsulating those functions, but that's about it I think. I've just finished a new text editor actually. It doesn't use OO, but does use a dynamic language (which makes it easy to work with strings); the latter I consider more important. And perhaps my editor is a little primitive but it doesn't need to do tons of string processing anyway: the main data structure describing the edit text is a struct, of which only one element, out of about twenty, is the actual text. (If I did use OO, this text descriptor, describing the editor state, would probably be a separate class. The text itself is just a list of strings; the language would likely already have means for handling lists, and strings, so you don't need anything new.) > characters. There are some operations on TEXT that are not > included in the STRING class, most important of which are > that the primary object can be changed. This comes up with other types of a data: whether an operation will return a modified version of it's operand (leaving the original unchanged); or whether it will do an in-place modification. Sometimes I just allow both kinds (for example, sort() to return a new object, isort() to modify one.) -- Bartc
Back to comp.programming | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
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
csiph-web