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


Groups > comp.lang.java.programmer > #30687

Re: Which data structure would you recommend?

From Martin Gregorie <martin@address-in-sig.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: Which data structure would you recommend?
Date 2015-01-12 14:35 +0000
Organization A noiseless patient Spider
Message-ID <m90m40$2lh$1@dont-email.me> (permalink)
References (1 earlier) <tree-20150108234524@ram.dialup.fu-berlin.de> <54b0001d$0$2902$e4fe514c@news.xs4all.nl> <m8uhee$fi6$1@news.m-online.net> <m8uvgl$ksb$1@dont-email.me> <54b3902d$0$2974$e4fe514c@news.xs4all.nl>

Show all headers | View raw


On Mon, 12 Jan 2015 10:13:17 +0100, Silvio wrote:

> On 01/12/2015 12:03 AM, Martin Gregorie wrote:
>> On Sun, 11 Jan 2015 20:03:42 +0100, Magnus Warker wrote:
>>
>>> On 01/09/2015 05:21 PM, Silvio wrote:
>>>
>>>> I hate the idea that something is OOP or not or that OOP defines the
>>>> one and only way a thing can/should look. OOP does NOT mean anything
>>>> on its own and at the same time means many different things in the
>>>> minds of different people.
>>>
>>> I strongly agree!
>>>
>>> Your words remind me of a time, when some people thought, their C code
>>> would be OOP when saved in files ending with "cpp". :-)
>>>
>> And there's still a huge amount of 'C++' code around that is in reality
>> little more than ANSI C with // comments, a .cpp extension and nary a
>> class declaration to be seen. Quite depressing, really, if its a valid
>> indication of the state of the programming art.
>>
>>
>>
> True, I have come across such code bases as well and it has not always
> been pleasant.
> 
> On the other hand I have come across lots of programs that where written
> in very strict OOP patterns that where absolute abominations as well.
> And some of the most brilliant and ingeniously written programs I have
> ever encountered where written in procedural C (and done in a very
> structured and consistent way).
> 
> My point is that the level of OOP-ness (which is a subjective score on
> its own) does not equal the quality of a program. Doing everything the
> "proper" OOP way, putting in the right tests, etc. is easy. Writing good
> programs is an art.

Good points and well made. 

Depending on what the program's purpose is, I agree that a well 
structured and commented ANSI C program can sometimes be easier to 
understand than its OO equivalent. 

IME the one place where OO provides a clear win over well-structured non-
OO programming is in code re-usability. 

Its generally easier to write a re-usable set of classes, and often 
easier to enhance/extend them too, than it is to do the same job in 
vanilla C or equivalent languages. 

I, anyway, tend to end up writing C library code in a semi-OO way. I put 
instance-related variables in typedefed structs (think FILE in standard 
C) that are created and destroyed with malloc/free. Global variables are 
accessable only from within the source module that contains them and all 
all the functions that provide the set of closely related actions. 

FWIW I was using this style, self-taught, before my first brush with 
either C++ or Java, but both Wirth's "Algorithms + Data Structures = 
Programs" and Kernighan & Plauger's "Software Tools In Pascal" were very 
influential in developing my personal programming style.


-- 
martin@   | Martin Gregorie
gregorie. | Essex, UK
org       |

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Which data structure would you recommend? Doug Mika <dougmmika@gmail.com> - 2015-01-08 14:25 -0800
  Re: Which data structure would you recommend? Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-01-08 17:51 -0500
  Re: Which data structure would you recommend? Silvio <silvio@internet.com> - 2015-01-09 17:21 +0100
    Re: Which data structure would you recommend? Magnus Warker <magnux@mailinator.com> - 2015-01-11 20:03 +0100
      Re: Which data structure would you recommend? Martin Gregorie <martin@address-in-sig.invalid> - 2015-01-11 23:03 +0000
        Re: Which data structure would you recommend? Lew <lewbloch@gmail.com> - 2015-01-11 15:17 -0800
          Re: Which data structure would you recommend? Silvio <silvio@internet.com> - 2015-01-12 15:05 +0100
        Re: Which data structure would you recommend? Silvio <silvio@internet.com> - 2015-01-12 10:13 +0100
          Re: Which data structure would you recommend? Martin Gregorie <martin@address-in-sig.invalid> - 2015-01-12 14:35 +0000
        Re: Which data structure would you recommend? Gene Wirchenko <genew@telus.net> - 2015-01-13 10:02 -0800
          Re: Which data structure would you recommend? Arne Vajhøj <arne@vajhoej.dk> - 2015-01-19 20:11 -0500
            Re: Which data structure would you recommend? Gene Wirchenko <genew@telus.net> - 2015-01-20 09:25 -0800
      Re: Which data structure would you recommend? Silvio <silvio@internet.com> - 2015-01-12 08:58 +0100
        Re: Which data structure would you recommend? Silvio <silvio@internet.com> - 2015-01-12 14:54 +0100
  Re: Which data structure would you recommend? Jeff Higgins <jeff@invalid.invalid> - 2015-01-09 18:36 -0500
    Re: Which data structure would you recommend? Jeff Higgins <jeff@invalid.invalid> - 2015-01-09 19:54 -0500
  Which data structure would you recommend? ynseo <yeori.seo@gmail.com> - 2015-01-12 04:52 -0800

csiph-web