SlideShare uma empresa Scribd logo
1 de 8
Baixar para ler offline
OO Programming Languages Syntax
      Exceptions Handling




      Elena Punskaya, op205@cam.ac.uk

                                        1
OO in Java
                                	   //abstract class declaration
•   Abstract class defines      	
                                	
                                      public abstract class Account
                                      {
    shared implementation       	   	       private int mAccountNumber;
                                	   	       //constructor
                                	   	       public Account(int accountNumber)
•   Methods declared Abstract   	   	       {
                                	   	     	      mAccountNumber = accountNumber;
    MUST be implemented by      	   	       }
                                	   	       // abstract method declaration
    subclasses                  	   	       public abstract void credit(Amount amount);
                                	     }

•   Interface can only define   	
                                	     //interface declaration

    method signatures           	
                                	
                                      public interface IVerifiable
                                      {

    (names, parameters,         	
                                	
                                    	
                                    	
                                           //declaring the interface method
                                           public boolean isVerified();

    output) and no              	
                                	
                                      }


    implementation              	
                                	
                                      //PayPal derives from Account and realises IVerifiable
                                      public class PayPalAccount extends Account implements IVerifiable
                                	     {
•   Classes can Extend other    	
                                	
                                    	
                                    	
                                            //constructor, calls the superclass
                                            public PayPalAccount(int accountNumber)
    classes and Implement       	
                                	
                                    	
                                    	     	
                                            {
                                                 super(accountNumber);
    interfaces                  	
                                	
                                    	
                                    	
                                            }
                                            //implementation of the abstract method
                                	   	       public void credit(Amount amount)
•   By default, all class       	   	       {
                                	   	     	      //send money to PayPal
    methods can be overridden   	   	       }
                                	   	       //implementation of the interface method
    (extended/implemented)      	   	       public boolean isVerified()
                                	   	       {
    in the subclasses           	   	     	      //do check and return result
                                	   	       }
                                	     }
                                                                            © 2012 Elena Punskaya
                                                                                                   2
                                                       Cambridge University Engineering Department

                                                                                                          2
OO in C#
                                         	   //abstract class declaration
•   Very similar to Java                 	
                                         	
                                               public abstract class Account
                                               {
    syntax and concepts, but             	   	       private int mAccountNumber;
                                         	   	       //constructor
    also some differences                	   	       public Account(int accountNumber)
                                         	   	       {
                                         	   	     	      mAccountNumber = accountNumber;
•   Any non-abstract class               	   	       }
                                         	   	       // abstract method declaration
    methods have to be                   	   	       public abstract void credit(Amount amount);

    explicitly declared virtual
                                         	     }
                                         	

    so can be overridden                 	
                                         	
                                               //interface declaration
                                               public interface IVerifiable

    (extended/implemented)               	
                                         	   	
                                               {
                                                    //declaring the interface method

    in the subclasses                    	
                                         	
                                             	
                                               }
                                                    public boolean isVerified();

                                         	
•   C# vs Java comparison:               	
                                         	
                                               //PayPal derives from Account and realises IVerifiable
                                               public class PayPalAccount extends :Account, implements IVerifiable
                                         	     {
    - http://msdn.microsoft.com/en-us/   	   	       //constructor, calls the superclass
      library/ms836794.aspx              	   	       public PayPalAccount(int accountNumber) : base(accountNumber)
                                         	   	       {
                                         	   	     	      super(accountNumber);
                                         	   	       }
                                         	   	       //implementation of the abstract method
                                         	   	       public void credit(Amount amount)
                                         	   	       {
                                         	   	     	      //send money to PayPal
                                         	   	       }
                                         	   	       //implementation of the interface method
                                         	   	       public boolean isVerified()
                                         	   	       {
                                         	   	     	      //do check and return result
                                         	   	       }
                                         	     }
                                                                                     © 2012 Elena Punskaya
                                                                                                            3
                                                                Cambridge University Engineering Department

                                                                                                                     3
OO in C++
                                          	   //class declaration
•   Methods need to be                    	
                                          	
                                                class Account
                                                {
    declared virtual to be                	   	       //declaring all publicly accessible methods/attributes
                                          	    	      public:
    extended (as in C#)                       	     	       //constructor
                                              	     	       Account(int accountNumber)
                                              	     	       {
•   Pure virtual methods                      	     	     	      mAccountNumber = accountNumber;
                                              	     	       }
    (ending declarations with                 	     	       // abstract method declaration

    “=0”) are equivalent to
                                              	     	       virtual void credit(Amount amount) = 0;


    abstract methods in Java              	
                                          	
                                              	
                                              	
                                                    private:
                                                    	   int mAccountNumber;
                                          	    };

•   No dedicated concept of               	
                                          	     //interface (equivalent) declaration

    Interfaces, but same                  	
                                          	
                                                class IVerifiable
                                                {

    effect is achieved by                 	
                                          	
                                              	
                                              	
                                                     //pure virtual (abstract) method declaration
                                                     public:
    defining a class that                 	     }
                                                         virtual bool isVerified() = 0;


    contains pure virtual                 	
                                          	     //PayPal derives from Account and IVerifiable
    methods only                          	
                                          	
                                                public class PayPalAccount : public Account, public IVerifiable
                                                {
                                          	   	       public:
•   C++ and Java differences              	   	
                                              	     	
                                                      //constructor, calls the superclass
                                                           PayPalAccount(int accountNumber):Account(accountNumber)
    - http://www.cprogramming.com/            	     	      {
                                              	     	      }
      tutorial/java/syntax-differences-       	     	      //declaring the implementation
      java-c++.html                           	     	      virtual void credit(Amount amount);

                                              	     	    //declaring the implementation
                                              	     	    virtual bool isVerified();
                                          	    }
                                                                                      © 2012 Elena Punskaya
                                                                                                             4
                                                                 Cambridge University Engineering Department

                                                                                                                     4
