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

Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 

Recently uploaded (20)

Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 

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