You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Best practices in Coding, Designing and Architecting Java Applications
3
3
4
4
5
-
# Coding
5
+
## Coding
6
+
7
+
###How to become a good programmer?
8
+

9
+
10
+
###Code Quality Overview
11
+

6
12
7
-
## Code Quality
8
13
- More than everything else, code quality is an attitude. Either, the team has it or not. The attitude to refactor when something is wrong. The attitude to be a boy scout. As an architect, it is important to create an environment where such an attitude is appreciated. (There are always bad sheep, who take the code quality to such depth that it is not fun anymore, but I like them more than developers who keep churning out bad code).
9
14
- Have a good static analysis tool(and is part of Continuous Integration). Sonar is the best bet today. Understand the limits of Static Analysis. Static Analysis is not a magic wand. For me, results from Static Analysis are a signal: It helps me decide where I should look during peer or architect reviews?
10
15
- Have good peer review practices in place. Every user story has to be peer reviewed. Put more focus on peer reviews when there is a new developer or there is a new technical change being done. Make best use of Pair Programming. The debate is ongoing : Is pair programming more productive or not? I would rather stay out of it. You make your choice. However, these two scenarios are bare minimum:
@@ -24,7 +29,8 @@ Best practices in Coding, Designing and Architecting Java Applications
24
29
- Be conscious about create as few objects as possible. Especially in loops.
25
30
- Avoid String Concatenation
26
31
- Close connections and Streams
27
-
-
32
+

33
+
28
34
## Load and Performance Testing
29
35
- PDF Presentation https://www.mindmup.com/#m:g10B8KENIDghuHAUjlYVmlfSllzTzg
30
36
- Have clear performance objectives. That’s the single most important objective. Decide Peak Load, Expected Response Time, Availability Required before hand.
@@ -36,8 +42,9 @@ Best practices in Coding, Designing and Architecting Java Applications
36
42
- Make sure team is not making premature optimizations. Any optimization decision should be based on numbers or past experience. In Donald Knuth's paper "Structured Programming With GoTo Statements", he wrote: "Programmers waste enormous amounts of time thinking about, or worrying about, the speed of non critical parts of their programs, and these attempts at efficiency actually have a strong negative impact when debugging and maintenance are considered. We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil. Yet we should not pass up our opportunities in that critical 3%."
37
43
- Have Clear Strategy on How to Handle expected load. What would be the initial settings on the application server? Do you plan to use a clustered environment? Do you need a load balancer?
38
44
39
-
# Design
40
-
## Design Focus Areas
45
+
## Design
46
+
###Design Focus Areas
47
+

41
48
- 4 Principles of Simple Design. https://www.youtube.com/watch?v=OwS8ydVTx1c&list=PL066F8F24976D837C
42
49
- Runs all tests
43
50
- Minimize Duplication
@@ -56,36 +63,44 @@ Best practices in Coding, Designing and Architecting Java Applications
56
63
- Deployment diagrams
57
64
- Design Patterns. Following video covers all the major design patterns. https://www.youtube.com/watch?v=0jjNjXcYmAU. My personal view : Design Patterns are good to know. Have a good idea on what each one of them does. But, that where it ends. I’m not a big fan of understanding the intricate details of each Design Pattern. You can look it up if you have a good overall idea about Design Patterns.
58
65
59
-
# Architecture
66
+
###Design Review
67
+

