There are times when you work with SSL traffic. Your website might be protected with a certificate so that traffic between you and the client is secure. At times like this, being a developer is troublesome. Browser cache settings need to be analyzed by looking at the HTTP headers. Encoding / Content type may need to be analyzed to ensure that a particular page is displayed correctly. These things cannot be looked into if the traffic is secure. There are situations under which the environment is secure but you must still sniff the data. So how do you manage this ?
Tools like Charles (A debugging proxy) help you do this. Charles allows you to proxy to a secure connection over a protocol like HTTPS and still read the traffic. So how does it do this ? Lets have a look.
Your environment probably has a self signed certificate like the one issued below, using keytool.
I chanced upon a post a while back about how a switch statement should be replaced with the strategy pattern. If you have not had a chance to go through it, please do. The post is not very long. I found myself disagreeing very strongly with the author of the post and I was surprised to find that people thought this was a good idea.
The gist of the post was that using the Strategy pattern was better than using switch statements to determine which logic to execute. Here is why I think the idea used there was bad
- The introduction of the Strategy pattern, in the example, introduces three new classes. So for every case in a switch statement, we should go about replacing the corresponding code with a new class ? This could easily lead to an explosion in the number of classes.
I successfully installed a wave (google) server on a windows box a few days earlier. It was a great feeling. Here are the components that made up the server
- Postgres database to be used by XFire.
- Wave related server jar which runs the server
- Wave command line client that runs the simplistic console client.
I started the console client and typed in a few commands to go through the waves. New, open, view waves were some commands that the command line console allowed you to execute. This client was a simple RI provided by google. If you would like to install a server on your own, take a look at the installation instructions.
Wave console client:

The JDK7 milestone 5 update is available for download. Developers now have a chance to try coding with the new language semantics and see for themselves what it is like. The 4 major changes that affect the way one codes in java as of JDK 7 are
- Using underscores in numerals.
- Diamond syntax used to work with collections + generics.
- Using Strings in switch statements.
- Making use of binary literals
Here is a short code sample that you can use to check the new features out. Use a plain text editor and your old friends javac and java, to test it out. IDEs will not support the new syntax and will most likely complain.
Sample JDK 7 Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
| public class Jdk7Tests {
public static void main(String[] args) {
Jdk7Tests jdk7Tests = new Jdk7Tests();
jdk7Tests.integersWithUnderscores();
jdk7Tests.stringSwitch();
jdk7Tests.binaryLiteral();
jdk7Tests.diamond();
}
private void integersWithUnderscores()
{
int i = 1_2;
System.out.println(i);
i*=10;
System.out.println(i);
int j=2_0;
System.out.println(i-j);
}
private void stringSwitch()
{
String key = "akey";
switch (key)
{
case "":
{
System.out.println("Nothing");
break;
}
case "akey":
{
System.out.println("Matched akey");
break;
}
default:
break;
}
}
private void binaryLiteral()
{
byte aByte = (byte)0b001;
short aShort = (short)0b010;
System.out.println(aByte + " " + aShort);
}
private void diamond()
{
Set<String> set = new TreeSet<>();
set.add("c");
set.add("b");
set.add("a");
for (String val : set)
{
System.out.println(val);
}
}
} |
Underscores and numerals:
Developers interview candidates every now and then. There are days when you need to interview 4 candidates, and finish your work too. Then there are times you go to work on a Saturday to support an interview drive. Whatever the case, it really pays to have a few filter questions that should tell you whether a candidate is full of gas or if they are worth their salt. These questions can be a real time saver. Here are 2 questions that many developers use.
1. Class hierarchy:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
| class A
{
public void doSomething()
{
System.out.println("A");
}
}
class B extends A
{
@Override
public void doSomething()
{
System.out.println("B");
}
} |
Give a candidate a class hierarchy like the one above and ask them something like, ‘How should you instantiate these objects so the output is ‘A’ / ‘B”. The you can drill down and ask them about the different instantiation combination. Anyone that says B b = new A(); will instantiate, is out of here.
2. Name them: