SlideShare a Scribd company logo
1 of 21
Download to read offline
Simple
Pure
Java


                    Anton Keks
             anton@codeborne.com
          
The Enterprise...
           
Enterprise Architecture
    20 years ago a new field was born, addressing

    System complexity = more and more
        money for building IT systems

Poor business alignment = more difficult
  to keep those increasingly expensive
   systems aligned with business need

       A problem of more cost, less value
     Today: even more cost, even less value
                           
Complexity


            
!
         O
      BO
 
    ☠   
Your average Java (web) app
    ●   Framework (JSF?)
    ●   Model
    ●   Portal?
    ●   Services!
    ●   Remote services, SOA, EJB
    ●   JNDI
    ●   Stubs, generated code
    ●   How many layers?
                            
...
    ●   Patterns!
    ●   Factory, Singleton, Facade
    ●   Enterprise patterns!
    ●   DTO, DAO, etc
    ●   Getters/setters
         (what's the deal - generate 'em)
    ●   JPA, JAXB
    ●   JMS!

                            
Bad words

     Layer          Tier    Bus
           Context     Manager
     Locator     Assembler    Bean
             Broker      Facade
       Transfer Object    DAO
                 …
    It's always nice to see guys like
       SessionServiceContextManager
    or AbstractStrategyFactoryProxyFacadeBuilder
                             
EAR, WAR, WAR, WAR
      Configuration, descriptors!
                  JNDI!
                 ESB? ;-)

    Must be a wizard to make it all run!
      Improves job security index :-)
                     
For a small thing we create
    ●   ManagedBean
    ●   MegaServiceWrapper
    ●   CoreServiceLocal, Stub (JNDI lookup?)
    ●   CoreService (&& CoreServiceImpl)
    ●   AggregatedService
    ●   ConcreteService
    ●   ConcreteDAO
    ●   JPAAdapter
 
    ●   ...                  
The result?                             ☠
    ●   It kills productivity
    ●   Thousands lines of code, very few
         functionality
    ●   Well hidden ”business logic”
    ●   N minute deploy time (+ N minutes app
         server startup)
    ●   Oops, sometimes redeploy doesn't work,
         need to restart
    ●   Slow UI responsivness
                                 
What to do?
    ●   Concentrate on domain terminology
          ●   This was the intention of OOP


    ●   Avoid overly defensive code
          ●   You are not writing a framework!
          ●   Fellow developers are friends


    ●   Follow Clean Code by Robert C. Martin

                                
Java platform and language
    ●   Java (EE) is a victim of JCP
           ●   Many unreal/unusable JSRs
    ●   Stick to proven open-source stuff
           ●   Less standards – the better
    ●   Java language is ok
           ●   The biggest miss are closures
           ●   DSLs are possible: Mockito, LambdaJ
           ●   Don't bloat (generate) your code


                                 
Code style
    ●   Is your code style limiting readability?
           ●   Avoid too many line breaks and braces
           ●   Emphasize what is important

        public int   size() {              public int size() {
          if (root   == null) {              if (root == null) return 0;
            return   0;                      return root.numSiblings();
          }                                }
          else {
            return   root.numSiblings();
          }
                                           public int size() {
        }
                                             return root != null ?
                                               root.numSiblings() : 0;
                                           }

                                       
Code style
    ●   Avoid over-indenation (or code ladder)
        public void startCharging() {
          if (customer.hasFunds()) {
            if (!station.isCharging()) {
              if (!station.currentlyBooked()) {
                reallyStartCharging();
                return;
              }
            }
          }
          throw new UnableToStartException();
        }
                          public void startCharging() {
                            if (!customer.hasFunds()) throw new UnableToSta
                            if (station.isCharging()) throw new UnableToSta
                            if (station.currentlyBooked()) throw new Unable

                             reallyStartCharging();
                         }
                                       
Code style
    ●   Prefer shorter code (use static imports)
        List<Integer> list = Arrays.asList(1, 2, 3));
        list = Collections.unmodifieableList(list);
        return list;

        import static java.util.Arrays.*;
        import static java.util.Collections.*;
        ...

        return unmodifiableList(asList(1, 2, 3))

        Looks a bit like functional programming, isn't it?

                                  
Code style
    ●   Prefer good naming to comments
    ●   Avoid getters/setters, equals, hashCode,
         toString unless necessary
    ●   Break free from 'conventions'
    ●   Work towards a DSL

        when(session.currentUser()).thenReturn(fakeUser);

        assertThat(person.age, is(25));

        sort(people, on(Person.class).getAge());

                                 
Proper Java app
    ●   Jetty Launcher (esp in development)
    ●   Know the APIs well: servlets, filters, etc
    ●   Avoid vendor-specific stuff
    ●   Keep environment-specific configuration
         in version control
    ●   Dependency Injection
    ●   Avoid scattering cross-cutting concerns
    ●   DB migrations (w/ liquibase/dbdeploy)

 
    ●   Start thin and simple, prefer higher SNR
                             
Web UI
    ●   Your framework tells you don't need to
         know JavaScript? (GWT, JSF, etc)
    ●   B.S.!
    ●   Keep it under control: learn basics of
         JQuery instead
    ●   Knockout.js, Backbone.js can help
    ●   You are not limited with Java syntax on
         the client side :-)

                             
Worth reminding...

    ● Don't Repeat Yourself
    ● Keep It Simple Stupid


    ● You Ain't Gonna Need It


    ● Test Driven Development




                     
Let's continue on
github:
github.com/angryziber/simple-java




job@codeborne.com
                     

More Related Content

What's hot

Непрерывное тестирование для улучшения качества кода
Непрерывное тестирование для улучшения качества кодаНепрерывное тестирование для улучшения качества кода
Непрерывное тестирование для улучшения качества кодаSQALab
 
Java Presentation
Java PresentationJava Presentation
Java PresentationAmr Salah
 