Error Handling
•   All software encounters
    error conditions during
                                             	   // add error reporting to code that can fail
    operations                               	   public int doSomethingRisky()
                                             	   {
•   Good software will                       	   	   <..>
                                             	   	   if (problemNumber1Happened)
    manage error situations                  	   	   	    return 1;
    gracefully and robustly                  	   	   else if (problemNumber2Happened)
                                             	   	   	    return 2;
                                             	   	   else
•   Error handling has to be                 	   	   	    return 0; //all good
    implemented in the code                  	
                                             	
                                                 }

                                             	   //using this method, need to build in checks
•   A standard option from                   	   int result = riskyAction.doSomethingRisky();
    procedural languages –                   	
                                             	
                                                 if (result == 0)
                                                 {
    Error Codes                              	   	   //All good, can proceed
                                             	   }
•   Main idea:                               	
                                             	
                                                 else if(result == 1)
                                                 {
    - use a code to indicate some            	   	   //handle Problem1
                                             	   }
      specific error
                                             	   else if(result == 2)
    - make the function to return a          	   {
      code                                   	   	   //handle Problem2
                                             	   }
    - check the return code if it is OK or
      error

                                                                                       © 2012 Elena Punskaya
                                                                                                              5
                                                                  Cambridge University Engineering Department

                                                                                                                  5
Exceptions
•   Errors such as the above
    represent exceptions to the
                                                      	   // add error reporting to code that can fail
    normal program flow.                              	   public void doSomethingRisky()
                                                      	   {
•   Handling exceptions via return                    	   	   <..>
                                                      	   	   if (problemNumber1Happened)
    codes has a number of                             	        //throw forces us to exit the current
    disadvantages:                                             //method and returns an exception object
                                                      	   	   	    throw problemNumber1Exception;
    - Extra code needs to be inserted in each         	   	   else if (problemNumber2Happened)
      function to pass the errors back.               	   	   	    throw problemNumber2Exception;
                                                      	   }
    - If one function fails to check for errors and   	
      pass them back, the errors will not get         	   //using this method, wrap it in try/catch block
      handled                                             //to catch returned exceptions
                                                      	   try
    - The extra error checking obscures the main      	   {
      function of the code, making it difficult to    	   	    riskyAction.doSomethingRisky();
                                                      	   }
      understand                                      	   catch (ProblemNumber1Exception error)
    - Error recovery code becomes intertwined         	   {
      with the normal operation code                  	   	    //handle Problem1
                                                      	   }
    - Functions cannot use return values for          	   catch (ProblemNumber2Exception error)
      normal purposes                                 	   {
                                                      	   	    //handle Problem2
•   There is another way...                           	   }


•   Exceptions!
                                                                                     © 2012 Elena Punskaya
                                                                                                            6
                                                                Cambridge University Engineering Department

                                                                                                                6
Exceptions
•   C++ example                     //C++ class to define Exceptions
                                    class TradingErr {
                                        TradingErr (ErrType ee, Time tt) {e=ee; t=tt;}
•   Using exceptions, the code is       ErrType e; Time t;
    easier to follow because the    };
                                    //main program method
    error handling parts are        int main() {
                                        try {
    clearly separated from the               <..>
    regular program flow                     //MyTrader() can re-throw an exception
                                             MyTrader();
                                             <..>
•   An exception handler can            //Exception handling
    throw the exception again           } catch (TradingError x) {
                                             ReportError(x.e, x.t);
    allowing some errors to be          }
                                    }
    trapped and repaired and        //------------------------------------------------
    others to be propagated, e.g.   void MyTrader() {
                                        <..>
    from TE_GetPrice() to               //code that can re-throw an exception

    MyTrader() to the main              float price = TE_GetPrice(day);
                                        <..>
    method, where it is handled     }
                                    //------------------------------------------------

•   Exceptions should REALLY be     float TE_GetPrice(int day) {
                                        <..>
    exceptional and not be a part       //code that can throw an exception
                                        if (!Valid(day))
    of normal program flow                   throw TradingErr(BAD_DAY,TimeNow());
                                        <..>
                                    }
                                                                   © 2012 Elena Punskaya
                                                                                          7
                                              Cambridge University Engineering Department

                                                                                              7
No Code Wars! – Tools for the Job
•   Debating comparative
    advantages and disadvantages
    of programming languages
    makes a good (if often heated)
    conversation, but in reality the
    choice of the language is often
    dictated by the application!
•   For example, in mobile
    application development:
    - Android, Blackberry, J2ME: Java
    - iPhone: Objective-C
    - Windows Phone: C#
    - Symbian (RIP): C++


•   Being proficient in a range of
    languages helps

                                        Source: http://www.rackspace.com/cloud/blog/2011/05/17/infographic-evolution-of-
                                        computer-languages/

                                                                          © 2012 Elena Punskaya
                                                                                                 8
                                                     Cambridge University Engineering Department

                                                                                                                       8

Mais conteúdo relacionado

Mais procurados

03 iec t1_s1_oo_ps_session_04
03 iec t1_s1_oo_ps_session_0403 iec t1_s1_oo_ps_session_04
03 iec t1_s1_oo_ps_session_04Niit Care
 
