Friday, September 14, 2012

warm-up exercise refactoring

10-09-12
(them)


Could you give us a short assessment of where you are in the introductory example that we gave you as a warm-up exercise? In order for you to spend some time on the real container library, it would be good to complete this exercise this week if possible.

I see you committed the exercise code+text in hi-lite/libs/containers/ada/intro, thanks. Could you create a different version of Stacks for each extension? So the original Stacks is the simplest one, and then you can have Unbounded_Stacks and Indefinite_Stacks, etc. That will help reviewing your code.

14-09-12
(I)

I already this structure to the sources:

indefinite_stacks
stacks
unbounded_integer_stacks
unbounded_stacks

Now I'm using one main for each test:
main_indefinite_stacks.adb
main_stacks.adb
main_unbounded_integer_stacks.adb
main_unbounded_stacks.adb

but I don't know if you refer to this kind of organization
or maybe you refer a hierarchical one
maybe in the simplest stacks
I can define base operations like

   function Is_Empty
   function Is_Full 

and then on the others stacks make extends the basic operation.
also maybe I can just code one larger main for testing
#main_indefinite_stacks right now is just a copy of unbounded_stacks
#and main.adb is the old one that currently I'm not using anymore

14-09-12
(them)

This organization of code is fine.


maybe in the simplest stacks
I can define base operations like

    function Is_Empty
    function Is_Full

and then on the others stacks make extends the basic operation.
The code is not yet clean. Could you restart from stack.ads/stack.adb and remove all unneeded operations? Just stick to the API that Johannes indicated (see INTRO.txt), which is sufficient to see and discuss issues. Remember this is just an exercise that should allow us to communicate, so the simpler the better.

also maybe I can just code one larger /main/ for testing
/#main_indefinite_stacks /right now is just a copy of /unbounded_stacks/
#and /main.adb /is the old one that currently I'm not using anymore

Please keep separate /main/ for each stack. That's easier to follow.

No comments:

Post a Comment