Javascript training sample
Javascript training sampleJavascript training sample
Javascript training sampleprahalad_das_in
 
1 java programming- introduction
1  java programming- introduction1  java programming- introduction
1 java programming- introductionjyoti_lakhani
 
An Introduction to Java Compiler and Runtime
An Introduction to Java Compiler and RuntimeAn Introduction to Java Compiler and Runtime
An Introduction to Java Compiler and RuntimeOmar Bashir
 
Java introduction
Java introductionJava introduction
Java introductionSagar Verma
 
Ola Bini J Ruby Power On The Jvm
Ola Bini J Ruby Power On The JvmOla Bini J Ruby Power On The Jvm
Ola Bini J Ruby Power On The Jvmdeimos
 
Java compilation
Java compilationJava compilation
Java compilationMike Kucera
 
Throwing complexity over the wall: Rapid development for enterprise Java (Jav...
Throwing complexity over the wall: Rapid development for enterprise Java (Jav...Throwing complexity over the wall: Rapid development for enterprise Java (Jav...
Throwing complexity over the wall: Rapid development for enterprise Java (Jav...Dan Allen
 
J2EE vs JavaEE
J2EE vs JavaEEJ2EE vs JavaEE
J2EE vs JavaEEeanimou
 
Scala: An experience report
Scala: An experience reportScala: An experience report
Scala: An experience reportMark Needham
 
XPDays Ukraine: Legacy
XPDays Ukraine: LegacyXPDays Ukraine: Legacy
XPDays Ukraine: LegacyVictor_Cr
 
How we tested our code "Google way"
How we tested our code "Google way"How we tested our code "Google way"
How we tested our code "Google way"Oleksiy Rezchykov
 
The Top 30 LotusScript Development Tips
The Top 30 LotusScript Development TipsThe Top 30 LotusScript Development Tips
The Top 30 LotusScript Development Tipsdominion
 
Introduction to java
Introduction to javaIntroduction to java
Introduction to javaSteve Fort
 
Java notes | All Basics |
Java notes | All Basics |Java notes | All Basics |
Java notes | All Basics |ShubhamAthawane
 
Acceptance Test Driven Development and Robot Framework
Acceptance Test Driven Development and Robot FrameworkAcceptance Test Driven Development and Robot Framework
Acceptance Test Driven Development and Robot FrameworkSteve Zhang
 
cf.Objective() 2017 - Design patterns - Brad Wood
cf.Objective() 2017 - Design patterns - Brad Woodcf.Objective() 2017 - Design patterns - Brad Wood
cf.Objective() 2017 - Design patterns - Brad WoodOrtus Solutions, Corp
 

What's hot (20)

Непрерывное тестирование для улучшения качества кода
Непрерывное тестирование для улучшения качества кодаНепрерывное тестирование для улучшения качества кода
Непрерывное тестирование для улучшения качества кода
 
Java Presentation
Java PresentationJava Presentation
Java Presentation
 
Javascript training sample
Javascript training sampleJavascript training sample
Javascript training sample
 
1 java programming- introduction
1  java programming- introduction1  java programming- introduction
1 java programming- introduction
 
An Introduction to Java Compiler and Runtime
An Introduction to Java Compiler and RuntimeAn Introduction to Java Compiler and Runtime
An Introduction to Java Compiler and Runtime
 
Java introduction
Java introductionJava introduction
Java introduction
 
Ola Bini J Ruby Power On The Jvm
Ola Bini J Ruby Power On The JvmOla Bini J Ruby Power On The Jvm
Ola Bini J Ruby Power On The Jvm
 
Java compilation
Java compilationJava compilation
Java compilation
 
Java 9, JShell, and Modularity
Java 9, JShell, and ModularityJava 9, JShell, and Modularity
Java 9, JShell, and Modularity
 
Throwing complexity over the wall: Rapid development for enterprise Java (Jav...
Throwing complexity over the wall: Rapid development for enterprise Java (Jav...Throwing complexity over the wall: Rapid development for enterprise Java (Jav...
Throwing complexity over the wall: Rapid development for enterprise Java (Jav...
 
J2EE vs JavaEE
J2EE vs JavaEEJ2EE vs JavaEE
J2EE vs JavaEE
 
Scala: An experience report
Scala: An experience reportScala: An experience report
Scala: An experience report
 
XPDays Ukraine: Legacy
XPDays Ukraine: LegacyXPDays Ukraine: Legacy
XPDays Ukraine: Legacy
 
TDD anche su iOS
TDD anche su iOSTDD anche su iOS
TDD anche su iOS
 
How we tested our code "Google way"
How we tested our code "Google way"How we tested our code "Google way"
How we tested our code "Google way"
 
The Top 30 LotusScript Development Tips
The Top 30 LotusScript Development TipsThe Top 30 LotusScript Development Tips
The Top 30 LotusScript Development Tips
 
Introduction to java
Introduction to javaIntroduction to java
Introduction to java
 
Java notes | All Basics |
Java notes | All Basics |Java notes | All Basics |
Java notes | All Basics |
 
Acceptance Test Driven Development and Robot Framework
Acceptance Test Driven Development and Robot FrameworkAcceptance Test Driven Development and Robot Framework
Acceptance Test Driven Development and Robot Framework
 
cf.Objective() 2017 - Design patterns - Brad Wood
cf.Objective() 2017 - Design patterns - Brad Woodcf.Objective() 2017 - Design patterns - Brad Wood
cf.Objective() 2017 - Design patterns - Brad Wood
 

Viewers also liked

解析データの分析と活用
解析データの分析と活用解析データの分析と活用
解析データの分析と活用Keisuke Anzai
 
3D printing for Development Hack Day in Bucharest, session 1
3D printing for Development Hack Day in Bucharest, session 13D printing for Development Hack Day in Bucharest, session 1
3D printing for Development Hack Day in Bucharest, session 1Asociatia Techsoup Romania
 
最新開発支援ツールを使ったデバッグ対応
最新開発支援ツールを使ったデバッグ対応最新開発支援ツールを使ったデバッグ対応
最新開発支援ツールを使ったデバッグ対応Osamu Monoe
 
デザイナーがエンジニアさんと楽しくデザイン実装の話をするために
デザイナーがエンジニアさんと楽しくデザイン実装の話をするためにデザイナーがエンジニアさんと楽しくデザイン実装の話をするために
デザイナーがエンジニアさんと楽しくデザイン実装の話をするためにChihiro Tomita
 
WordPressコミュニティの魅力 | OSC Nagoya 2012 WordBench Nagoya
WordPressコミュニティの魅力 | OSC Nagoya 2012 WordBench NagoyaWordPressコミュニティの魅力 | OSC Nagoya 2012 WordBench Nagoya
WordPressコミュニティの魅力 | OSC Nagoya 2012 WordBench Nagoyatakashi ono
 
マークアップエンジニア だからうれしい Fireworksの使い方あれこれ
マークアップエンジニア だからうれしい Fireworksの使い方あれこれマークアップエンジニア だからうれしい Fireworksの使い方あれこれ
マークアップエンジニア だからうれしい Fireworksの使い方あれこれNaoki Matsuda
 
Transformative Web Design ~変化にしなやかに対応するデザイン力~
Transformative Web Design ~変化にしなやかに対応するデザイン力~Transformative Web Design ~変化にしなやかに対応するデザイン力~
Transformative Web Design ~変化にしなやかに対応するデザイン力~Yasuhisa Hasegawa
 
Debugging mobile websites and web apps
Debugging mobile websites and web appsDebugging mobile websites and web apps
Debugging mobile websites and web appsMihai Corlan
 
リサーチャーとマーケター原稿2012326
リサーチャーとマーケター原稿2012326リサーチャーとマーケター原稿2012326
リサーチャーとマーケター原稿2012326Shigeru Kishikawa
 
WebフレームワークXSS対策の自動化
WebフレームワークXSS対策の自動化WebフレームワークXSS対策の自動化
WebフレームワークXSS対策の自動化Yoshihiro Ura
 
『デザイニング・インターフェース』読書会資料
『デザイニング・インターフェース』読書会資料『デザイニング・インターフェース』読書会資料
『デザイニング・インターフェース』読書会資料Noriyo Asano
 
Developing with Phonegap - Adobe Refresh 2012
Developing with Phonegap - Adobe Refresh 2012Developing with Phonegap - Adobe Refresh 2012
Developing with Phonegap - Adobe Refresh 2012Ryan Stewart
 
これから求められるWebコミュニケーションスキル 〜今日から始めるプロトタイプデザイン
これから求められるWebコミュニケーションスキル 〜今日から始めるプロトタイプデザインこれから求められるWebコミュニケーションスキル 〜今日から始めるプロトタイプデザイン
これから求められるWebコミュニケーションスキル 〜今日から始めるプロトタイプデザインYasuhisa Hasegawa
 
6 Key Elements to a Good Website
6 Key Elements to a Good Website6 Key Elements to a Good Website
6 Key Elements to a Good WebsiteWebs
 
デジタルインテリジェンスの「構想力」
デジタルインテリジェンスの「構想力」デジタルインテリジェンスの「構想力」
デジタルインテリジェンスの「構想力」Digital Intelligence Inc.
 
【16-D-4】3分ではじめるスマホアプリのビジュアル開発
【16-D-4】3分ではじめるスマホアプリのビジュアル開発【16-D-4】3分ではじめるスマホアプリのビジュアル開発
【16-D-4】3分ではじめるスマホアプリのビジュアル開発hmimura_embarcadero
 

Viewers also liked (20)

画像Hacks
画像Hacks画像Hacks
画像Hacks
 
解析データの分析と活用
解析データの分析と活用解析データの分析と活用
解析データの分析と活用
 
3D printing for Development Hack Day in Bucharest, session 1
3D printing for Development Hack Day in Bucharest, session 13D printing for Development Hack Day in Bucharest, session 1
3D printing for Development Hack Day in Bucharest, session 1
 
The Craft of UX
The Craft of UXThe Craft of UX
The Craft of UX
 
最新開発支援ツールを使ったデバッグ対応
最新開発支援ツールを使ったデバッグ対応最新開発支援ツールを使ったデバッグ対応
最新開発支援ツールを使ったデバッグ対応
 
デザイナーがエンジニアさんと楽しくデザイン実装の話をするために
デザイナーがエンジニアさんと楽しくデザイン実装の話をするためにデザイナーがエンジニアさんと楽しくデザイン実装の話をするために
デザイナーがエンジニアさんと楽しくデザイン実装の話をするために
 
WordPressコミュニティの魅力 | OSC Nagoya 2012 WordBench Nagoya
WordPressコミュニティの魅力 | OSC Nagoya 2012 WordBench NagoyaWordPressコミュニティの魅力 | OSC Nagoya 2012 WordBench Nagoya
WordPressコミュニティの魅力 | OSC Nagoya 2012 WordBench Nagoya
 
マークアップエンジニア だからうれしい Fireworksの使い方あれこれ
マークアップエンジニア だからうれしい Fireworksの使い方あれこれマークアップエンジニア だからうれしい Fireworksの使い方あれこれ
マークアップエンジニア だからうれしい Fireworksの使い方あれこれ
 
Transformative Web Design ~変化にしなやかに対応するデザイン力~
Transformative Web Design ~変化にしなやかに対応するデザイン力~Transformative Web Design ~変化にしなやかに対応するデザイン力~
Transformative Web Design ~変化にしなやかに対応するデザイン力~
 
Debugging mobile websites and web apps
Debugging mobile websites and web appsDebugging mobile websites and web apps
Debugging mobile websites and web apps
 
リサーチャーとマーケター原稿2012326
リサーチャーとマーケター原稿2012326リサーチャーとマーケター原稿2012326
リサーチャーとマーケター原稿2012326
 
WebフレームワークXSS対策の自動化
WebフレームワークXSS対策の自動化WebフレームワークXSS対策の自動化
WebフレームワークXSS対策の自動化
 
『デザイニング・インターフェース』読書会資料
『デザイニング・インターフェース』読書会資料『デザイニング・インターフェース』読書会資料
『デザイニング・インターフェース』読書会資料
 
Developing with Phonegap - Adobe Refresh 2012
Developing with Phonegap - Adobe Refresh 2012Developing with Phonegap - Adobe Refresh 2012
Developing with Phonegap - Adobe Refresh 2012
 
言語の世界
言語の世界言語の世界
言語の世界
 
これから求められるWebコミュニケーションスキル 〜今日から始めるプロトタイプデザイン
これから求められるWebコミュニケーションスキル 〜今日から始めるプロトタイプデザインこれから求められるWebコミュニケーションスキル 〜今日から始めるプロトタイプデザイン
これから求められるWebコミュニケーションスキル 〜今日から始めるプロトタイプデザイン
 
6 Key Elements to a Good Website
6 Key Elements to a Good Website6 Key Elements to a Good Website
6 Key Elements to a Good Website
 
JavaFX
JavaFXJavaFX
JavaFX
 
デジタルインテリジェンスの「構想力」
デジタルインテリジェンスの「構想力」デジタルインテリジェンスの「構想力」
デジタルインテリジェンスの「構想力」
 
【16-D-4】3分ではじめるスマホアプリのビジュアル開発
【16-D-4】3分ではじめるスマホアプリのビジュアル開発【16-D-4】3分ではじめるスマホアプリのビジュアル開発
【16-D-4】3分ではじめるスマホアプリのビジュアル開発
 

Similar to Simple Pure Java

Dart the Better JavaScript
Dart the Better JavaScriptDart the Better JavaScript
Dart the Better JavaScriptJorg Janke
 
"Xapi-lang For declarative code generation" By James Nelson
"Xapi-lang For declarative code generation" By James Nelson"Xapi-lang For declarative code generation" By James Nelson
"Xapi-lang For declarative code generation" By James NelsonGWTcon
 
Developing cross platform desktop application with Ruby
Developing cross platform desktop application with RubyDeveloping cross platform desktop application with Ruby
Developing cross platform desktop application with RubyAnis Ahmad
 
Road to sbt 1.0: Paved with server (2015 Amsterdam)
Road to sbt 1.0: Paved with server (2015 Amsterdam)Road to sbt 1.0: Paved with server (2015 Amsterdam)
Road to sbt 1.0: Paved with server (2015 Amsterdam)Eugene Yokota
 
[Td 2015] what is new in visual c++ 2015 and future directions(ulzii luvsanba...
[Td 2015] what is new in visual c++ 2015 and future directions(ulzii luvsanba...[Td 2015] what is new in visual c++ 2015 and future directions(ulzii luvsanba...
[Td 2015] what is new in visual c++ 2015 and future directions(ulzii luvsanba...Sang Don Kim
 
AOT-compilation of JavaScript with V8
AOT-compilation of JavaScript with V8AOT-compilation of JavaScript with V8
AOT-compilation of JavaScript with V8Phil Eaton
 
Productivity Enhencement with Visual Studio
Productivity Enhencement with Visual StudioProductivity Enhencement with Visual Studio
Productivity Enhencement with Visual StudioAhasan Habib
 
Java - A broad introduction
Java - A broad introductionJava - A broad introduction
Java - A broad introductionBirol Efe
 
Terence Barr - jdk7+8 - 24mai2011
Terence Barr - jdk7+8 - 24mai2011Terence Barr - jdk7+8 - 24mai2011
Terence Barr - jdk7+8 - 24mai2011Agora Group
 
Road to sbt 1.0 paved with server
Road to sbt 1.0   paved with serverRoad to sbt 1.0   paved with server
Road to sbt 1.0 paved with serverEugene Yokota
 
Java one 2015 [con3339]
Java one 2015 [con3339]Java one 2015 [con3339]
Java one 2015 [con3339]Arshal Ameen
 
Skiron - Experiments in CPU Design in D
Skiron - Experiments in CPU Design in DSkiron - Experiments in CPU Design in D
Skiron - Experiments in CPU Design in DMithun Hunsur
 
Real-world polyglot programming on the JVM - Ben Summers (ONEIS)
Real-world polyglot programming on the JVM  - Ben Summers (ONEIS)Real-world polyglot programming on the JVM  - Ben Summers (ONEIS)
Real-world polyglot programming on the JVM - Ben Summers (ONEIS)jaxLondonConference
 
An overview of node.js
An overview of node.jsAn overview of node.js
An overview of node.jsvaluebound
 
Java one 2010
Java one 2010Java one 2010
Java one 2010scdn
 
Scala on-android
Scala on-androidScala on-android
Scala on-androidlifecoder
 
Design Summit - UI Roadmap - Dan Clarizio, Martin Povolny
Design Summit - UI Roadmap - Dan Clarizio, Martin PovolnyDesign Summit - UI Roadmap - Dan Clarizio, Martin Povolny
Design Summit - UI Roadmap - Dan Clarizio, Martin PovolnyManageIQ
 

Similar to Simple Pure Java (20)

Dart the Better JavaScript
Dart the Better JavaScriptDart the Better JavaScript
Dart the Better JavaScript
 
"Xapi-lang For declarative code generation" By James Nelson
"Xapi-lang For declarative code generation" By James Nelson"Xapi-lang For declarative code generation" By James Nelson
"Xapi-lang For declarative code generation" By James Nelson
 
Developing cross platform desktop application with Ruby
Developing cross platform desktop application with RubyDeveloping cross platform desktop application with Ruby
Developing cross platform desktop application with Ruby
 
Road to sbt 1.0: Paved with server (2015 Amsterdam)
Road to sbt 1.0: Paved with server (2015 Amsterdam)Road to sbt 1.0: Paved with server (2015 Amsterdam)
Road to sbt 1.0: Paved with server (2015 Amsterdam)
 
[Td 2015] what is new in visual c++ 2015 and future directions(ulzii luvsanba...
[Td 2015] what is new in visual c++ 2015 and future directions(ulzii luvsanba...[Td 2015] what is new in visual c++ 2015 and future directions(ulzii luvsanba...
[Td 2015] what is new in visual c++ 2015 and future directions(ulzii luvsanba...
 
AOT-compilation of JavaScript with V8
AOT-compilation of JavaScript with V8AOT-compilation of JavaScript with V8
AOT-compilation of JavaScript with V8
 
Old code doesn't stink
Old code doesn't stinkOld code doesn't stink
Old code doesn't stink
 
Productivity Enhencement with Visual Studio
Productivity Enhencement with Visual StudioProductivity Enhencement with Visual Studio
Productivity Enhencement with Visual Studio
 
Java - A broad introduction
Java - A broad introductionJava - A broad introduction
Java - A broad introduction
 
Terence Barr - jdk7+8 - 24mai2011
Terence Barr - jdk7+8 - 24mai2011Terence Barr - jdk7+8 - 24mai2011
Terence Barr - jdk7+8 - 24mai2011
 
Road to sbt 1.0 paved with server
Road to sbt 1.0   paved with serverRoad to sbt 1.0   paved with server
Road to sbt 1.0 paved with server
 
Java one 2015 [con3339]
Java one 2015 [con3339]Java one 2015 [con3339]
Java one 2015 [con3339]
 
Skiron - Experiments in CPU Design in D
Skiron - Experiments in CPU Design in DSkiron - Experiments in CPU Design in D
Skiron - Experiments in CPU Design in D
 
Nodejs
NodejsNodejs
Nodejs
 
Real-world polyglot programming on the JVM - Ben Summers (ONEIS)
Real-world polyglot programming on the JVM  - Ben Summers (ONEIS)Real-world polyglot programming on the JVM  - Ben Summers (ONEIS)
Real-world polyglot programming on the JVM - Ben Summers (ONEIS)
 
An overview of node.js
An overview of node.jsAn overview of node.js
An overview of node.js
 
Java one 2010
Java one 2010Java one 2010
Java one 2010
 
Scala on-android
Scala on-androidScala on-android
Scala on-android
 
Design Summit - UI Roadmap - Dan Clarizio, Martin Povolny
Design Summit - UI Roadmap - Dan Clarizio, Martin PovolnyDesign Summit - UI Roadmap - Dan Clarizio, Martin Povolny
Design Summit - UI Roadmap - Dan Clarizio, Martin Povolny
 
Pysec
PysecPysec
Pysec
 

More from Anton Keks

Being a professional software tester
Being a professional software testerBeing a professional software tester
Being a professional software testerAnton Keks
 
Java Course 14: Beans, Applets, GUI
Java Course 14: Beans, Applets, GUIJava Course 14: Beans, Applets, GUI
Java Course 14: Beans, Applets, GUIAnton Keks
 
Java Course 13: JDBC & Logging
Java Course 13: JDBC & LoggingJava Course 13: JDBC & Logging
Java Course 13: JDBC & LoggingAnton Keks
 
Java Course 12: XML & XSL, Web & Servlets
Java Course 12: XML & XSL, Web & ServletsJava Course 12: XML & XSL, Web & Servlets
Java Course 12: XML & XSL, Web & ServletsAnton Keks
 
Java Course 11: Design Patterns
Java Course 11: Design PatternsJava Course 11: Design Patterns
Java Course 11: Design PatternsAnton Keks
 
Java Course 10: Threads and Concurrency
Java Course 10: Threads and ConcurrencyJava Course 10: Threads and Concurrency
Java Course 10: Threads and ConcurrencyAnton Keks
 
Java Course 9: Networking and Reflection
Java Course 9: Networking and ReflectionJava Course 9: Networking and Reflection
Java Course 9: Networking and ReflectionAnton Keks
 
Java Course 8: I/O, Files and Streams
Java Course 8: I/O, Files and StreamsJava Course 8: I/O, Files and Streams
Java Course 8: I/O, Files and StreamsAnton Keks
 
Java Course 7: Text processing, Charsets & Encodings
Java Course 7: Text processing, Charsets & EncodingsJava Course 7: Text processing, Charsets & Encodings
Java Course 7: Text processing, Charsets & EncodingsAnton Keks
 
Java Course 6: Introduction to Agile
Java Course 6: Introduction to AgileJava Course 6: Introduction to Agile
Java Course 6: Introduction to AgileAnton Keks
 
Java Course 5: Enums, Generics, Assertions
Java Course 5: Enums, Generics, AssertionsJava Course 5: Enums, Generics, Assertions
Java Course 5: Enums, Generics, AssertionsAnton Keks
 
Java Course 4: Exceptions & Collections
Java Course 4: Exceptions & CollectionsJava Course 4: Exceptions & Collections
Java Course 4: Exceptions & CollectionsAnton Keks
 
Java Course 3: OOP
Java Course 3: OOPJava Course 3: OOP
Java Course 3: OOPAnton Keks
 
Java Course 2: Basics
Java Course 2: BasicsJava Course 2: Basics
Java Course 2: BasicsAnton Keks
 
Java Course 1: Introduction
Java Course 1: IntroductionJava Course 1: Introduction
Java Course 1: IntroductionAnton Keks
 
Java Course 15: Ant, Scripting, Spring, Hibernate
Java Course 15: Ant, Scripting, Spring, HibernateJava Course 15: Ant, Scripting, Spring, Hibernate
Java Course 15: Ant, Scripting, Spring, HibernateAnton Keks
 
Scrum is not enough - being a successful agile engineer
Scrum is not enough - being a successful agile engineerScrum is not enough - being a successful agile engineer
Scrum is not enough - being a successful agile engineerAnton Keks
 
Being a Professional Software Developer
Being a Professional Software DeveloperBeing a Professional Software Developer
Being a Professional Software DeveloperAnton Keks
 

More from Anton Keks (18)

Being a professional software tester
Being a professional software testerBeing a professional software tester
Being a professional software tester
 
Java Course 14: Beans, Applets, GUI
Java Course 14: Beans, Applets, GUIJava Course 14: Beans, Applets, GUI
Java Course 14: Beans, Applets, GUI
 
Java Course 13: JDBC & Logging
Java Course 13: JDBC & LoggingJava Course 13: JDBC & Logging
Java Course 13: JDBC & Logging
 
Java Course 12: XML & XSL, Web & Servlets
Java Course 12: XML & XSL, Web & ServletsJava Course 12: XML & XSL, Web & Servlets
Java Course 12: XML & XSL, Web & Servlets
 
Java Course 11: Design Patterns
Java Course 11: Design PatternsJava Course 11: Design Patterns
Java Course 11: Design Patterns
 
Java Course 10: Threads and Concurrency
Java Course 10: Threads and ConcurrencyJava Course 10: Threads and Concurrency
Java Course 10: Threads and Concurrency
 
Java Course 9: Networking and Reflection
Java Course 9: Networking and ReflectionJava Course 9: Networking and Reflection
Java Course 9: Networking and Reflection
 
Java Course 8: I/O, Files and Streams
Java Course 8: I/O, Files and StreamsJava Course 8: I/O, Files and Streams
Java Course 8: I/O, Files and Streams
 
Java Course 7: Text processing, Charsets & Encodings
Java Course 7: Text processing, Charsets & EncodingsJava Course 7: Text processing, Charsets & Encodings
Java Course 7: Text processing, Charsets & Encodings
 
Java Course 6: Introduction to Agile
Java Course 6: Introduction to AgileJava Course 6: Introduction to Agile
Java Course 6: Introduction to Agile
 
Java Course 5: Enums, Generics, Assertions
Java Course 5: Enums, Generics, AssertionsJava Course 5: Enums, Generics, Assertions
Java Course 5: Enums, Generics, Assertions
 
Java Course 4: Exceptions & Collections
Java Course 4: Exceptions & CollectionsJava Course 4: Exceptions & Collections
Java Course 4: Exceptions & Collections
 
Java Course 3: OOP
Java Course 3: OOPJava Course 3: OOP
Java Course 3: OOP
 
Java Course 2: Basics
Java Course 2: BasicsJava Course 2: Basics
Java Course 2: Basics
 
Java Course 1: Introduction
Java Course 1: IntroductionJava Course 1: Introduction
Java Course 1: Introduction
 
Java Course 15: Ant, Scripting, Spring, Hibernate
Java Course 15: Ant, Scripting, Spring, HibernateJava Course 15: Ant, Scripting, Spring, Hibernate
Java Course 15: Ant, Scripting, Spring, Hibernate
 
Scrum is not enough - being a successful agile engineer
Scrum is not enough - being a successful agile engineerScrum is not enough - being a successful agile engineer
Scrum is not enough - being a successful agile engineer
 
Being a Professional Software Developer
Being a Professional Software DeveloperBeing a Professional Software Developer
Being a Professional Software Developer
 

Recently uploaded

Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfCheryl Hung
 
Webinar: The Art of Prioritizing Your Product Roadmap by AWS Sr PM - Tech
Webinar: The Art of Prioritizing Your Product Roadmap by AWS Sr PM - TechWebinar: The Art of Prioritizing Your Product Roadmap by AWS Sr PM - Tech
Webinar: The Art of Prioritizing Your Product Roadmap by AWS Sr PM - TechProduct School
 
UiPath Studio Web workshop series - Day 2
UiPath Studio Web workshop series - Day 2UiPath Studio Web workshop series - Day 2
UiPath Studio Web workshop series - Day 2DianaGray10
 
My key hands-on projects in Quantum, and QAI
My key hands-on projects in Quantum, and QAIMy key hands-on projects in Quantum, and QAI
My key hands-on projects in Quantum, and QAIVijayananda Mohire
 
CyberSecurity - Computers In Libraries 2024
CyberSecurity - Computers In Libraries 2024CyberSecurity - Computers In Libraries 2024
CyberSecurity - Computers In Libraries 2024Brian Pichman
 
March Patch Tuesday
March Patch TuesdayMarch Patch Tuesday
March Patch TuesdayIvanti
 
20140402 - Smart house demo kit
20140402 - Smart house demo kit20140402 - Smart house demo kit
20140402 - Smart house demo kitJamie (Taka) Wang
 
UiPath Studio Web workshop Series - Day 3
UiPath Studio Web workshop Series - Day 3UiPath Studio Web workshop Series - Day 3
UiPath Studio Web workshop Series - Day 3DianaGray10
 
.NET 8 ChatBot with Azure OpenAI Services.pptx
.NET 8 ChatBot with Azure OpenAI Services.pptx.NET 8 ChatBot with Azure OpenAI Services.pptx
.NET 8 ChatBot with Azure OpenAI Services.pptxHansamali Gamage
 
Introduction - IPLOOK NETWORKS CO., LTD.
Introduction - IPLOOK NETWORKS CO., LTD.Introduction - IPLOOK NETWORKS CO., LTD.
Introduction - IPLOOK NETWORKS CO., LTD.IPLOOK Networks
 
Extra-120324-Visite-Entreprise-icare.pdf
Extra-120324-Visite-Entreprise-icare.pdfExtra-120324-Visite-Entreprise-icare.pdf
Extra-120324-Visite-Entreprise-icare.pdfInfopole1
 
Emil Eifrem at GraphSummit Copenhagen 2024 - The Art of the Possible.pptx
Emil Eifrem at GraphSummit Copenhagen 2024 - The Art of the Possible.pptxEmil Eifrem at GraphSummit Copenhagen 2024 - The Art of the Possible.pptx
Emil Eifrem at GraphSummit Copenhagen 2024 - The Art of the Possible.pptxNeo4j
 
2024.03.12 Cost drivers of cultivated meat production.pdf
2024.03.12 Cost drivers of cultivated meat production.pdf2024.03.12 Cost drivers of cultivated meat production.pdf
2024.03.12 Cost drivers of cultivated meat production.pdfThe Good Food Institute
 
Outage Analysis: March 5th/6th 2024 Meta, Comcast, and LinkedIn
Outage Analysis: March 5th/6th 2024 Meta, Comcast, and LinkedInOutage Analysis: March 5th/6th 2024 Meta, Comcast, and LinkedIn
Outage Analysis: March 5th/6th 2024 Meta, Comcast, and LinkedInThousandEyes
 
SIM INFORMATION SYSTEM: REVOLUTIONIZING DATA MANAGEMENT
SIM INFORMATION SYSTEM: REVOLUTIONIZING DATA MANAGEMENTSIM INFORMATION SYSTEM: REVOLUTIONIZING DATA MANAGEMENT
SIM INFORMATION SYSTEM: REVOLUTIONIZING DATA MANAGEMENTxtailishbaloch
 
UiPath Studio Web workshop series - Day 1
UiPath Studio Web workshop series  - Day 1UiPath Studio Web workshop series  - Day 1
UiPath Studio Web workshop series - Day 1DianaGray10
 
Planetek Italia Srl - Corporate Profile Brochure
Planetek Italia Srl - Corporate Profile BrochurePlanetek Italia Srl - Corporate Profile Brochure
Planetek Italia Srl - Corporate Profile BrochurePlanetek Italia Srl
 
LF Energy Webinar - Unveiling OpenEEMeter 4.0
LF Energy Webinar - Unveiling OpenEEMeter 4.0LF Energy Webinar - Unveiling OpenEEMeter 4.0
LF Energy Webinar - Unveiling OpenEEMeter 4.0DanBrown980551
 
3 Pitfalls Everyone Should Avoid with Cloud Data
3 Pitfalls Everyone Should Avoid with Cloud Data3 Pitfalls Everyone Should Avoid with Cloud Data
3 Pitfalls Everyone Should Avoid with Cloud DataEric D. Schabell
 

Recently uploaded (20)

Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
Webinar: The Art of Prioritizing Your Product Roadmap by AWS Sr PM - Tech
Webinar: The Art of Prioritizing Your Product Roadmap by AWS Sr PM - TechWebinar: The Art of Prioritizing Your Product Roadmap by AWS Sr PM - Tech
Webinar: The Art of Prioritizing Your Product Roadmap by AWS Sr PM - Tech
 
UiPath Studio Web workshop series - Day 2
UiPath Studio Web workshop series - Day 2UiPath Studio Web workshop series - Day 2
UiPath Studio Web workshop series - Day 2
 
My key hands-on projects in Quantum, and QAI
My key hands-on projects in Quantum, and QAIMy key hands-on projects in Quantum, and QAI
My key hands-on projects in Quantum, and QAI
 
CyberSecurity - Computers In Libraries 2024
CyberSecurity - Computers In Libraries 2024CyberSecurity - Computers In Libraries 2024
CyberSecurity - Computers In Libraries 2024
 
March Patch Tuesday
March Patch TuesdayMarch Patch Tuesday
March Patch Tuesday
 
20140402 - Smart house demo kit
20140402 - Smart house demo kit20140402 - Smart house demo kit
20140402 - Smart house demo kit
 
UiPath Studio Web workshop Series - Day 3
UiPath Studio Web workshop Series - Day 3UiPath Studio Web workshop Series - Day 3
UiPath Studio Web workshop Series - Day 3
 
.NET 8 ChatBot with Azure OpenAI Services.pptx
.NET 8 ChatBot with Azure OpenAI Services.pptx.NET 8 ChatBot with Azure OpenAI Services.pptx
.NET 8 ChatBot with Azure OpenAI Services.pptx
 
Introduction - IPLOOK NETWORKS CO., LTD.
Introduction - IPLOOK NETWORKS CO., LTD.Introduction - IPLOOK NETWORKS CO., LTD.
Introduction - IPLOOK NETWORKS CO., LTD.
 
Extra-120324-Visite-Entreprise-icare.pdf
Extra-120324-Visite-Entreprise-icare.pdfExtra-120324-Visite-Entreprise-icare.pdf
Extra-120324-Visite-Entreprise-icare.pdf
 
Emil Eifrem at GraphSummit Copenhagen 2024 - The Art of the Possible.pptx
Emil Eifrem at GraphSummit Copenhagen 2024 - The Art of the Possible.pptxEmil Eifrem at GraphSummit Copenhagen 2024 - The Art of the Possible.pptx
Emil Eifrem at GraphSummit Copenhagen 2024 - The Art of the Possible.pptx
 
2024.03.12 Cost drivers of cultivated meat production.pdf
2024.03.12 Cost drivers of cultivated meat production.pdf2024.03.12 Cost drivers of cultivated meat production.pdf
2024.03.12 Cost drivers of cultivated meat production.pdf
 
Outage Analysis: March 5th/6th 2024 Meta, Comcast, and LinkedIn
Outage Analysis: March 5th/6th 2024 Meta, Comcast, and LinkedInOutage Analysis: March 5th/6th 2024 Meta, Comcast, and LinkedIn
Outage Analysis: March 5th/6th 2024 Meta, Comcast, and LinkedIn
 
SIM INFORMATION SYSTEM: REVOLUTIONIZING DATA MANAGEMENT
SIM INFORMATION SYSTEM: REVOLUTIONIZING DATA MANAGEMENTSIM INFORMATION SYSTEM: REVOLUTIONIZING DATA MANAGEMENT
SIM INFORMATION SYSTEM: REVOLUTIONIZING DATA MANAGEMENT
 
SheDev 2024
SheDev 2024SheDev 2024
SheDev 2024
 
UiPath Studio Web workshop series - Day 1
UiPath Studio Web workshop series  - Day 1UiPath Studio Web workshop series  - Day 1
UiPath Studio Web workshop series - Day 1
 
Planetek Italia Srl - Corporate Profile Brochure
Planetek Italia Srl - Corporate Profile BrochurePlanetek Italia Srl - Corporate Profile Brochure
Planetek Italia Srl - Corporate Profile Brochure
 
LF Energy Webinar - Unveiling OpenEEMeter 4.0
LF Energy Webinar - Unveiling OpenEEMeter 4.0LF Energy Webinar - Unveiling OpenEEMeter 4.0
LF Energy Webinar - Unveiling OpenEEMeter 4.0
 
3 Pitfalls Everyone Should Avoid with Cloud Data
3 Pitfalls Everyone Should Avoid with Cloud Data3 Pitfalls Everyone Should Avoid with Cloud Data
3 Pitfalls Everyone Should Avoid with Cloud Data
 

Simple Pure Java

  • 1. Simple Pure Java Anton Keks anton@codeborne.com    
  • 3. Enterprise Architecture 20 years ago a new field was born, addressing System complexity = more and more money for building IT systems Poor business alignment = more difficult to keep those increasingly expensive systems aligned with business need A problem of more cost, less value Today: even more cost, even less value    
  • 5. ! O BO   ☠  
  • 6. Your average Java (web) app ● Framework (JSF?) ● Model ● Portal? ● Services! ● Remote services, SOA, EJB ● JNDI ● Stubs, generated code ● How many layers?    
  • 7. ... ● Patterns! ● Factory, Singleton, Facade ● Enterprise patterns! ● DTO, DAO, etc ● Getters/setters (what's the deal - generate 'em) ● JPA, JAXB ● JMS!    
  • 8. Bad words Layer Tier Bus Context Manager Locator Assembler Bean Broker Facade Transfer Object DAO … It's always nice to see guys like SessionServiceContextManager or AbstractStrategyFactoryProxyFacadeBuilder    
  • 9. EAR, WAR, WAR, WAR Configuration, descriptors! JNDI! ESB? ;-) Must be a wizard to make it all run! Improves job security index :-)    
  • 10. For a small thing we create ● ManagedBean ● MegaServiceWrapper ● CoreServiceLocal, Stub (JNDI lookup?) ● CoreService (&& CoreServiceImpl) ● AggregatedService ● ConcreteService ● ConcreteDAO ● JPAAdapter   ● ...  
  • 11. The result? ☠ ● It kills productivity ● Thousands lines of code, very few functionality ● Well hidden ”business logic” ● N minute deploy time (+ N minutes app server startup) ● Oops, sometimes redeploy doesn't work, need to restart ● Slow UI responsivness    
  • 12. What to do? ● Concentrate on domain terminology ● This was the intention of OOP ● Avoid overly defensive code ● You are not writing a framework! ● Fellow developers are friends ● Follow Clean Code by Robert C. Martin    
  • 13. Java platform and language ● Java (EE) is a victim of JCP ● Many unreal/unusable JSRs ● Stick to proven open-source stuff ● Less standards – the better ● Java language is ok ● The biggest miss are closures ● DSLs are possible: Mockito, LambdaJ ● Don't bloat (generate) your code    
  • 14. Code style ● Is your code style limiting readability? ● Avoid too many line breaks and braces ● Emphasize what is important public int size() { public int size() { if (root == null) { if (root == null) return 0; return 0; return root.numSiblings(); } } else { return root.numSiblings(); } public int size() { } return root != null ? root.numSiblings() : 0; }    
  • 15. Code style ● Avoid over-indenation (or code ladder) public void startCharging() { if (customer.hasFunds()) { if (!station.isCharging()) { if (!station.currentlyBooked()) { reallyStartCharging(); return; } } } throw new UnableToStartException(); } public void startCharging() { if (!customer.hasFunds()) throw new UnableToSta if (station.isCharging()) throw new UnableToSta if (station.currentlyBooked()) throw new Unable reallyStartCharging(); }    
  • 16. Code style ● Prefer shorter code (use static imports) List<Integer> list = Arrays.asList(1, 2, 3)); list = Collections.unmodifieableList(list); return list; import static java.util.Arrays.*; import static java.util.Collections.*; ... return unmodifiableList(asList(1, 2, 3)) Looks a bit like functional programming, isn't it?    
  • 17. Code style ● Prefer good naming to comments ● Avoid getters/setters, equals, hashCode, toString unless necessary ● Break free from 'conventions' ● Work towards a DSL when(session.currentUser()).thenReturn(fakeUser); assertThat(person.age, is(25)); sort(people, on(Person.class).getAge());    
  • 18. Proper Java app ● Jetty Launcher (esp in development) ● Know the APIs well: servlets, filters, etc ● Avoid vendor-specific stuff ● Keep environment-specific configuration in version control ● Dependency Injection ● Avoid scattering cross-cutting concerns ● DB migrations (w/ liquibase/dbdeploy)   ● Start thin and simple, prefer higher SNR  
  • 19. Web UI ● Your framework tells you don't need to know JavaScript? (GWT, JSF, etc) ● B.S.! ● Keep it under control: learn basics of JQuery instead ● Knockout.js, Backbone.js can help ● You are not limited with Java syntax on the client side :-)    
  • 20. Worth reminding... ● Don't Repeat Yourself ● Keep It Simple Stupid ● You Ain't Gonna Need It ● Test Driven Development