Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage Presentations Refactoring in Java, Scala, and Clojure

Refactoring in Java, Scala, and Clojure



Glen Peterson uses the Expression Problem to compare refactoring in Java, Scala and Clojure, showing how traits minimize changes in Scala when an interface changes and how Clojure avoids some of the issues.


Glen Peterson has been programming for over 3 decades, over 2 of those professionally. He is currently the CTO and Lead Developer at PlanBase Inc. ( Previously he designed and built web applications for Fidelity Investments and wrote video drivers for ATI.

About the conference

DEVNEXUS is the Southeast’s most exciting conference for professional software developers working with languages, tools, frameworks & methodologies connected to the Java platform. With attendance of over 1200 people, 10 tracks provide a fantastic learning experience for Core Java, Web, Cloud, Mobile, Data & Integration, HTML5, JavaScript, Alternative Languages, Agile & Architecture, UX/Git/DevOps.

Recorded at:

Aug 02, 2014

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Community comments

  • Errata

    by Glen Peterson,

    Your message is awaiting moderation. Thank you for participating in the discussion.

    At 58:45 I make the completely false statement, "All this new stream stuff [in Java 8] is mutable." Actually, Java 8 streams do NOT change the underlying source data.

    What I wish I said was, "Stephen Chin's talk on Java 8 'Retro Gaming with Lambdas' was a highlight of the conference, but it horrified me when he showed how concurrent streams could break things in interesting ways. Concurrent streams do not mutate the underlying data, but neither can they cannot save you from the pitfalls of the mutation friendly programming style that most people currently use in Java."

  • Errata at 10:50

    by Glen Peterson,

    Your message is awaiting moderation. Thank you for participating in the discussion.

    // Copyright 2013 Glen K. Peterson
    public class RefactJava1 {

    public interface YearMonthInterface {
    public int getYear();
    public int getMonth();

    public static final class YearMonth implements YearMonthInterface {
    private final int year;
    private final int month;

    private YearMonth(int y, int m) { year = y; month = m; }

    public static YearMonth of(int y, int m) {
    if (m > 12) {
    y = y + (m / 12);
    m = (m % 12) + 1;
    } else if (m < 1) {
    y = y + (m / 12) - 1;
    m = 12 + (m % 12);
    return new YearMonth(y, m);

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p