From: Adam Akhtar Date: 2008-11-11T18:53:36+09:00 Subject: Re: implementing mvc - using observer pattern - beginner to OOP Hi thanks for the replies. I looked into MVC and i think its proably overkill for what im doing and probably stretching my abilities too far at this stage though does look like a good pattern. One think I dont understand is what the controller would actually do in my case where im just using the command line. I feel like i only need a model and then a view/controller wrapped into one. Well ive decided to just scrap mvc and just get the thing working. I created two classes. One is a database class which wraps up kirbybase (a flat file db plugin for ruby) and the second is basically the U.I i.e. menu logic, getting input and presenting menus and stuff. Im just not sure how to code their communication to each other. class DB .. .. def insert (task) ... #some kirybbase calls here. .. end end class UI blahblahblah def menu puts "|A| to add a task" ... ... end def navigation menu input = gets.chomp case input when "A" add task etc etc etc end def add_task new_task = new_task_form add_task_to_db(new_task) end def add_task_to_db(new_task) **what goes here? end def new_task_form puts "Enter title for task" new_task = Task.new new_task.title = gets.chomp return new_task end in add_task_to_db Im wondering the best way to pass the new_task completed in the UI object over to my db object. Is there someway to let the db class see the value of new_task? Should i be using an observer pattern here? Should they be observing one another (if possible?)? Im probably overlooking somthing dead simple here but im way confused. any help most appreciated. -- Posted via http://www.ruby-forum.com/.