What should I imagine when I think of the "Library" in objective-c?

For me, a library is a collection of classes that do useful things. Typically something that can be useful in many projects. Is this also the case in terms of objective-c? What is a library? Only classes that have methods? Or a collection of functions? And do they need to be compiled to be called a "library"? Where does the segregation occur between the Framework? Isn't it the same?

0


a source to share


2 answers


According to Wikipedia : "Structures are functionally similar to shared libraries, a compiled object that can be dynamically loaded into a program's address space at runtime, but frameworks add associated resources, header files, and documentation."

A framework is essentially a shared library (binary, similar to a DLL) in a bundle, which also includes all the information needed to use that library (e.g. header files, documentation, internationalization resources, etc.). The framework, without all the extra features, is just a library.



There is no requirement for the framework to be object oriented in nature, although I assume that is the norm with Cocoa.

For Cocoa, the concept of a framework usually replaces (enhances) the concept of a library. However, the Objective-C toolchain does not require such a requirement. You can only use source libraries or unix style binaries (like a .so file). I think of a "library" in these general terms ... it's just a collection of useful code in source or binary form. On the other hand, structure is OS X specific thing with specific meaning.

+3


a source


Assuming you are talking about a library that uses Cocoa frameworks and not just one written in plain old Objective-C, a library (or framework) is a collection of classes that work together to accomplish a specific task, I would not organize a structure ObjC as a set of features, as it completely contradicts the language paradigm.



As far as the difference between a library and a framework is concerned, this is probably a bit subjective. To me, a library (in the context of your question) is something written in C that probably resembles more closely a set of non-OO functions. The structure would be a complete package of classes as I described above. So the messaging framework on CocoaDev will be the framework, while the sqlite3 APIs that you can access on the iPhone will be the library. Again, it's just me. Other people may interpret terms in different ways.

+2


a source







All Articles