Detecting aspect-specific code smells using Ekeko for AspectJ
Detecting aspect-specific code smells using Ekeko for AspectJDetecting aspect-specific code smells using Ekeko for AspectJ
Detecting aspect-specific code smells using Ekeko for AspectJCoen De Roover
 
Ekeko Technology Showdown at SoTeSoLa 2012
Ekeko Technology Showdown at SoTeSoLa 2012Ekeko Technology Showdown at SoTeSoLa 2012
Ekeko Technology Showdown at SoTeSoLa 2012Coen De Roover
 
PPT ON VHDL subprogram,package,alias,use,generate and concurrent statments an...
PPT ON VHDL subprogram,package,alias,use,generate and concurrent statments an...PPT ON VHDL subprogram,package,alias,use,generate and concurrent statments an...
PPT ON VHDL subprogram,package,alias,use,generate and concurrent statments an...Khushboo Jain
 
A Logic Meta-Programming Foundation for Example-Driven Pattern Detection in O...
A Logic Meta-Programming Foundation for Example-Driven Pattern Detection in O...A Logic Meta-Programming Foundation for Example-Driven Pattern Detection in O...
A Logic Meta-Programming Foundation for Example-Driven Pattern Detection in O...Coen De Roover
 
07 iec t1_s1_oo_ps_session_10
07 iec t1_s1_oo_ps_session_1007 iec t1_s1_oo_ps_session_10
07 iec t1_s1_oo_ps_session_10Niit Care
 
The SOUL Tool Suite for Querying Programs in Symbiosis with Eclipse
The SOUL Tool Suite for Querying Programs in Symbiosis with EclipseThe SOUL Tool Suite for Querying Programs in Symbiosis with Eclipse
The SOUL Tool Suite for Querying Programs in Symbiosis with EclipseCoen De Roover
 
A Recommender System for Refining Ekeko/X Transformation
A Recommender System for Refining Ekeko/X TransformationA Recommender System for Refining Ekeko/X Transformation
A Recommender System for Refining Ekeko/X TransformationCoen De Roover
 
05 iec t1_s1_oo_ps_session_07
05 iec t1_s1_oo_ps_session_0705 iec t1_s1_oo_ps_session_07
05 iec t1_s1_oo_ps_session_07Niit Care
 
Multiple inheritance in c++
Multiple inheritance in c++Multiple inheritance in c++
Multiple inheritance in c++Saket Pathak
 
VHDL - Enumerated Types (Part 3)
VHDL - Enumerated Types (Part 3)VHDL - Enumerated Types (Part 3)
VHDL - Enumerated Types (Part 3)Abhilash Nair
 
C++ Multiple Inheritance
C++ Multiple InheritanceC++ Multiple Inheritance
C++ Multiple Inheritanceharshaltambe
 
08 iec t1_s1_oo_ps_session_11
08 iec t1_s1_oo_ps_session_1108 iec t1_s1_oo_ps_session_11
08 iec t1_s1_oo_ps_session_11Niit Care
 

Mais procurados (20)

03 iec t1_s1_oo_ps_session_04
03 iec t1_s1_oo_ps_session_0403 iec t1_s1_oo_ps_session_04
03 iec t1_s1_oo_ps_session_04
 
Detecting aspect-specific code smells using Ekeko for AspectJ
Detecting aspect-specific code smells using Ekeko for AspectJDetecting aspect-specific code smells using Ekeko for AspectJ
Detecting aspect-specific code smells using Ekeko for AspectJ
 
Ekeko Technology Showdown at SoTeSoLa 2012
Ekeko Technology Showdown at SoTeSoLa 2012Ekeko Technology Showdown at SoTeSoLa 2012
Ekeko Technology Showdown at SoTeSoLa 2012
 
06 inheritance
06 inheritance06 inheritance
06 inheritance
 
04cpp inh
04cpp inh04cpp inh
04cpp inh
 
PPT ON VHDL subprogram,package,alias,use,generate and concurrent statments an...
PPT ON VHDL subprogram,package,alias,use,generate and concurrent statments an...PPT ON VHDL subprogram,package,alias,use,generate and concurrent statments an...
PPT ON VHDL subprogram,package,alias,use,generate and concurrent statments an...
 
A Logic Meta-Programming Foundation for Example-Driven Pattern Detection in O...
A Logic Meta-Programming Foundation for Example-Driven Pattern Detection in O...A Logic Meta-Programming Foundation for Example-Driven Pattern Detection in O...
A Logic Meta-Programming Foundation for Example-Driven Pattern Detection in O...
 
07 iec t1_s1_oo_ps_session_10
07 iec t1_s1_oo_ps_session_1007 iec t1_s1_oo_ps_session_10
07 iec t1_s1_oo_ps_session_10
 
The SOUL Tool Suite for Querying Programs in Symbiosis with Eclipse
The SOUL Tool Suite for Querying Programs in Symbiosis with EclipseThe SOUL Tool Suite for Querying Programs in Symbiosis with Eclipse
The SOUL Tool Suite for Querying Programs in Symbiosis with Eclipse
 
inhertance c++
inhertance c++inhertance c++
inhertance c++
 
A Recommender System for Refining Ekeko/X Transformation
A Recommender System for Refining Ekeko/X TransformationA Recommender System for Refining Ekeko/X Transformation
A Recommender System for Refining Ekeko/X Transformation
 
