Research and familiries yourself with the use of modules !!!
why not study other's framework first
1 person found this helpful
Learn about modules and use a framework ( Mate,Swiz .... ), I prefer Dependency Injection frameworks. This will help you to have loose-coupling within your application. Also look into using interfaces and unit-testing. If there is a problem , or change in the code, unit-testing can help you verify if there is and where the problem is. There is a guy named Paul Williams who has a blog somewhere on the adobe website detailing architecture, if you aren't familiar with software architecture it will blow your mind. At the end of the day , it comes down to separation of concern ( don't do service calls , or keep your model in view classes ) as well as loose-coupling to accomodate requirement changes ( one change won't break the whole application ).