[Cs4800] Plenty of Russian Dolls
Ghadeer Rahhal
rahhal.g at husky.neu.edu
Wed Feb 10 23:37:53 EST 2010
So you mean....
I*n class TopSort:*
* *
*while (graph.size() != 0) {*
* ...*
* graph.size();*
* ...*
* graph.get(i).remove();*
* ...*
* graph.get(i).getpreds().isEmpty()*
* ...*
* graph.get(i).getname();*
*}*
SHOULD BE
class TopSort:
int size = graph.size();
while (size != 0) {
...
size
...
Object object = graph.get(i).remove();
...
object .getpreds().isEmpty()
...
object.getname();
}
On Wed, Feb 10, 2010 at 11:11 PM, Karl Lieberherr <lieber at ccs.neu.edu>wrote:
> Looking through your Topological Sorting program, I found plenty of Russion
> dolls.
>
> Although this is an Algorithms course, we want to write our algorithms in
> good style as taught in the Object-Oriented Design Course. No more Russian
> Dolls.
> Read:
>
> http://garmhold.blogspot.com/2010/02/no-more-russian-dolls-applying-law-of.html
> and related links.
>
> Use appropriate intimacy!
>
> Compare with Bryan Chadwick's code that I showed in class! There are no
> Russian dolls in there.
>
> -- Karl
>
> Bad sample code:
>
> In class TopSort:
>
> while (graph.size() != 0) {
> ...
> graph.size();
> ...
> graph.get(i).remove();
> ...
> graph.get(i).getpreds().isEmpty()
> ...
> graph.get(i).getname();
> }
>
> _______________________________________________
> Cs4800 mailing list
> Cs4800 at lists.ccs.neu.edu
> https://lists.ccs.neu.edu/bin/listinfo/cs4800
>
>
--
~Ghadeer Rahhal
-------------- next part --------------
HTML attachment scrubbed and removed
More information about the Cs4800
mailing list