1. Active Record Presentation by Mambe Churchill Nanje CEO, www.afrovisiongroup.com At Barcamp Cameroon 2009
2. What is Active Record? Active Record is an implementation of Object Relational Mapping where in a database is manipulated by highly linked objects(MODELS) interfacing the database tables and their content e.g instead of SELECT * FROM accounts WHERE user=1 with Active records we do user=new User(1); //sql gets generated for you
3.
4. HOW IT WORKS Example: car park management system Database of Cars Code without Active Record: connection=new Connection(h,u,p); query='select * from cars where id=1'; rs=connection.statement.execute(query); car=rs.get(0); print(car.brand); //mercedes print(car.owner); //francis Code With Active Record: database=new Database(h,u,p); car=database.get('cars',1); print(car.brand); //mercedes print(car.owner); //francis
5.
6.
7.
8.
9. Advantages of Active Record âą Productivity â Eliminates lots of repetitive code â focus on business logic â Database code is generated automatically âą Maintainability â Fewer lines of code â easier to understand â Easier to manage change in the object model âą Performance â Lazy loading â associations are fetched when needed â Caching âą Database vendor independence â The underlying database is abstracted away â Can be configured outside the application
10.
11. Thank you For more informationa about me www.afrovisiongroup.com http://mambenanje.blogspot.com www.twitter.com/mambenanje www.facebook.com/mambenanje other links www.blackamphi.com www.nexdimempire.com