[Year 12 SofDev] A matter of style - GUI data structures vs primitives
Mark KELLY
kel at mckinnonsc.vic.edu.au
Mon Nov 29 12:29:45 EST 2010
On 29 November 2010 10:54, Steven Bird <sb at csse.unimelb.edu.au> wrote:
> On 29 November 2010 10:38, Mark KELLY <kel at mckinnonsc.vic.edu.au> wrote:
> > Most programming languages now offer GUI data structures like listboxes,
> > grids etc.
> > I'm interested to know how many people use them as their primary data
> > structures ...
>
> Are you talking about how you use the graphical interface of the IDE
> that comes with your favourite programming language, or are you
> talking about the API to the graphics library that comes with the
> language?
>
Yes - the IDE's GUI controls (listboxes, grids, combo boxes etc)
> > What sort of performance penalty does the use of the GUI data structure
> > impose? Do the GUI structure's capabilities (e.g. auto-sorting lists)
> > outweigh the penalty?
> > How efficient is the GUI's inbuilt sorting algorithm compared to a good
> > do-it-yourself sorting algorithm?
>
> A built-in sorting function will usually be close to the optimal O(n
> log n) performance. If you implement your own (by why would you
> these days?) then it might be as bad as O(n^2). However, the
> difference between these is likely to be insignificant for the size of
> data you're talking about. The dominant factor might be that the
> built-in function was compiled, while yours might be interpreted (if
> you're using VB, PHP, Python, etc).
>
Yes, 1000 guys at Microsoft would probably beat me in an algorithm contest.
;-)
But if you have a large array and you need to sort it, you need to sort it.
You either write your own sort routine, or toss the data into a pre-packaged
object and use its methods to do the job for you.
I was more interested in the performance differences between using a listbox
(say) rather than an array.
I'm guessing it's like lazily choosing 'variant' in VB instead of carefully
crafting your variable types and your explicit typecasts.
I sometimes duplicate data in an array (for processing) and a GUI structure
(e.g. a listbox) for display and data entry. Programming (for me at least)
is usually a private, solo activity and there is not a lot of opportunity to
see how other people do things, so I was interested in how other people
choose to use primitive and GUI alternative data structures if both are
available.
Cheers
Mark
>
> -Steven Bird
> http://www.csse.unimelb.edu.au/~sb/<http://www.csse.unimelb.edu.au/%7Esb/>
> _______________________________________________
> http://www.edulists.com.au - FAQ, Subscribe, Unsubscribe
> IT Software Development Mailing List kindly supported by
> http://www.vcaa.vic.edu.au - Victorian Curriculum and Assessment Authority
> and
> http://www.vcaa.vic.edu.au/vce/studies/infotech/softwaredevel3-4.html
> http://www.vitta.org.au - VITTA Victorian Information Technology Teachers
> Association Inc
>
--
Mark Kelly
Manager Information Systems
Reporting Manager
IT Learning Area Manager
McKinnon Secondary College
McKinnon Rd McKinnon 3204
Victoria, Australia
Direct line / Voicemail: +613 8520 9085
Fax +613 9578 9253
kel at mckinnonsc.vic.edu.au
VCE IT Lecture Notes: http://vceit.com
Moderator: IT Applications Edulist
My cow died on this day two years ago. I know because I noted it in my
dairy.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.edulists.com.au/pipermail/sofdev/attachments/20101129/fd8b219e/attachment.html
More information about the sofdev
mailing list