05 iec t1_s1_oo_ps_session_07
05 iec t1_s1_oo_ps_session_0705 iec t1_s1_oo_ps_session_07
05 iec t1_s1_oo_ps_session_07
 
Inheritance and Interfaces
Inheritance and InterfacesInheritance and Interfaces
Inheritance and Interfaces
 
Inheritance
InheritanceInheritance
Inheritance
 
Multiple inheritance in c++
Multiple inheritance in c++Multiple inheritance in c++
Multiple inheritance in c++
 
VHDL - Enumerated Types (Part 3)
VHDL - Enumerated Types (Part 3)VHDL - Enumerated Types (Part 3)
VHDL - Enumerated Types (Part 3)
 
C++ Multiple Inheritance
C++ Multiple InheritanceC++ Multiple Inheritance
C++ Multiple Inheritance
 
08 iec t1_s1_oo_ps_session_11
08 iec t1_s1_oo_ps_session_1108 iec t1_s1_oo_ps_session_11
08 iec t1_s1_oo_ps_session_11
 
Inheritance
InheritanceInheritance
Inheritance
 
Inheritance
InheritanceInheritance
Inheritance
 

Destaque

3 f6 10_testing
3 f6 10_testing3 f6 10_testing
3 f6 10_testingop205
 
Lecture 3 Software Engineering and Design Introduction to UML
Lecture 3 Software Engineering and Design Introduction to UMLLecture 3 Software Engineering and Design Introduction to UML
Lecture 3 Software Engineering and Design Introduction to UMLop205
 
Hobby - Photos Myself
Hobby - Photos MyselfHobby - Photos Myself
Hobby - Photos MyselfCesar Wolf
 
Heidi Miller Portfolio Samples
Heidi Miller Portfolio SamplesHeidi Miller Portfolio Samples
Heidi Miller Portfolio SamplesHeidi Miller
 
Warehouse Center presentation, AsstrA 2009
Warehouse Center presentation, AsstrA 2009Warehouse Center presentation, AsstrA 2009
Warehouse Center presentation, AsstrA 2009Pavel Red'ko
 
Collaboration Proposel
Collaboration ProposelCollaboration Proposel
Collaboration ProposelCLse
 
DiffCalculus: September 11, 2012
DiffCalculus: September 11, 2012DiffCalculus: September 11, 2012
DiffCalculus: September 11, 2012Carlos Vázquez
 
Organi-Deviance Part I
Organi-Deviance Part IOrgani-Deviance Part I
Organi-Deviance Part Icmhusted
 
Speak Sooner Client Presentation / Pitch
Speak Sooner Client Presentation / Pitch Speak Sooner Client Presentation / Pitch
Speak Sooner Client Presentation / Pitch Chris Zubryd
 
NSTC Policy for Enabling the Development, Adoption and Use of Biometric Stand...
NSTC Policy for Enabling the Development, Adoption and Use of Biometric Stand...NSTC Policy for Enabling the Development, Adoption and Use of Biometric Stand...
NSTC Policy for Enabling the Development, Adoption and Use of Biometric Stand...Duane Blackburn
 
What is I2 Final-Approved
What is I2 Final-ApprovedWhat is I2 Final-Approved
What is I2 Final-ApprovedDuane Blackburn
 
Meet my brother
Meet my brotherMeet my brother
Meet my brothercpremolino
 

Destaque (20)

3 f6 10_testing
3 f6 10_testing3 f6 10_testing
3 f6 10_testing
 
Lecture 3 Software Engineering and Design Introduction to UML
Lecture 3 Software Engineering and Design Introduction to UMLLecture 3 Software Engineering and Design Introduction to UML
Lecture 3 Software Engineering and Design Introduction to UML
 
Alam Mistik
Alam MistikAlam Mistik
Alam Mistik
 
Pasti
PastiPasti
Pasti
 
Hobby - Photos Myself
Hobby - Photos MyselfHobby - Photos Myself
Hobby - Photos Myself
 
Heidi Miller Portfolio Samples
Heidi Miller Portfolio SamplesHeidi Miller Portfolio Samples
Heidi Miller Portfolio Samples
 
Week 6 - Trigonometry
Week 6 - TrigonometryWeek 6 - Trigonometry
Week 6 - Trigonometry
 
Warehouse Center presentation, AsstrA 2009
Warehouse Center presentation, AsstrA 2009Warehouse Center presentation, AsstrA 2009
Warehouse Center presentation, AsstrA 2009
 
Serengeti
SerengetiSerengeti
Serengeti
 
Cio 2008
Cio 2008Cio 2008
Cio 2008
 
Collaboration Proposel
Collaboration ProposelCollaboration Proposel
Collaboration Proposel
 
DiffCalculus: September 11, 2012
DiffCalculus: September 11, 2012DiffCalculus: September 11, 2012
DiffCalculus: September 11, 2012
 
Organi-Deviance Part I
Organi-Deviance Part IOrgani-Deviance Part I
Organi-Deviance Part I
 
Speak Sooner Client Presentation / Pitch
Speak Sooner Client Presentation / Pitch Speak Sooner Client Presentation / Pitch
Speak Sooner Client Presentation / Pitch
 
Guión 4 septiembre
Guión 4 septiembreGuión 4 septiembre
Guión 4 septiembre
 
NSTC Policy for Enabling the Development, Adoption and Use of Biometric Stand...
NSTC Policy for Enabling the Development, Adoption and Use of Biometric Stand...NSTC Policy for Enabling the Development, Adoption and Use of Biometric Stand...
NSTC Policy for Enabling the Development, Adoption and Use of Biometric Stand...
 
Intrumens medivals
Intrumens medivalsIntrumens medivals
Intrumens medivals
 
What is I2 Final-Approved
What is I2 Final-ApprovedWhat is I2 Final-Approved
What is I2 Final-Approved
 
Meet my brother
Meet my brotherMeet my brother
Meet my brother
 
The fdi_report_2014
The fdi_report_2014The fdi_report_2014
The fdi_report_2014
 

Semelhante a Lecture 4 Software Engineering and Design Brief Introduction to Programming

Abstract & Interface
Abstract & InterfaceAbstract & Interface
Abstract & InterfaceLinh Lê
 
Polymorphism and Virtual Functions ppt bioinformatics
Polymorphism and Virtual Functions ppt bioinformaticsPolymorphism and Virtual Functions ppt bioinformatics
Polymorphism and Virtual Functions ppt bioinformaticsPriyanshuMittal31
 
Using Contexts & Dependency Injection in the Java EE 6 Platform
Using Contexts & Dependency Injection in the Java EE 6 PlatformUsing Contexts & Dependency Injection in the Java EE 6 Platform
Using Contexts & Dependency Injection in the Java EE 6 PlatformArun Gupta
 
Csharp4 inheritance
Csharp4 inheritanceCsharp4 inheritance
Csharp4 inheritanceAbed Bukhari
 
Multiple interfaces 9 cm604.31
Multiple interfaces 9 cm604.31Multiple interfaces 9 cm604.31
Multiple interfaces 9 cm604.31myrajendra
 
Spark IT 2011 - Context & Dependency Injection in the Java EE 6 Ecosystem
Spark IT 2011 - Context & Dependency Injection in the Java EE 6 EcosystemSpark IT 2011 - Context & Dependency Injection in the Java EE 6 Ecosystem
Spark IT 2011 - Context & Dependency Injection in the Java EE 6 EcosystemArun Gupta
 
Parsley & Flex
Parsley & FlexParsley & Flex
Parsley & Flexprideconan
 
Constructors.16
Constructors.16Constructors.16
Constructors.16myrajendra
 
Java session05
Java session05Java session05
Java session05Niit Care
 
Oop04 6
Oop04 6Oop04 6
Oop04 6schwaa
 
21UCAC31 Java Programming.pdf(MTNC)(BCA)
21UCAC31 Java Programming.pdf(MTNC)(BCA)21UCAC31 Java Programming.pdf(MTNC)(BCA)
21UCAC31 Java Programming.pdf(MTNC)(BCA)ssuser7f90ae
 
Java rmi example program with code
Java rmi example program with codeJava rmi example program with code
Java rmi example program with codekamal kotecha
 
Inheritance
InheritanceInheritance
InheritanceTech_MX
 

Semelhante a Lecture 4 Software Engineering and Design Brief Introduction to Programming (20)

Abstract & Interface
Abstract & InterfaceAbstract & Interface
Abstract & Interface
 
Oopvspro
OopvsproOopvspro
Oopvspro
 
Interfaces c#
Interfaces c#Interfaces c#
Interfaces c#
 
Dacj 2-1 a
Dacj 2-1 aDacj 2-1 a
Dacj 2-1 a
 
Polymorphism and Virtual Functions ppt bioinformatics
Polymorphism and Virtual Functions ppt bioinformaticsPolymorphism and Virtual Functions ppt bioinformatics
Polymorphism and Virtual Functions ppt bioinformatics
 
Using Contexts & Dependency Injection in the Java EE 6 Platform
Using Contexts & Dependency Injection in the Java EE 6 PlatformUsing Contexts & Dependency Injection in the Java EE 6 Platform
Using Contexts & Dependency Injection in the Java EE 6 Platform
 
Csharp4 inheritance
Csharp4 inheritanceCsharp4 inheritance
Csharp4 inheritance
 
Multiple interfaces 9 cm604.31
Multiple interfaces 9 cm604.31Multiple interfaces 9 cm604.31
Multiple interfaces 9 cm604.31
 
JAVA.pptx
JAVA.pptxJAVA.pptx
JAVA.pptx
 
Spark IT 2011 - Context & Dependency Injection in the Java EE 6 Ecosystem
Spark IT 2011 - Context & Dependency Injection in the Java EE 6 EcosystemSpark IT 2011 - Context & Dependency Injection in the Java EE 6 Ecosystem
Spark IT 2011 - Context & Dependency Injection in the Java EE 6 Ecosystem
 
Parsley & Flex
Parsley & FlexParsley & Flex
Parsley & Flex
 
CDI in JEE6
CDI in JEE6CDI in JEE6
CDI in JEE6
 
Hexagonal architecture
Hexagonal architectureHexagonal architecture
Hexagonal architecture
 
Java
JavaJava
Java
 
Constructors.16
Constructors.16Constructors.16
Constructors.16
 
Java session05
Java session05Java session05
Java session05
 
Oop04 6
Oop04 6Oop04 6
Oop04 6
 
21UCAC31 Java Programming.pdf(MTNC)(BCA)
21UCAC31 Java Programming.pdf(MTNC)(BCA)21UCAC31 Java Programming.pdf(MTNC)(BCA)
21UCAC31 Java Programming.pdf(MTNC)(BCA)
 
Java rmi example program with code
Java rmi example program with codeJava rmi example program with code
Java rmi example program with code
 
Inheritance
InheritanceInheritance
Inheritance
 

