abstract-class


What is the difference between an Abstract Class and a Mixin?


I just found an article on a framework in Java that apparently allows it to support Mixins and something called Composite Oriented Programming (which for all I know might even be the same thing...) I've also heard of/worked with AOP, and I'm not sure how it differs from this either...
At a language-agnostic level, a mixin just adds functionality to a class, and is more for programmer convenience and to avoid code duplication. An abstract (base) class forms an is-a relationship and allows for polymorphism. One reason why inheritance is overused is that it's an easy way to implement mixins without writing any boilerplate in languages that don't really support them. The problem is that you're declaring a polymorphic is-a relationship as a side effect, making your API more confusing and possibly adding ambiguity. Hence, newer languages like D and Ruby support mixins as native features, allowing a convenient way to add a bunch of functionality to a class without declaring a polymorphic is-a relationship.
Mixin is never meant as stand alone class. They just add some functionality to the class you declare. In Python they can be easily applied by class decorators. For example you could decorate your class with Singleton mixin, making your class a singleton.

Related Links

wxribbonbuttonbase dynamic label change
Initializing Variable in Subclass
Why cant we instantiate abstract class
Abstract classes error display
Abstract Classes - A glitch in my program
How to implement IXmlSerializable correctly for a ICollection<T> where T is an abstract class?
Typescript multiple inheritance workarounds?
Class diagram usage in UML
AutoMapper and Base Types
Abstract Class Initialization
Covariant return types
Empty abstract function cannot contain body
Using Visitor Pattern to detect intersection between two shapes
mongodb lift class Snippet needs to be abstract
Abstract class as return of wcf ria method
OpenKinect - FreenectDevice abstract?

Categories

HOME
image
variables
clips
atom-editor
coq
amazon-ec2
keycloak
layout
sd-card
spring-cloud-stream
google-oauth
malloc
sql-server-2016
angular-ui-bootstrap
basic
session-variables
jplayer
designer
foselasticabundle
http-status-code-504
visual-composer
scriptcs
telerik-reporting
claims-based-identity
numerical-methods
traffic
fluentvalidation
maquette
xacml
madlib
frame
key-value-observing
google-sites-2016
asset-pipeline
form-data
http-referer
ios5
azure-ml
checkboxlist
network-flow
idisposable
gabor-filter
brightcove
knockout-components
namecoin
flutterwave
quartz-composer
pycaffe
root-framework
color-picker
infix-notation
elements
google-web-starter-kit
pagedlist
t4mvc
feedback
spidermonkey
citrus-pay
iis-arr
browser-bugs
winddk
android-nested-fragment
qcodo
contenttype
rebol3
reactfx
resty-gwt
algebraic-data-types
cdc
dir
dexterity
inbox
blending
soundtouch
easy-install
jquery-mobile-dialog
type-equivalence
drools-planner
wsdl-2.0
typoscript2
word-processor
multipage
appconkit
amazon-appstore
hamachi
cinema-4d
appendto
locate
mysql-error-1005
visitor-statistic
asp.net-mvc-areas
fixed-width
post-build
wsdl.exe
caching-application-block

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App