Skip to content

Instantly share code, notes, and snippets.

View surajdubey's full-sized avatar

Suraj Dubey surajdubey

View GitHub Profile
@surajdubey
surajdubey / System Design.md
Created February 1, 2019 07:54 — forked from vasanthk/System Design.md
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
class ThreadSafeSingletonWithDoubleCheckedLocking {
private static ThreadSafeSingletonWithDoubleCheckedLocking threadSafeSingleton;
/**
* private constructor so that other classes can't
* instantiate it through constructor
* any instantiation while creating new singleton instance should come here
*/
private ThreadSafeSingletonWithDoubleLocking() {}
class ThreadSafeSingleton {
private static ThreadSafeSingleton threadSafeSingleton;
/**
* private constructor so that other classes can't
* instantiate it through constructor
* any instantiation while creating new singleton instance should come here
*/
private ThreadSafeSingleton() {}
class LazySingleton {
// singleton instance
private static LazySingleton lazySingleton = null;
/**
* private constructor so that other classes can't
* instantiate it through constructor
*/
private LazySingleton() {
// all initialization steps go here
class EagerSingleton {
private static EagerSingleton singletonInstance = new EagerSingleton();
public static EagerSingleton getInstance() {
return singletonInstance;
}
}
@surajdubey
surajdubey / macosx_remove_java9.sh
Created February 14, 2018 04:10 — forked from schnell18/macosx_remove_java9.sh
MacOS X remove Java 9
sudo rm -fr /Library/Java/JavaVirtualMachines/jdk-9.jdk/
sudo rm -fr /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin
sudo rm -fr /Library/PreferencePanes/JavaControlPanel.prefPane
@surajdubey
surajdubey / StudentUpdate_.idea_.name
Created December 7, 2013 20:13
Jframe Application Involving Database
StudentUpdate