From: Frederick Cheung Date: 2008-08-12T21:26:50+09:00 Subject: Re: what do you think of this code? On 12 Aug 2008, at 13:12, Ben Aurel wrote: > > there are a few things that I'm unsure about: > > 1. the application structure as a whole. Is it ok to test command line > argument outside of a class? Seems entirely sensible. were you to reuse this class elsewhere you wouldn't give two hoots about the fiddling with ARGV > > 2. the structure of the class itself. Is the constructor > (initialization) ok that way? Your constructor doesn't seem to be doing much @parent_dir will only ever be set to nil. It would make more sense to me if most of the code in get_dir was actually in your constructor, with the list_all method then taking no arguments and listing whatever the relevant instance variable points at. usage wide your code would then be Ls.new(dir).list_all > > 3. line 24 doesn't work '.' and '..' are not. How could I do that with > regular expressions? > it's because you need if entry != "." && entry != "..". Every string is going to be not equal to at least one of '.' or '..' > > thanks in advance for your help and opinion > ben >