$30 off During Our Annual Pro Sale. View Details »

iTEC | Building a career in Android Development

iTEC | Building a career in Android Development

About OOP, Design Patterns, Clean Code, Java, Kotlin, Android Jetpack, how to build a learning plan with OKRs.

Magda Miu

March 05, 2021
Tweet

More Decks by Magda Miu

Other Decks in Programming

Transcript

  1. Building a
    career in
    Android
    Development
    @magdamiu

    View Slide

  2. ABOUT ME
    ● Squad Leader Developer @YOXO (Orange)
    ● Android Google Developers Expert
    ● Trainer & Speaker
    ● Co-organiser GDG Pitesti & WTM Romania

    View Slide

  3. Employment history
    Web Developer
    Aug 2010 - Oct 2010
    Android Developer
    Nov 2010 - Aug 2015
    Android Technical Lead
    Sept 2015 - Dec 2019
    Squad Lead Developer
    Jan 2019 - Present
    GDE Android
    Feb 2019 - Present

    View Slide

  4. OOP
    Q: What’s the object-oriented
    way to become wealthy?
    A: Inheritance

    View Slide

  5. Cohesion

    View Slide

  6. Coupling

    View Slide

  7. Best case scenario
    Cohesion Coupling
    high
    loose

    View Slide

  8. ● Don’t Repeat Yourself
    ● Applicable whenever we copy / paste a piece of code
    D.R.Y.

    View Slide

  9. ● Keep It Simple and Stupid
    ● Whenever we want to implement a method to do all things
    K.I.S.S.

    View Slide

  10. ● You Ain’t Gonna Need It
    ● Don’t write code which is not yet necessary
    Y.A.G.N.I.

    View Slide

  11. ● Single responsibility (SRP)
    ● Open-closed (OCP)
    ● Liskov substitution (LSP)
    ● Interface segregation (ISP)
    ● Dependency inversion (DIP)
    S.O.L.I.D.

    View Slide

  12. Design Patterns

    View Slide

  13. Java for Android Development
    ● OOP
    ● Variables
    ● Loops
    ● Conditionals
    ● Arrays
    ● Classes
    ● Inheritance
    ● Interfaces
    ● Collections
    ● Generics
    ● Exceptions
    ● Multithreading

    View Slide

  14. Learn Java

    View Slide

  15. Kotlin
    A modern and pragmatic
    language for the industry, not an
    academic one.

    View Slide

  16. View Slide

  17. View Slide

  18. ● General-purpose
    ● FP + OOP
    ● Open source (Apache 2.0)
    ● Developed by JetBrains
    ● Static typing
    What is Kotlin?

    View Slide

  19. Kotlin is 100% interoperable with Java
    *.kt
    *.java
    Kotlin
    compiler
    Java
    compiler
    *.class *.jar
    App
    Kotlin
    runtime

    View Slide

  20. View Slide

  21. // Elvis operator
    val name: String? = null
    val lengthOfName = name?.length ?: -1
    println(lengthOfName)

    View Slide

  22. // Elvis operator
    val name: String? = null
    val lengthOfName = name?.length ?: -1
    println(lengthOfName) // => -1

    View Slide

  23. class Utility {
    // infix functions = functions with a single parameter
    infix fun String.onto(other: String) = Pair(this, other)
    }
    fun main(args: Array) {
    val blueShoes = "blue".onto("shoes")
    val yellowScarf = "yellow" onto "scarf"
    println(blueShoes) // => (blue, shoes)
    println(yellowScarf) // => (yellow, scarf)
    }

    View Slide

  24. fun String.removeFirstLastChar(): String =
    this.substring(1, this.length - 1)
    Receiver type
    Receiver object
    // extension function

    View Slide

  25. Data classes are a concise way to create classes that just hold data.
    Data classes
    Function Price
    Getters and Setters 0 Lei
    equals() & hashCode() 0 Lei
    toString() 0 Lei
    componentN() 0 Lei
    copy() 0 Lei
    TOTAL FREE!

    View Slide

  26. Coroutines are lightweight
    threads

    View Slide

  27. co + routines
    coroutines
    Cooperation Functions

    View Slide

  28. Kotlin is about developer’s happiness and
    productivity.

    View Slide

  29. Clean Code
    “Clean code is readable. It tells a
    story.”
    Uncle Bob, Clean Code

    View Slide

  30. View Slide

  31. View Slide

  32. View Slide

  33. Code quality
    “measure”
    WTFs/min
    Few WTFs Developer
    Many WTFs Developer
    WTF = What a Terrible Feature

    View Slide

  34. Use intention-revealing names
    Types Names
    Classes and Objects Customer, Account, WikiPage
    Methods postPayment, deleteAccount, displayPage
    Solution domain names AccountVisitor
    Problem domain names churnPerMonth
    Names

    View Slide

  35. “UNCLEAN” CODE CLEAN CODE

    View Slide

  36. Actor a1;
    System.out.println(a1.fn + " " + a1.ln);
    int length = a1.fn.length();
    int theLength = a1.ln.length();
    int sum = length + theLength;
    sout("The total length of the full name is " + sum);

    View Slide

  37. Actor actor;
    System.out.println(actor.firstName + " " + actor.lastName);
    int firstNameLength = actor.firstName.length();
    int lastNameLength = actor.lastName.length();
    int fullNameLength = firstNameLength + lastNameLength;
    sout("The total length of the full name is " + fullNameLength);

    View Slide

  38. private void message() {
    if (t % 7 == 0) {
    int w = t / 7;
    System.out.println(w + " week(s)");
    } else {
    System.out.println(t + " days");
    }
    }

    View Slide

  39. private void displayOfferExpirationTime() {
    if (daysUntilOfferEnds % numberOfDaysInWeek == 0) {
    int numberOfWeeks = daysUntilOfferEnds /
    numberOfDaysInWeek;
    System.out.println(numberOfWeeks + " week(s)");
    } else {
    System.out.println(daysUntilOfferEnds + " days");
    }
    }

    View Slide

  40. “Functions should do one thing.
    They should do it well.
    They should do it only.”
    Functions

    View Slide

  41. “The functions should be small.
    The functions should be smaller than that. “

    View Slide

  42. ● Functions should hardly ever be 20 lines long.
    ● For a nicer impact make a function not bigger than 4 lines of code.
    ● The indent level of a function should not be greater than one or two.
    ● The blocks within if, else and while should be one line long.
    ● A long descriptive name is better than a short enigmatic name.
    About Functions

    View Slide

  43. ● Zero (niladic)
    ○ Ideal number of arguments
    ● One (monadic)
    ○ A good number of arguments
    ● Two (dyadic)
    ○ A good number of arguments
    ● Three (triadic)
    ○ Should be avoided where possible.
    ● More than three (polyadic)
    ○ Maybe we should wrap the arguments in a new type
    Function arguments

    View Slide

  44. System
    System
    Command Query Separation
    Command Query
    Output
    System
    Changed state
    Output (result)
    Changed state
    Output (result)

    View Slide

  45. Every time you write a comment,
    a cat cries somewhere...
    Comments

    View Slide

  46. Android
    Jetpack
    A set of libraries, tools and
    guides to help make app building
    quick and easy.

    View Slide

  47. Android Jetpack
    Follow best practices
    Fewer crashes and less
    memory leaks with
    backwards-compatibility
    baked in.
    No boilerplate code
    You can focus on what
    makes your app great.
    Reduce fragmentation
    Reduce complexity with
    libraries that work
    consistently across
    Android versions and
    devices.

    View Slide

  48. Android Jetpack
    UI
    Jetpack Compose
    Foundation
    AndroidX, Android KTX
    Architecture
    LiveData, ViewModel,
    Lifecycle, Room,
    Navigation, Paging, Hilt
    Behaviour
    Slices, Security,
    Permissions

    View Slide

  49. *Recommended app architecture
    Activity / Fragment
    Model
    Room
    Remote Data source
    Retrofit
    SQLite
    REST
    API
    ViewModel
    LiveData
    Repository

    View Slide

  50. Architecture Components: Room for databases
    Components
    Entity, Dao, Database
    “Relations”
    @Embedded, @Relation,
    @ForeignKey
    Queries
    @Insert, @Update, @Delete,
    @Query, @RawQuery

    View Slide

  51. 🛠Tools for Android development
    CI/CD Pipeline

    View Slide

  52. Learning Plan
    “A goal without a plan is just a
    wish.”
    Antoine de Saint-Exupéry

    View Slide

  53. Achievable Learning Plan
    @Work
    Code review
    &
    Pull Request
    @Home
    SWOT
    &
    OKRs

    View Slide

  54. Achievable Learning Plan
    @School
    OOP, Database, Unit
    Testing, etc
    @Home
    SWOT
    &
    OKRs

    View Slide

  55. @Work
    Code review & Pull Request

    View Slide


  56. Reviewer
    Author

    View Slide

  57. Author

    View Slide

  58. Writing the code
    ● Make sure you understand your task
    ● Refactor the code if it’s unreadable
    ● Write tests and follow the team conventions
    ● Format your code before commit it

    View Slide

  59. The boy scout rule
    Leave the campground cleaner
    than you found it.

    View Slide

  60. Before the code review
    ● Add relevant commit comments
    ● Send pull requests often
    ● Have minimum 2 reviewers (one is senior)

    View Slide

  61. After the code review
    ● Be humble
    ● You are on the same side with your reviewer(s)
    ● Know when to unlearn the old habits

    View Slide

  62. Reviewer

    View Slide

  63. Use I… comments
    ● I think…
    ● I would…
    ● I believe…
    ● I suggest...

    View Slide

  64. Ask questions
    ● Have you consider using… ?
    ● What do you think about… ?
    ● Have you tried to… ?

    View Slide

  65. It’s about the code, not about the coder
    ● This code…
    ● This function…
    ● This line of code...

    View Slide

  66. Feedback equation*
    Observation
    of a behavior
    Impact
    of the behavior
    Question or
    Request
    I observed this function
    has 60 lines.
    This makes it difficult for
    me to understand the
    logic.
    I suggest extracting a
    part of the code into
    other functions and give
    them relevant names.
    *
    Defined by Lara Hogan

    View Slide

  67. @Home
    SWOT & OKRs

    View Slide

  68. The “process”
    SWOT
    Where I am now
    Retro
    How it was and
    what’s next
    OKRs
    What I want to
    achieve
    Review
    What I achieved
    01 02
    04 03

    View Slide

  69. Personal SWOT Analysis
    ME
    Weaknesses
    Skills that should be
    improved (technical or
    work habits)
    Threats
    Impediments at work,
    changes, weaknesses
    lead to threats
    Strengths
    Advantages like: skills,
    achievements,
    certifications, education,
    connections
    Opportunities
    Events, conferences, new
    role/project, industry
    growing

    View Slide

  70. ● Goal setting in a collaborative way
    ● Objective => WHAT
    ● Key results => HOW
    ● “It’s not a key result unless it has a number”
    OKRs

    View Slide

  71. ● Superpower #1 => focus and commit to priorities
    ● Superpower #2 => align and connect for teamwork
    ● Superpower #3 => track for accountability
    ● Superpower #4 => stretch for amazing
    OKRs superpowers

    View Slide

  72. ● 0.7 to 1.0 = green (we delivered)
    ● 0.4 to 0.6 = yellow (we made progress, but fell short of completion)
    ● 0.0 to 0.3 = red (we failed to make real progress)
    Scoring @Google

    View Slide

  73. OKR sample
    Learn Kotlin for Android Development
    6 months / weekly review
    Quantity Goal Quality Goal Result
    1 Kotlin Koan per week Learn specific features of the
    language => 1 feature / week
    Exercise often and on a set of
    Koans proposed by JetBrains
    Write one detailed article
    about a specific topic per
    month
    Improve my writing skills and
    learn by teaching to others
    Learn new things, help the
    community and get feedback
    3 code samples runned per
    week
    Get a repo with samples that I
    can re-check (use ktlint)
    Gain real experience in
    programming using Kotlin

    View Slide

  74. ● Score your results
    ● Keep notes of your accomplishments
    ● Look for feedback because development is continuous
    ● Surround yourself with people who motivate and inspire you
    ● Find a mentor
    Review

    View Slide

  75. ● Did I accomplish all of my objectives?
    ○ YES => what contributed to my success?
    ○ NO => what obstacles did I encounter?
    ● If I were to rewrite a goal achieved in full, what would I change?
    ● What have I learned that might alter my approach to the next cycle’s
    OKRs?
    ● Understand what is your WHY
    ● Repeat the process
    Retrospective

    View Slide

  76. 📃Official Documentation from Google
    🌐Blogs and Websites
    💻Code Examples (Codelabs & GitHub)
    📰Newsletters
    📚Books & Online Courses
    From where to learn more...
    🎞Videos & Youtube Channels
    📻Podcasts
    👨‍💻👩‍💻Twitter
    🎤Conferences & Meetups
    🚨Troubleshooting

    View Slide

  77. From where to learn more...

    View Slide

  78. ● Define your objectives and track the progress
    ● Identify your learning style
    ● Focus on your strengths
    ● Search for resources and organise them in a plan
    ● Start learning and track your progress
    ● Focus to understand how the things are working
    ● If it is difficult, take a break, and start over
    My summary in 7 steps

    View Slide

  79. CREDITS: This presentation template was created by Slidesgo,
    including icons by Flaticon, images from Unsplash, and
    infographics & images by Freepik.
    THANKS!
    magdamiu.com
    @magdamiu

    View Slide