Mais de op205

3 f6 security
3 f6 security3 f6 security
3 f6 securityop205
 
3 f6 11_softdevmethodologies
3 f6 11_softdevmethodologies3 f6 11_softdevmethodologies
3 f6 11_softdevmethodologiesop205
 
3 f6 8_databases
3 f6 8_databases3 f6 8_databases
3 f6 8_databasesop205
 
3 f6 9a_corba
3 f6 9a_corba3 f6 9a_corba
3 f6 9a_corbaop205
 
3 f6 9a_corba
3 f6 9a_corba3 f6 9a_corba
3 f6 9a_corbaop205
 
3 f6 9_distributed_systems
3 f6 9_distributed_systems3 f6 9_distributed_systems
3 f6 9_distributed_systemsop205
 
Lecture 7 Software Engineering and Design User Interface Design
Lecture 7 Software Engineering and Design User Interface Design Lecture 7 Software Engineering and Design User Interface Design
Lecture 7 Software Engineering and Design User Interface Design op205
 
Lecture 6 Software Engineering and Design Good Design
Lecture 6 Software Engineering and Design Good Design Lecture 6 Software Engineering and Design Good Design
Lecture 6 Software Engineering and Design Good Design op205
 
Lecture 5 Software Engineering and Design Design Patterns
Lecture 5 Software Engineering and Design Design PatternsLecture 5 Software Engineering and Design Design Patterns
Lecture 5 Software Engineering and Design Design Patternsop205
 
Lecture 2 Software Engineering and Design Object Oriented Programming, Design...
Lecture 2 Software Engineering and Design Object Oriented Programming, Design...Lecture 2 Software Engineering and Design Object Oriented Programming, Design...
Lecture 2 Software Engineering and Design Object Oriented Programming, Design...op205
 
Lecture 1 Software Engineering and Design Introduction
Lecture 1 Software Engineering and Design Introduction Lecture 1 Software Engineering and Design Introduction
Lecture 1 Software Engineering and Design Introduction op205
 
More on DFT
More on DFTMore on DFT
More on DFTop205
 
Digital Signal Processing Summary
Digital Signal Processing SummaryDigital Signal Processing Summary
Digital Signal Processing Summaryop205
 
Implementation of Digital Filters
Implementation of Digital FiltersImplementation of Digital Filters
Implementation of Digital Filtersop205
 
Basics of Analogue Filters
Basics of Analogue FiltersBasics of Analogue Filters
Basics of Analogue Filtersop205
 
Design of IIR filters
Design of IIR filtersDesign of IIR filters
Design of IIR filtersop205
 
Design of FIR filters
Design of FIR filtersDesign of FIR filters
Design of FIR filtersop205
 
Basics of Digital Filters
Basics of Digital FiltersBasics of Digital Filters
Basics of Digital Filtersop205
 
Introduction to Digital Signal Processing
Introduction to Digital Signal ProcessingIntroduction to Digital Signal Processing
Introduction to Digital Signal Processingop205
 
Fast Fourier Transform
Fast Fourier TransformFast Fourier Transform
Fast Fourier Transformop205
 

Mais de op205 (20)

3 f6 security
3 f6 security3 f6 security
3 f6 security
 
3 f6 11_softdevmethodologies
3 f6 11_softdevmethodologies3 f6 11_softdevmethodologies
3 f6 11_softdevmethodologies
 
3 f6 8_databases
3 f6 8_databases3 f6 8_databases
3 f6 8_databases
 
3 f6 9a_corba
3 f6 9a_corba3 f6 9a_corba
3 f6 9a_corba
 
3 f6 9a_corba
3 f6 9a_corba3 f6 9a_corba
3 f6 9a_corba
 
3 f6 9_distributed_systems
3 f6 9_distributed_systems3 f6 9_distributed_systems
3 f6 9_distributed_systems
 
Lecture 7 Software Engineering and Design User Interface Design
Lecture 7 Software Engineering and Design User Interface Design Lecture 7 Software Engineering and Design User Interface Design
Lecture 7 Software Engineering and Design User Interface Design
 
Lecture 6 Software Engineering and Design Good Design
Lecture 6 Software Engineering and Design Good Design Lecture 6 Software Engineering and Design Good Design
Lecture 6 Software Engineering and Design Good Design
 
Lecture 5 Software Engineering and Design Design Patterns
Lecture 5 Software Engineering and Design Design PatternsLecture 5 Software Engineering and Design Design Patterns
Lecture 5 Software Engineering and Design Design Patterns
 
Lecture 2 Software Engineering and Design Object Oriented Programming, Design...
Lecture 2 Software Engineering and Design Object Oriented Programming, Design...Lecture 2 Software Engineering and Design Object Oriented Programming, Design...
Lecture 2 Software Engineering and Design Object Oriented Programming, Design...
 
Lecture 1 Software Engineering and Design Introduction
Lecture 1 Software Engineering and Design Introduction Lecture 1 Software Engineering and Design Introduction
Lecture 1 Software Engineering and Design Introduction
 
More on DFT
More on DFTMore on DFT
More on DFT
 
Digital Signal Processing Summary
Digital Signal Processing SummaryDigital Signal Processing Summary
Digital Signal Processing Summary
 
Implementation of Digital Filters
Implementation of Digital FiltersImplementation of Digital Filters
Implementation of Digital Filters
 
Basics of Analogue Filters
Basics of Analogue FiltersBasics of Analogue Filters
Basics of Analogue Filters
 
