Category Archive: Theory

Separate nibs/xibs

In case you are wondering why you should separate your nibs/xibs in your project you are in the right post. The Apple resource programming guide explains everything in detail but we are after the following paragraph:

“In the main nib file for a Mac OS X application, consider storing only the application menu bar and an optional application delegate object in the nib file. Avoid including any windows or user-interface elements that will not be used until after the application has launched. Instead, place those resources in separate nib files and load them as needed after launch.” (link)

Having everything in one nib is in general a bad idea. The reason is that you are instantiating everything at once when the application is launching. Of-course in a tiny application you wont even notice a difference in the performance neither in the way you organise the project but when the project is expected to be big you are encouraged to separate it.

For example if you have everything in one nib/xib file you are instantiating the preferences window, about window and other windows and controllers that you may not using.

You should be using multiple nibs.

Introduction to Core Data

Core Data is a data model framework that manages data with a formatted SQLite database of the relational entity-attribute-value (EAV) model. The roots of this framework come from the well-known Enterprise Objects Framework (EOF). Core Data is commonly named as a database API for Cocoa (axiomatically wrong since it allocates and deallocates memory of the data objects) and is the most effective solution to data persistence. Data persistence means saving and fetching objects from the disk. The framework supports other data storage formats such as Binary archive and XML, although SQLite is preferred due to its speed and security advantages. The only drawback is that the data file is not human-readable but is possible to explore the contents by using the appropriate command line tool (sqlite3).

Click here to read more »

Theory

“Coupling between classes should be minimised. Coupling refers to dependencies between objects. Whenever such dependencies exist, they reduce opportunities for reusing the objects independently. It is ironic that inheritance is simultaneously one of the most powerful tools in object oriented programming and on of the leading causes of coupling”.

Buck, E. M. & Yacktman, D. A., 2009. Cocoa Design Patterns (Developer’s Library). 1 Ed.