Wednesday, July 12, 2017

Scala 101

Why Scala:

    Scala is good for process distributed data over cluster.

    In the very end, compile all code to bytecode and run. You can use all Java library

    Spark is built on Scala

       

What's the difference of JVM on Scala or Java

Wednesday, July 5, 2017

Best Practice

parameterized

Don't check too much

It would be better to separate the concerns of Access Control from the concerns of Task, Action or Command.
I stopped using this pattern a long time ago, for a very simple reason; maintenance cost. Several times I found that I had some function say frobnicate(something, forwards_flag) which was called many times in my code, and needed to locate all the places in the code where the value false was passed as the value of forwards_flag. You can't easily search for those, so this becomes a maintenance headache. And if you need to make a bugfix at each of those sites, you may have an unfortunate problem if you miss one.

System Design

1. How to design Shazam phone app

2. How to speed a bank transaction order processing system. All orders need to be processed sequentially.
    a. Use lazy Load for DB
    b. Java Profiler to analyze
    c. Try to parallel orders which can be paralleled
    d. prepare/load order to different machine to cut waiting time

SQL/DB/Nosql question

1. What is NoSQL
    A DB which has key-value paired and document based.
    Doesn't use string based queries to fetch data
    Cassandra is a distributed NoSQL DB

2. Difference between NoSQL and RDMBS
    NoSQL is unstructured, high availability, cannot be queried by  SQL, K-V parir, document base
    RDMBS is structured, low availability, can use SQL QUERY,  Data/Relational stored in dif tables

Tuesday, July 4, 2017

Java what's new in Java 1.8?

1. forEach() method in Iterable interface
default and static methods in Interfaces
Functional Interfaces and Lambda Expressions
Java Stream API for Bulk Data Operations on Collections
Java Time API
Collection API improvements
Concurrency API improvements
Java IO improvements