7 tips to Write Functions like a Senior Developer

1

1. Do one thing and do it well

2

2. Hide switch statements inside a low level class

3

3. Keep arguments minimum

4

4. Never use flag arguments

5

5. Pass arguments as an object

6

6. Prefer exceptions over error codes

7

7. Make separation between command and query

click down to get complete information on it