Design of IIR filters
Design of IIR filtersDesign of IIR filters
Design of IIR filters
 
Design of FIR filters
Design of FIR filtersDesign of FIR filters
Design of FIR filters
 
Basics of Digital Filters
Basics of Digital FiltersBasics of Digital Filters
Basics of Digital Filters
 
Introduction to Digital Signal Processing
Introduction to Digital Signal ProcessingIntroduction to Digital Signal Processing
Introduction to Digital Signal Processing
 
Fast Fourier Transform
Fast Fourier TransformFast Fourier Transform
Fast Fourier Transform
 

Último

4.11.24 Mass Incarceration and the New Jim Crow.pptx
4.11.24 Mass Incarceration and the New Jim Crow.pptx4.11.24 Mass Incarceration and the New Jim Crow.pptx
4.11.24 Mass Incarceration and the New Jim Crow.pptxmary850239
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfPatidar M
 
Congestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentationCongestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentationdeepaannamalai16
 
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptxDIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptxMichelleTuguinay1
 
Scientific Writing :Research Discourse
Scientific  Writing :Research  DiscourseScientific  Writing :Research  Discourse
Scientific Writing :Research DiscourseAnita GoswamiGiri
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfJemuel Francisco
 
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...Nguyen Thanh Tu Collection
 
Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxGrade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxkarenfajardo43
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfVanessa Camilleri
 
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptxDecoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptxDhatriParmar
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4JOYLYNSAMANIEGO
 
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnv
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnvESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnv
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnvRicaMaeCastro1
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptxmary850239
 
week 1 cookery 8 fourth - quarter .pptx
week 1 cookery 8  fourth  -  quarter .pptxweek 1 cookery 8  fourth  -  quarter .pptx
week 1 cookery 8 fourth - quarter .pptxJonalynLegaspi2
 
Expanded definition: technical and operational
Expanded definition: technical and operationalExpanded definition: technical and operational
Expanded definition: technical and operationalssuser3e220a
 
Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...
Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...
Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...DhatriParmar
 
MS4 level being good citizen -imperative- (1) (1).pdf
MS4 level   being good citizen -imperative- (1) (1).pdfMS4 level   being good citizen -imperative- (1) (1).pdf
MS4 level being good citizen -imperative- (1) (1).pdfMr Bounab Samir
 
ClimART Action | eTwinning Project
ClimART Action    |    eTwinning ProjectClimART Action    |    eTwinning Project
ClimART Action | eTwinning Projectjordimapav
 

Último (20)

4.11.24 Mass Incarceration and the New Jim Crow.pptx
4.11.24 Mass Incarceration and the New Jim Crow.pptx4.11.24 Mass Incarceration and the New Jim Crow.pptx
4.11.24 Mass Incarceration and the New Jim Crow.pptx
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdf
 
Congestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentationCongestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentation
 
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptxDIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
 
Scientific Writing :Research Discourse
Scientific  Writing :Research  DiscourseScientific  Writing :Research  Discourse
Scientific Writing :Research Discourse
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
 
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
 
Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxGrade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdf
 
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptxDecoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4
 
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnv
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnvESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnv
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnv
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx
 
week 1 cookery 8 fourth - quarter .pptx
week 1 cookery 8  fourth  -  quarter .pptxweek 1 cookery 8  fourth  -  quarter .pptx
week 1 cookery 8 fourth - quarter .pptx
 
Expanded definition: technical and operational
Expanded definition: technical and operationalExpanded definition: technical and operational
Expanded definition: technical and operational
 
Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...
Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...
Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...
 
MS4 level being good citizen -imperative- (1) (1).pdf
MS4 level   being good citizen -imperative- (1) (1).pdfMS4 level   being good citizen -imperative- (1) (1).pdf
MS4 level being good citizen -imperative- (1) (1).pdf
 
ClimART Action | eTwinning Project
ClimART Action    |    eTwinning ProjectClimART Action    |    eTwinning Project
ClimART Action | eTwinning Project
 
Faculty Profile prashantha K EEE dept Sri Sairam college of Engineering
Faculty Profile prashantha K EEE dept Sri Sairam college of EngineeringFaculty Profile prashantha K EEE dept Sri Sairam college of Engineering
Faculty Profile prashantha K EEE dept Sri Sairam college of Engineering
 

