🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: aus.computers.java
Article #814

Re: Anyone here into Data Structures? :)

#814
From: Tim Cross
Date: Sun, 30 Apr 2000 00:00
92 lines
5259 bytes
Although I agree that Java provides many useful data structures, I
think its important to stress the danger inherent in just using the
provided data structures because its easy rather than defining them
yourself. After many years of programming and having worked on both my
own projects and taken over projects started by others, I can honestly
say I'd rather take on a project with good data structures and bad
code rather than one with bad data structures and good code. 

Something I've noticed with some java I've seen is that often a 
particular data structure has been chosen because it was provided by
the system and the problem has been twisted to fit with the data
structure rather than the data structure being designed to fit with
the problem. This tends to make the problem domain more difficult to
work with (its not as clear, simple tasks become more complex etc).

To a large extent the data structure used is a reflection of how well
the problem domain is understood. Therefore, I find its much better to
start by looking at the problem, identifying the most appropriate data
structure and then seeing if the data structures provided with the
language (e.g. the collections api etc) provide what you need or can
be used to construct what you need. If so, then thats good. If not,
then you need to define whatever structures you need yourself. Too
often, I've seen solutions to problems where the developer has worked
from the other direction - looked at what data structues are available
and then tried to fit the problem to use those structures. I think
this tends to result in a poorer less flexible solution which is often
difficult to extend and maintain. 

If you need to learn about data structures I would recommend checking
out some of the fine books available on the subject (good authors to
look at are Wirth, Sedgwick, Korsh and Knuth). The languages used to
demonstrate the data structures are not that relevant compared to
understanding the properties of different structures, though a book
using an object oriented approach is probably best if your main
language is Java. I would also look at the source code to the
colections API (and other APIs) to get a feeling for how different
basic data structures like trees, arrays, lists etc are implemented in
java. 

I think a good approach is to read about a particular data structure
at an abstract level, then implement it yourself and write a small
program to use your data structure. Then look at how someone else has
implemented it, re-write your test program to use their implementation
and then look at how the two compare and evaluate the advantages and
disadvantages of them both. this will help give you a deep
understanding of the different types of basic data structures which
will in turn help you learn how to select the best data structure for
your problem. While doing this, you can utilize groups like this more
successfully because you will be able to ask concrete questions such
as "Why doesn't this work" or "How can I do this more efficiently"
etc.  

Tim
"Paul Murray" <pmurray@nospam.bigpond.com> writes:

> "Jman" <j_trak@yahoo.com> wrote in message
> news:8ds8jb$umd$1@nnrp1.deja.com...
> 
> > Data Structures in Java. I'm doing this subject. A lot to learn.
> > Anyone know a lot about it?
> 
> I'm a big fan of data structures. I have several around the house, and a
> couple in the backyard. Waht do you want to know?
> 
> More seriously, I find that the collections API takes care of most common
> programming problems that I used to code up specific structures to do. I no
> longer make up nodes and trees and whatnot, I just stuff Maps inside Maps
> inside Arraylists and so on. More expensive, but so much easier to code and
> no-one expects Java to be fast anyway.
> 
> My exchristian pages http://www.exchristian.org are all generated with the
> collections and XML APIs from the mail I get back from the submission form.
> To make up the indexes (By Date, By Keyword) I stuff keys and references
> into maps and sort then with Collections.sort() . No prob.
> 
> You can get into trees and linked lists and stuff like I had to do when I
> was coding MS C v3.0 for DOS back in 1986, but you don't really need to so
> much these days.
> 
> --------------------------------------------------------------
> http://www.users.bigpond.com/pmurray/index-2.html
> ICQ: 26066755
> 
> 
> 

-- 
Tim Cross
NorthNet Internet Services
mailto:tcross@northnet.com.au
phone:+61 2 6772 5973
Technical Details
Message-ID: <m33do4chc3.fsf@tim.northnet.com.au>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <8ds8jb$umd$1@nnrp1.deja.com> <IU7N4.7995$E4.15872@newsfeeds.bigpond.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10d6db,fee66cfe134b153a
X-Google-Attributes: gid10d6db,public
From: Tim Cross <tcross@northnet.com.au>
Subject: Re: Anyone here into Data Structures? :)
Date: 2000/04/30
Message-ID: <m33do4chc3.fsf@tim.northnet.com.au>
X-Deja-AN: 617395696
Sender: tcross@tim.northnet.com.au
References: <8ds8jb$umd$1@nnrp1.deja.com> <IU7N4.7995$E4.15872@newsfeeds.bigpond.com>
X-Complaints-To: abuse@telstra.net
X-Trace: nsw.nnrp.telstra.net 957070739 203.57.24.28 (Sun, 30 Apr 2000 14:58:59 EST)
Organization: Customer of Telstra Big Pond Direct
NNTP-Posting-Date: Sun, 30 Apr 2000 14:58:59 EST
Newsgroups: aus.computers.java