Software Engineering

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    Favorites, Groups & Events

    Software Engineering - Presentation Transcript

    1. Software Engineering Robbie Clutton
    2. readme.txt
      • Started City University 2001
      • Did industrial placement with Lloyds TSB 2003-2004
        • Coding Cobol 74, editing code written before I was born!
      • Graduated Software Engineering BEng 2005
      • Joined BT graduate scheme
    3. readme.txt
      • SDK to access BT Web Services in .NET C#
      • Worked with customers to build prototypes against BT Web Services
      • RESTful website using Ruby on Rails
      • SIP Application Server to support BT Web Services using Java
      • IVR Web Service using SIP A/S using Java
      • Website using PHP
    4. Unit Testing
      • Tests a unit of code (e.g. a method)
      • Doing the simplest thing that could possibly work
      • Living documentation
      • Allows refactoring
      • Assert upon the correctness of the application
    5. @Test public void testHelloWorld(){ // setup HelloWorld helloWorld = new HelloWorld(); // act String result = helloWorld.sayHello(); // assert assertEquals("Hello", result); }
      • package com.iclutton.seday;
      • public class HelloWorld {
        • public String sayHello() {
        • return language.sayHello();
        • }
      • }
      • Benefits unit testing
      • Makes code cleaner
      Interfaces
    6. package com.iclutton.seday.language; public interface Language { String sayHello(); } package com.iclutton.seday.language; public class English implements Language{ @Override public String sayHello() { return "Hello"; } } package com.iclutton.seday.language; public class French implements Language{ @Override public String sayHello(){ return "Bonjour"; } }
    7. Mocking
      • Useful when you want to ‘mock’ out external dependencies
        • Databases
        • Web services
        • Etc
      • Useful for simulating error conditions and handling
      • @Test
      • public void testHelloWorldWithMock(){
        • // setup
        • English english = mock(English. class);
        • when(english.sayHello()).thenReturn("Alright");
        • HelloWorld helloWorld = new HelloWorld();
        • helloWorld.setLanguage(english);
        • // act
        • String result = helloWorld.sayHello();
        • // assert
        • assertEquals("Alright", result);
        • verify(english).sayHello();
      • }
      • @Test(expected=IllegalStateException. class)
      • public void testHelloWorldWithMockException(){
        • // setup
        • English english = mock(English. class);
        • when(english.sayHello()).thenThrow( new RuntimeException());
        • HelloWorld helloWorld = new HelloWorld();
        • helloWorld.setLanguage(english);
        • // act
        • helloWorld.sayHello();
        • // assert - see exception annotation
      • }
    8. Dependency Injection
      • We’ve already seen dependency injection
      • Now let’s look at Spring, which supports
        • Reduces complexities of using interfaces
        • Great way to configure applications
        • Promotes the use of singletons
        • Improves testability
    9. <bean id=&quot;language&quot; class=&quot;com.iclutton.seday.language.English&quot;/> <bean id=&quot;hello&quot; class=&quot;com.iclutton.seday.HelloWorld&quot;> <property name=&quot;language&quot; ref=&quot;language&quot;/> </bean> @Test public void testSpring(){ // setup ApplicationContext applicationContext = new ClassPathXmlApplicationContext(&quot;applicationContext.xml&quot;); HelloWorld helloWorld = (HelloWorld)applicationContext.getBean(&quot;hello&quot;); // act String result = helloWorld.sayHello(); // assert assertEquals(&quot;Hello&quot;, result); }
    10. Build Scripts
      • Manual processes are more error prone
      • Build scripts bring consistency and automation
      • There are many varieties
        • Ant (Java)
        • nAnt (.NET)
        • Make (C/C++)
        • Rake (Ruby)
        • etc
    11. Property Driven Builds
      • Useful when more that one person becomes involved
      • Or deploying to different environments
    12. Source Control
    13. Automating the Build
      • Continuous Integration
    14. Logging
      • Until you support an application you’ve built you will never know the value of logging
    15. # Root category log4j.rootLogger=DEBUG, stdout log4j.logger.com.iclutton.seday=DEBUG # CONSOLE log4j.appender.stdout.Threshold=DEBUG log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=%d %X{stackname}[%t] %-5p [%C {1}.%M() %L] - %m%n 2008-11-18 18:06:39,953 [main] DEBUG [AbstractAutowireCapableBeanFactory$1.run() 411] - Finished creating instance of bean 'hello' 2008-11-18 18:06:39,953 [main] DEBUG [AbstractApplicationContext.publishEvent() 273] - Publishing event in context [org.springframework.context.support.ClassPathXmlApplicationContext@1e845c2]: org.springframework.context.event.ContextRefreshedEvent[source=org.springframework.context.support.ClassPathXmlApplicationContext@1e845c2: display name [org.springframework.context.support.ClassPathXmlApplicationContext@1e845c2]; startup date [Tue Nov 18 18:06:39 GMT 2008]; root of context hierarchy] 2008-11-18 18:06:39,953 [main] DEBUG [AbstractBeanFactory.doGetBean() 214] - Returning cached instance of singleton bean 'hello'
    16. Q&A

    + robb1erobb1e, 2 years ago

    custom

    399 views, 0 favs, 0 embeds more stats

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 399
      • 399 on SlideShare
      • 0 from embeds
    • Comments 0
    • Favorites 0
    • Downloads 11
    Most viewed embeds

    more

    All embeds

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories