Question 1: In my opinion it's best to write the logic, algorithms, etc...(in other words the model) completely separate from any user interface, and later plug into said model with other components...