Importing (#import ...
) an Objective-C category adds the methods defined in that category to all instances of the class on which the category was defined. Other than with traits which can be mixed into classes selectively a category extends the class on which it was defined once and for all.
Also you can not create a standalone category and mix that into several different classes. A category is an extension for a specific class, similar as if you would add the methods to the class itself.
Traits are like java interfaces but with implementation. Wether a trait can be mixed into a class depends not on the classes name but on the methods the class provides. If a class has the methods a trait needs, the trait can be mixed into that class.
Abstraction is one of the 4 pillars of Object Oriented Programming(OOP). It literally means to perceive an entity in a system or context from a particular perspective. We take out unnecessary details and only focus on aspects that are necessary to that context or system under consideration.
Here is some good explanation:
You as a person have different relationships in different roles. When you are at school, then you are a "Student". When you are at work, you are an "Employee". When you are at government institution, you can be viewed as a "Citizen". So it boils down to what in what context are we looking at an entity/object.
So if I am modelling a Payroll System, I will look at you as an Employee(PRN, Full Time/Part Time, Designation). If am modelling a Course Enrollment System, then I will consider your aspects and characteristics as a Student(Roll Number, Age, Gender, Course Enrolled). And if I am modelling a Social Security Information System then I will look at your details as a Citizen(like DOB, Gender, Country Of Birth, etc.)
Remember that Abstraction(focussing on necessary details) is different from Encapsulation(hiding details from the outer world). Encapsulation means hiding the details of the object and providing a decent interface for the entities in outer world to interact with that object or entity. For example, if someone want to know my name then he cannot directly access my brain cells to get to know what is my name. Instead that person will either ask my name. If a driver wants to speed up a vehicle then there is an interface(accelerator pedal, gear, etc) for that purpose.
The 1st def s not very clear. Def 2 is good but it tends to confuse the newbie as it tries to link Abstraction with Encapsulation and Inheritance. Def 3 is the best one out of 3 definitions as it clearly defines what is Abstraction precisely.
Best Answer
PHP does not have concept of mixins, however it has traits which look like mix of traits and mixins from hack/scala:
I don't think that there is even a single thing that will work in the same way in all OO languages. Even some basics like inheritance and interfaces have some variations, not mention more blurred constructs like traits/mixins.