Skip to content

Commit cc166b2

Browse files
committed
Minor updates and grammar fixes.
1 parent 7f7f285 commit cc166b2

4 files changed

Lines changed: 25 additions & 14 deletions

File tree

‎topics/core/jvm-internals.md‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@ Note: These topics are highly unlikely to come up in an interview. Feel free to
77

88
### Compressed pointers
99

10-
- 32 bit references can address 4GB, while 64 bit can reference
11-
- Though having 64 bit reference for every object increases memory usage. JVMs use [compressed pointers](https://wiki.openjdk.java.net/display/HotSpot/CompressedOops) to address this issue.
10+
- 32 bit references can address 4GB, while 64 bit can reference 2^64 bytes (though limited by OS/RAM on the machine).
11+
- Having 64 bit reference for every object increases memory usage. JVMs use [compressed pointers](https://wiki.openjdk.java.net/display/HotSpot/CompressedOops) to address this issue.
1212
- Basic idea is to store 32-bits per reference and then add to a base address to find final 64-bit address.
13+
- Flag: `-XX:+UseCompressedOops`. Latest versions of 64-bit Java have this argument by default.
1314
- Addresses upto 4gb untranslated.
1415
- Addresses 4gb to 28gb, remove 3bits, because Java has 8 byte word aligned, thus 3 bits need not be stored.
1516
- Important because Java has more references. In C++ memory layout follows struct layout.
16-
- Java 8 has JVM args, +XX:ObjectAlignmentInBytes=16 for heap between 32gb and 64gb
17+
- Java 8 has JVM args, `+XX:ObjectAlignmentInBytes=16` for heap between 32gb and 64gb.
1718

1819
### String interning
1920

‎topics/design/design-patterns.md‎

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77

88
### Creational
99

10-
- Singleton - Eager (static) or Lazy (broken pre-JDK5). Eg: Logger, Configurer
11-
- Factory - Eg: Trade type (Bonds, Bill, Notes)
12-
- Abstract Factory - Factory of factories but related products. Eg: Trade Type (GermanBond, EuroBond, GermanBill, EuroBill)
10+
- Singleton - Single instance of class. Either Eager (static) or Lazy (broken pre-JDK5). Eg: Logger, Configurer
11+
- Factory - Create types of instances. Eg: Trade type (Bonds, Bill, Notes)
12+
- Abstract Factory - Factory of factories of related products. Eg: Trade Type (GermanBond, EuroBond, GermanBill, EuroBill)
1313
- Builder - Eg: StringBuilder, PizzaMaker
1414
- Prototype - Copying costly-creation objects. Classes should implement clone or similar method.
15-
- Object pool - Eg: Threadpool
15+
- Object pool - Re-use instances. Eg: Threadpool
1616

1717
### Behavioral
1818

@@ -27,15 +27,14 @@
2727
- Interpreter - Format converter. Eg: JVM converts byte to native for JVM.
2828
- Memento - Save and restore state of object.
2929

30-
3130
### Structural
3231

3332
- Adapter - Adapting to a non-direct-compatible class/module/system.
34-
- Decorator - Eg: FileReader, BufferedReader
33+
- Decorator - Wrap class with another Eg: FileReader, BufferedReader
3534
- Facade - Hiding complexity behind simple interfaces. Eg: Turbo Tax
36-
- Proxy - Eg: Hibernate proxy for lazy fetch
35+
- Proxy - Eg: Hibernate proxy for lazy fetch. @Spy instances for JUnit/Mockito.
3736
- Flyweight - Store common characteristics of multiple objects in single place. Eg: Glyph for all characters in a document.
38-
- Bridge -
37+
- Bridge - Decouple abstraction from implementation so that both can vary independently. Bridge pattern is often created using Adapter pattern.
3938
- Composite - Eg: Folder and files
4039

4140

‎topics/design/solid.md‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
- I = Interface Segregation - Multiple specific interfaces are better than big general one
77
- D = Dependency Injection - High level and Low level modules should both depend on abstraction
88

9-
## Object oriented principles
9+
## Other design principles
1010

11-
-
11+
- Code to interface not implementation
12+
- Favor composition over inheritance
13+
- Encapsulate what changes
14+
- Strive for loose coupling between objects
15+
- Principle of least knowledge = Talk only to immediate friends

‎topics/related/web.md‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
### Resources
44

5-
- [IP Adress Basics](http://www.deepakvadgama.com/blog/ipaddress-basics-for-developers/)
5+
- [IP Address Basics](http://www.deepakvadgama.com/blog/ipaddress-basics-for-developers/)
66
- [HTTP Overview](https://developer.mozilla.org/en-US/docs/Web/HTTP/Overview)
77
- [HTTP Statuses](https://httpstatuses.com)
88
- [HTTP Caching](https://developers.google.com/web/fundamentals/performance/optimizing-content-efficiency/http-caching)
@@ -46,6 +46,13 @@
4646
- 404: Not found
4747
- 500: Internal server error
4848

49+
### [HTTP Statuses in a nutshell](https://twitter.com/stevelosh/status/372740571749572610?lang=en)
50+
- 10x: Hold on
51+
- 20x: Here you go
52+
- 30x: Go away
53+
- 40x: You (client) screwed up
54+
- 50x: I (server) screwed up
55+
4956
### HTTP 2
5057

5158
- Why?: Top sites average 100 requests per page. Browsers allow max 6 connections. Min 35ms round trip per request. 80 byte header.

0 commit comments

Comments
 (0)