Presentation is loading. Please wait.

Presentation is loading. Please wait.

Sayed Ahmed Computer Engineering, BUET, Bangladesh Masters from the University of Manitoba, Canada

Similar presentations


Presentation on theme: "Sayed Ahmed Computer Engineering, BUET, Bangladesh Masters from the University of Manitoba, Canada"— Presentation transcript:

1 Sayed Ahmed Computer Engineering, BUET, Bangladesh Masters from the University of Manitoba, Canada http://www.justetc.net http://sayed.justetc.net sayed@justetc.net

2 Java Class Design Advanced Class Design Object-Oriented Design Principles Generics and Collections String Processing Exceptions and Assertions Java I/O Fundamentals Java File I/O (NIO.2) Building Database Applications with JDBC Threads Concurrency Localization

3  http://www.javainmind.com/exam2- table/exam2-checklist/ http://www.javainmind.com/exam2- table/exam2-checklist/

4  http://stackoverflow.com/questions/5816563/when-should-i- choose-inheritance-over-an-interface-when-designing-c-sharp-class http://stackoverflow.com/questions/5816563/when-should-i- choose-inheritance-over-an-interface-when-designing-c-sharp-class  Their general recommendations are as follows:  Do favor defining classes over interfaces.  Do use abstract classes instead of interfaces to decouple the contract from implementations. Abstract classes, if defined correctly, allow for the same degree of decoupling between contract and implementation.  Do define an interface if you need to provide a polymorphic hierarchy of value types.  Consider defining interfaces to achieve a similar effect to that of multiple inheritance.  Chris Anderson expresses particular agreement with this last tenant, arguing that:  Abstract types do version much better, and allow for future extensibility, but they also burn your one and only base type. Interfaces are appropriate when you are really defining a contract between two objects that is invariant over time. Abstract base types are better for defining a common base for a family of types.

5  http://stackoverflow.com/questions/3311788/when-to-implement-an- interface-and-when-to-extend-a-superclass http://stackoverflow.com/questions/3311788/when-to-implement-an- interface-and-when-to-extend-a-superclass  Use an interface if you want to define a contract. I.e. X must take Y and return Z. It doesn't care how the code is doing that. A class can implement multiple interfaces.  Use an abstract class if you want to define default behaviour in non-abstract methods so that the endusers can reuse it without rewriting it again and again. A class can extend from only one other class. An abstract class with only abstract methods can be as good definied as an interface. An abstract class without any abstract method is recognizeable as the Template Method pattern (see this answer for some real world examples).Template Methodthis answer  An abstract class in turn can perfectly implement an interface whenever you want to provide the enduser freedom in defining the default behaviour.

6  http://docs.oracle.com/javase/tutorial/java/Ia ndI/createinterface.html http://docs.oracle.com/javase/tutorial/java/Ia ndI/createinterface.html

7  http://www.javacamp.org/moreclasses/oop/oo p5.html http://www.javacamp.org/moreclasses/oop/oo p5.html  http://www.primeinspiration.com/more/progra mming/programming-guides/892-is-a-and-has- a-relationships.html http://www.primeinspiration.com/more/progra mming/programming-guides/892-is-a-and-has- a-relationships.html

8  http://stackoverflow.com/questions/3979581 /disadvantage-of-object-composition-over-class- inheritance http://stackoverflow.com/questions/3979581 /disadvantage-of-object-composition-over-class- inheritance  http://en.wikipedia.org/wiki/Composition_over _inheritance http://en.wikipedia.org/wiki/Composition_over _inheritance

9  http://userpages.umbc.edu/~tarr/dp/lectures/ OOPrinciples.pdf http://userpages.umbc.edu/~tarr/dp/lectures/ OOPrinciples.pdf

10  http://www.javaworld.com/javaworld/jw-04- 2003/jw-0425-designpatterns.html?page=2 http://www.javaworld.com/javaworld/jw-04- 2003/jw-0425-designpatterns.html?page=2  http://en.wikipedia.org/wiki/Singleton_pattern http://en.wikipedia.org/wiki/Singleton_pattern  http://en.wikipedia.org/wiki/Singleton_pattern http://en.wikipedia.org/wiki/Singleton_pattern  http://www.vogella.com/articles/DesignPattern Singleton/article.html

11  http://www.oracle.com/technetwork/java/dataacc essobject-138824.html http://www.oracle.com/technetwork/java/dataacc essobject-138824.html  Use a Data Access Object (DAO) to abstract and encapsulate all access to the data source. The DAO manages the connection with the data source to obtain and store data.  http://java.boot.by/ocpjp7-upgrade/ch02s03.html http://java.boot.by/ocpjp7-upgrade/ch02s03.html  http://www.oracle.com/technetwork/java/dataacc essobject-138824.html http://www.oracle.com/technetwork/java/dataacc essobject-138824.html  http://www.oracle.com/technetwork/java/dataacc essobject-138824.html http://www.oracle.com/technetwork/java/dataacc essobject-138824.html

12  http://stackoverflow.com/questions/5739611/dif ferences-between-abstract-factory-pattern-and- factory-method http://stackoverflow.com/questions/5739611/dif ferences-between-abstract-factory-pattern-and- factory-method  The main difference between a "factory method" and an "abstract factory" is that the factory method is a single method, and an abstract factory is an object  there is an object A, who wants to make a Foo object. Instead of making the Foo object itself (e.g. with a factory method), it's going get a different object (the abstract factory) to create the Foo object.  http://en.wikipedia.org/wiki/Abstract_factory_patt ern http://en.wikipedia.org/wiki/Abstract_factory_patt ern


Download ppt "Sayed Ahmed Computer Engineering, BUET, Bangladesh Masters from the University of Manitoba, Canada"

Similar presentations


Ads by Google