Subject: Re: finally and comments

From: Chee Yap <[email-masked]>
Date: Tue, 19 Oct 1999 10:30:43 -0400 (EDT)

Joaquin:

I am glad you got it.  The problem is very
simple to solve, and here is the logic/reasoning:

   -- you worry about split being called with null.
   -- but who calls split?  It is the sort() method.
   -- so, you just have to make sure that the list is
	not null before you call split!
   -- in fact, you can make sure that the list is at
	least length 2 before you call split (so that
	split has something to do).  This check is
	easy: sort() must make sure that this.next is
	not null before calling split().
   -- what if this.next is null?  Well, this is the
	base case, and you do not want to do recursion
	in this case!  So if your top level logic is
	solid (like taking care of base cases), the
	problem with split does not arise).

Interface cannot make your problem any
harder.  In any case, you are required to
IMPLEMENT the interface.

The importance of interface is that it
is a common "front" to present to the world,
hiding all the (possibly) ugly implementations
underneath, which users do not need to know.
That is the key idea behind Object Oriented (OO)
programming.

--Chee

> From [email-masked] Mon Oct 18 21:55 EDT 1999
> X-Authentication-Warning: cs.nyu.edu: majordom set sender to [email-masked] using -f
> Date: Mon, 18 Oct 1999 21:53:12 -0400
> From: Joaquin Grech <[email-masked]>
> X-Accept-Language: en
> To: basic algorithm <[email-masked]>
> Subject: finally and comments
> 
>  Hi!
> 
> Finally I got it:
> J:\jdk1.2\bin>java myNode
> ....INPUT LIST:
> zz, yy, xx, 111, 333, 222, 454, 550, 666, ppp, qqq, ddd, cde, abc, bcd,
> ccc, bbb
> b, aaaa
> ....SORTED LIST:
> 111, 222, 333, 454, 550, 666, aaaa, abc, bbbb, bcd, ccc, cde, ddd, ppp,
> qqq, xx,
>  yy, zz
> J:\jdk1.2\bin>
> 
> But I have some comments. I think 'interfaces' are there to help us
> understand the
> program, make it a little more abstract and error prove. I don't believe
> interfaces are
> there to provoque painful hours of programming hehe
> 
> The point is, that I tryed to implement the same program without
> interfaces
> or changing the interfaces alot, and it was wayyyy easier.
> 
> Do we always have to follow this interfaces? or can we change them?
> because I can't imagine doing a midterm on time.
> (4 hours programming with interfaces this program...)
> (45 minutes the other way).
> 
> Joaquin Grech
> ---------------------------------------------------------------
> !     C r e a t i v i t y     M u s t    S u r v i v e        !
> ---------------------------------------------------------------
> !  Fido: 2:341/19.67                 Euronet: 25:928/100.67   !
> !  Internet: [email-masked]                            !
> !  Http://www.creative1.net                 Ya me direis :)   !
> ---------------------------------------------------------------
> 
> 
>