Lecture 4 Software Engineering and Design Brief Introduction to Programming

  • 1. OO Programming Languages Syntax Exceptions Handling Elena Punskaya, op205@cam.ac.uk 1
  • 2. OO in Java //abstract class declaration • Abstract class defines public abstract class Account { shared implementation private int mAccountNumber; //constructor public Account(int accountNumber) • Methods declared Abstract { mAccountNumber = accountNumber; MUST be implemented by } // abstract method declaration subclasses public abstract void credit(Amount amount); } • Interface can only define //interface declaration method signatures public interface IVerifiable { (names, parameters, //declaring the interface method public boolean isVerified(); output) and no } implementation //PayPal derives from Account and realises IVerifiable public class PayPalAccount extends Account implements IVerifiable { • Classes can Extend other //constructor, calls the superclass public PayPalAccount(int accountNumber) classes and Implement { super(accountNumber); interfaces } //implementation of the abstract method public void credit(Amount amount) • By default, all class { //send money to PayPal methods can be overridden } //implementation of the interface method (extended/implemented) public boolean isVerified() { in the subclasses //do check and return result } } © 2012 Elena Punskaya 2 Cambridge University Engineering Department 2
  • 3. OO in C# //abstract class declaration • Very similar to Java public abstract class Account { syntax and concepts, but private int mAccountNumber; //constructor also some differences public Account(int accountNumber) { mAccountNumber = accountNumber; • Any non-abstract class } // abstract method declaration methods have to be public abstract void credit(Amount amount); explicitly declared virtual } so can be overridden //interface declaration public interface IVerifiable (extended/implemented) { //declaring the interface method in the subclasses } public boolean isVerified(); • C# vs Java comparison: //PayPal derives from Account and realises IVerifiable public class PayPalAccount extends :Account, implements IVerifiable { - http://msdn.microsoft.com/en-us/ //constructor, calls the superclass library/ms836794.aspx public PayPalAccount(int accountNumber) : base(accountNumber) { super(accountNumber); } //implementation of the abstract method public void credit(Amount amount) { //send money to PayPal } //implementation of the interface method public boolean isVerified() { //do check and return result } } © 2012 Elena Punskaya 3 Cambridge University Engineering Department 3
  • 4. OO in C++ //class declaration • Methods need to be class Account { declared virtual to be //declaring all publicly accessible methods/attributes public: extended (as in C#) //constructor Account(int accountNumber) { • Pure virtual methods mAccountNumber = accountNumber; } (ending declarations with // abstract method declaration “=0”) are equivalent to virtual void credit(Amount amount) = 0; abstract methods in Java private: int mAccountNumber; }; • No dedicated concept of //interface (equivalent) declaration Interfaces, but same class IVerifiable { effect is achieved by //pure virtual (abstract) method declaration public: defining a class that } virtual bool isVerified() = 0; contains pure virtual //PayPal derives from Account and IVerifiable methods only public class PayPalAccount : public Account, public IVerifiable { public: • C++ and Java differences //constructor, calls the superclass PayPalAccount(int accountNumber):Account(accountNumber) - http://www.cprogramming.com/ { } tutorial/java/syntax-differences- //declaring the implementation java-c++.html virtual void credit(Amount amount); //declaring the implementation virtual bool isVerified(); } © 2012 Elena Punskaya 4 Cambridge University Engineering Department 4
  • 5. Error Handling • All software encounters error conditions during // add error reporting to code that can fail operations public int doSomethingRisky() { • Good software will <..> if (problemNumber1Happened) manage error situations return 1; gracefully and robustly else if (problemNumber2Happened) return 2; else • Error handling has to be return 0; //all good implemented in the code } //using this method, need to build in checks • A standard option from int result = riskyAction.doSomethingRisky(); procedural languages – if (result == 0) { Error Codes //All good, can proceed } • Main idea: else if(result == 1) { - use a code to indicate some //handle Problem1 } specific error else if(result == 2) - make the function to return a { code //handle Problem2 } - check the return code if it is OK or error © 2012 Elena Punskaya 5 Cambridge University Engineering Department 5
  • 6. Exceptions • Errors such as the above represent exceptions to the // add error reporting to code that can fail normal program flow. public void doSomethingRisky() { • Handling exceptions via return <..> if (problemNumber1Happened) codes has a number of //throw forces us to exit the current disadvantages: //method and returns an exception object throw problemNumber1Exception; - Extra code needs to be inserted in each else if (problemNumber2Happened) function to pass the errors back. throw problemNumber2Exception; } - If one function fails to check for errors and pass them back, the errors will not get //using this method, wrap it in try/catch block handled //to catch returned exceptions try - The extra error checking obscures the main { function of the code, making it difficult to riskyAction.doSomethingRisky(); } understand catch (ProblemNumber1Exception error) - Error recovery code becomes intertwined { with the normal operation code //handle Problem1 } - Functions cannot use return values for catch (ProblemNumber2Exception error) normal purposes { //handle Problem2 • There is another way... } • Exceptions! © 2012 Elena Punskaya 6 Cambridge University Engineering Department 6
  • 7. Exceptions • C++ example //C++ class to define Exceptions class TradingErr { TradingErr (ErrType ee, Time tt) {e=ee; t=tt;} • Using exceptions, the code is ErrType e; Time t; easier to follow because the }; //main program method error handling parts are int main() { try { clearly separated from the <..> regular program flow //MyTrader() can re-throw an exception MyTrader(); <..> • An exception handler can //Exception handling throw the exception again } catch (TradingError x) { ReportError(x.e, x.t); allowing some errors to be } } trapped and repaired and //------------------------------------------------ others to be propagated, e.g. void MyTrader() { <..> from TE_GetPrice() to //code that can re-throw an exception MyTrader() to the main float price = TE_GetPrice(day); <..> method, where it is handled } //------------------------------------------------ • Exceptions should REALLY be float TE_GetPrice(int day) { <..> exceptional and not be a part //code that can throw an exception if (!Valid(day)) of normal program flow throw TradingErr(BAD_DAY,TimeNow()); <..> } © 2012 Elena Punskaya 7 Cambridge University Engineering Department 7
  • 8. No Code Wars! – Tools for the Job • Debating comparative advantages and disadvantages of programming languages makes a good (if often heated) conversation, but in reality the choice of the language is often dictated by the application! • For example, in mobile application development: - Android, Blackberry, J2ME: Java - iPhone: Objective-C - Windows Phone: C# - Symbian (RIP): C++ • Being proficient in a range of languages helps Source: http://www.rackspace.com/cloud/blog/2011/05/17/infographic-evolution-of- computer-languages/ © 2012 Elena Punskaya 8 Cambridge University Engineering Department 8