68
+
69
+
## Architecture
60
70
- PDF : [https://www.mindmup.com/#m:g10B8KENIDghuHAZWh2SEhSNTdNNjA]
61
71
62
-
##Great Architect
63
-
- Creating a clean architecture based on sound principles. Architecture covering all Non Functional Requirements.
72
+
### Architect Responsibilities
64
73
- Having good governance in place. Good review processes in place for Architecture, Design and Code.
74
+
- Creating a clean architecture based on sound principles. Architecture covering all Non Functional Requirements.
65
75
- Ensuring teams are as productive as they can be. Right tools.
66
76
- Ensuring teams are following the best engineering practices.
67
77
- Ensuring clear communication about architecture with business and technical teams.
Most important qualities I look for in an Architect are
71
82
- Impeccable Credibility : Somebody the team looks up to and aspires to be.
72
83
- Super diagnostic skills : The ability to do a deep dive on a technology issue. When developers are struggling with a problem (having tried different things), Can he/she provide a fresh pair of eyes to look at the same problem?
73
84
- Forward Thinker and Proactive : Never satisfied with where we are. Identifies opportunities to add value fast.
74
85
- Great Communication : Communication in the widest sense. Communicating the technical aspects to the stakeholders, project management, software developers, testers, etc.
- PDF https://www.mindmup.com/#m:g10B8KENIDghuHAYmFzM0daOU80SDA
81
96
82
-
## Distributed Cache
97
+
###Distributed Cache
83
98

84
99
85
-
## Layers
100
+
###Layers
86
101
- PDF https://www.mindmup.com/#m:g10B8KENIDghuHAemVIS2RvT1JDOUE
87
102
88
-
### Business Layer
103
+
####Business Layer
89
104
Listed below are some of the important considerations
90
105
- Should I have a Service layer acting as a facade to the Business Layer?
91
106
- How do I implement Transaction Management? JTA or Spring based Transactions or Container Managed Transactions? What would mark the boundary of transactions. Would it be service facade method call?
@@ -96,14 +111,14 @@ Listed below are some of the important considerations
96
111
- Are there any Operations specific logging or auditing that is needed?Can we implement it as a cross cutting concern using AOP?
97
112
- Do we need to validate the data that is coming into the Business Layer? Or is the validation done by the web layer sufficient?
98
113
99
-
### Data Layer
114
+
####Data Layer
100
115
- Do we want to use a JPA based object mapping framework (Hibernate) or query based mapping framework (iBatis) or simple Spring DO?
101
116
- How do we communicate with external systems? Web services or JMS? If web services, then how do we handle object xml mapping? JAXB or XMLBeans?
102
117
- How do you handle connections to Database? These days, its an easy answer : leave it to the application server configuration of Data Source.
103
118
- What are the kinos of exceptions that you want to throw to Business Layer? Should they be checked exceptions or unchecked exceptions?
104
119
- Ensure that Performance and Scalability is taken care of in all the decisions you make.
105
120
106
-
### Web Layer
121
+
####Web Layer
107
122
- First question is do we want to use a modern front end javascript framework like AngularJS? If the answer is yes, most of this discussion does not apply. If the answer is no, then proceed?
108
123
- Should we use a MVC framework like Spring MVC,Struts or should we go for a Java based framework like Wicket or Vaadin?
109
124
- What should be the view technology? JSP, JSF or Template Based (Velocity, Freemarker)?
@@ -113,24 +128,24 @@ Listed below are some of the important considerations
113
128
- How do we Authenticate and Authorize users? Do we need to integrated external frameworks like Spring Security?
114
129
- Do we need to expose external web services?
115
130
116
-
# Tools
131
+
##Tools
117
132
118
-
## Maven Best Practices
133
+
###Maven Best Practices
119
134

120
135
121
-
###10 Tips For Maven
136
+
#### 10 Tips For Maven
122
137
[10 Tips for Eclipse and Maven](pdf/10TipsforEclipseAndMaven.pdf)
123
138
124
-
## IDE - Eclipse
139
+
###IDE - Eclipse
125
140

126
141
127
-
###10 Tips For Eclipse
142
+
#### 10 Tips For Eclipse
128
143
[10 Tips for Eclipse and Maven](pdf/10TipsforEclipseAndMaven.pdf)
129
144
130
145
131
-
# Practices
146
+
##Practices
132
147
133
-
## Agile and Architecture
148
+
###Agile and Architecture
134
149
- First of all I’m a great believer that agile and architecture go hand in hand. I do not believe agile means no architecture. I think agile brings in the need to separate architecture and design. For me architecture is about things which are difficult to change : technology choices, framework choices, communication between systems etc. It would be great if a big chunk of architectural decisions are made before the done team starts. There would always be things which are uncertain. Inputs to these can come from spikes that are done as part of the Done Scrum Team.But these should be planned ahead.
135
150
- Architecture choices should be well thought out. Its good to spend some time to think (Sprint Zero) before you make a architectural choice.
136
151
- I think most important part of Agile Architecture is Automation Testing. Change is continuous only when the team is sure nothing is broken. And automation test suites play a great role in providing immediate feedback.
@@ -140,7 +155,8 @@ Listed below are some of the important considerations
140
155
[Design in Agile Projects](pdf/AgileAndDesign-Evolution.pdf)
141
156
142
157
143
-
## Modern Development Practices
158
+
### Modern Development Practices
159
+

144
160
- Unit Testing and Mocking : We are in the age of continuous integration and delivery, and the basic thing that enables those is having a good set of unit test in place. (Don’t confuse unit testing with screen testing done manually to check if the screen flow is right. What I mean by unit testing is JUnit test’s checking the business logic/screen flow in a java method (or) set of methods). Understand JUnit. Here is a good start : https://www.youtube.com/watch?v=AN4NCnc4eZg&list=PL83C941BB0D27A6AF. Also understand the concept of Mocking. When should we mock? And when we should not? Complicated question indeed. Understand one mocking framework : Mockito is the most popular one. Easymock is a good mocking framework as well.
145
161
- Automated Integration Tests. Automated Integration Tests is the second important bullet in enabling continuous delivery. Understand Fitnesse, Cucumber and Protractor.
146
162
- TDD (actually I wanted to put it first). Understand what TDD is. If you have never used TDD, then be ready for a rude shock. Its not easy to change a routine you developed during decades (or years) of programming. Once you are used to TDD you never go back. I promise. This list of videos is a good start to understanding TDD. https://www.youtube.com/watch?v=xubiP8WoT4E&list=PLBD6D61C0A9F671F6. Have fun.
@@ -149,7 +165,7 @@ Listed below are some of the important considerations
149
165
- Continuous Integration. Every project today has continuous integration. But, the real question is “What is under Continuous Integration?”. Compilation, unit tests and code quality gate(s) is the bare minimum. If you have integration and chain tests, wonderful. But make sure the build does not take long. Immediate feedback is important. If needed, create a separate build scheduled less frequently for slower tests (integration and chain tests). Jenkins is the most popular Continuous Integration tool today.
150
166
[[ModernDevelopmentPractices.png]]
151
167
152
-
### Important Questions
168
+
####Important Questions
153
169
- How often is code commited?
154
170
- How early are problems/defects found/fixed?
155
171
-- Code Quality, Code Review, ST Defects
@@ -166,48 +182,28 @@ Listed below are some of the important considerations
166
182
- Chain Tests
167
183
- How long does a Continuous Integration build run for? Is there a need for multiple builds?
168
184
169
-
## Productive Developers
185
+
###Productive Developers
170
186
171
-
##Unit Testing Best Practices
187
+
### Unit Testing Best Practices
172
188
[Unit Testing Best Practices](pdf/UnitTestingBestPractices.pdf)
0 commit comments