Tuesday, June 14, 2005
Saturday, June 11, 2005
Re: New Member
I failed to mention he interned at Microsoft last summer.
And good idea - the disclaimer about the bad jokes. At least he can't say we didn't warn him.
Friday, June 10, 2005
Re: Are Design Patterns How Languages Evolve?
Another good example in the is the Observer pattern. This is where you want to "observe" another object and be notified when an event occurs. In .NET the concept of an Event is built into the system.
What you mentioned about the Observer pattern is right. An observer(mostly UI) registers with an observable(data) to be notified about changes so that it can update/refresh itself.
I think the Event class you mention actually corresponds to the Command Design Pattern. I do not have a very good idea about this pattern so may be incorrect. Many times patterns are clubbed together to provide a solution.
I find that Design Patterns are discussed more on the Java side. I haven't found much material with regards to .NET. Dunno why.
There are a lot of patterns on the J2EE side. To build a good app.. with good perf, a lot of stuff needs to be done. Java stuff does not shield you that much. It is very easy to build an app that totally sucks in perf. A lot of experience and knowledge is required. .NET i guess protects the dev more. I guess we should try discussing more topics like say persistence as well which is one of the major areas in Enterprise apps.
I've added a new member - Pawan - to codeWord.
Welcome to the group!! Look forward to some good discussions.. on any topic whatsoever.
Btw all of your posts need to bash Microsoft at some level. And you'll have to have a very high level of tolerance against really bad jokes by the other guys..
Tuesday, June 07, 2005
New member
So looks like Open Source web tech is going to get some coverage too. Another perspective is always good.
Re: Are Design Patterns How Languages Evolve?
What I wrote in my previous post doesn't technically count as design patterns in the way it's used today. You're right. I suppose I was lumping the "hacks" or workarounds together with design patterns. Basically, something that isn't enforced by the compiler or the language but is agreed upon by the community.
As far as design patterns go, they are becoming language features. The Singleton pattern which you mentioned is one example. In the next version of C# (and VB.NET too I think), you can declare a "static" class. This makes it so that you can't create an instance of it. The constructor is automatically private. Another good example in the is the Observer pattern. This is where you want to "observe" another object and be notified when an event occurs (correct me if I'm wrong, or confused it with another pattern). In .NET the concept of an Event is built into the system. So you can actually create events, have other objects delegate their own methods to those events so that they are invoked when that event occurs.
So this is different to what you said about design patterns being built into the API's instead of the language itself.
I find that Design Patterns are discussed more on the Java side. I haven't found much material with regards to .NET. Dunno why.
Re: Are Design Patterns How Languages Evolve?
Are Design Patterns How Languages Evolve? Any thoughts?
.NET introduced the concept of "Attributes". Java 1.5 came out with a similar concept called "Annotations".
It's interesting to see the evolution of languages and how newer features are just formalized notions of what you could do before that feature came to be. More often than not, it was just "hacking" a feature for something it was'nt really meant for.
The links provided by Mohn did confuse me in a way. We could probably have a bit to discuss on this topic.
Design patterns and what Mohn mentioned are different concepts IMHO.
Mohn made a very interesting point about how newer features are added to langs, which were not initially thought of. And sometimes the 'hack' is not so clean as in Generics in Java. I think this is just happening to make the langs more developer-friendly, which is good in a way.
Design patterns are generic solutions to a particular set of problems. Take for example the Singleton pattern. This pattern helps in creating a class of which only a single instance will exist to the most throughout the lifetime of the application. Design Patterns are solutions built over OOP's concepts.
Design Patterns are now being built into languages. Iterators we use within Java Collections can be mapped to the Iterator Design Pattern. Similarly the Java Swing API heavily uses the Observer pattern and others too. The Observer pattern can be used easily in Java by using java.util.Observer and java.util.Observable. The Proxy pattern is also implemented in a way in Java. Mohn had an example ages back(.. which I still haven't read completely!!). The MVC pattern was initially thought of in SmallTalk. But nowadays many languages(or should i say libraries) provide MVC out-of-the-box. Like Mohn mentioned about ASP.NET v2. We now use many Design Patterns without even realising they exist. Many patterns are adapted to better fit the framework so look totally different.
So is this the author is talking about?? But again what I am talking about are not language extensions .. rather just API additions. Mohn mentioned language extensions but somehow I could not relate those to Design Patterns... Any ideas??
Sunday, June 05, 2005
Are Design Patterns How Languages Evolve?
Saturday, May 21, 2005
Re: Integrating OpenEJB with Tomcat 5.0
I know what you guys are thinking - "Dinesh talking about EJB
Welcome to the Dark Side!! Btw how many of you all like Star Wars??
I guess you all know that Tomcat is not an EJB Container and as such requires external support for it to work with EJB's, well I at work have been reading on EJB's for the past few days and as usual being my impatient self, just couldn't contend myself with reading the book, I had to see and run some code. Well, I already had Tomcat installed so I was wondering if there's anything I can do to get it working with EJB's and that's when I fell upon OpenEJB. (I think there's also Jboss)
I'll just give a brief intro. Tomcat is a J2EE Web Container which can be used to deploy Java Server Pages(JSP) and Servlets both of which are used to create dynamic web pages. Open EJB is (i suppose) just an EJB Container which allows you to deploy EJB's. OpenEJB and JBoss are open source implementations.
Revo, you'll really love this, that's if you already haven't done it. Just try it out, it's really simple and yet so powerful.
You mean calling EJB's from JSP's or Integrating OpenEJB and Tomcat?
I have used Sun's Reference Implementation(RI) J2EE App Server for deploying my EJB's. The RI includes Tomcat as a Web Container so you do not have to manually integrate. Also the RI has a good admin console. The RI is free for use. I am not sure about the source. I haven't used OpenEJB. I guess the RI will be more user friendly.
It was a great moment to see my SessionBean being called from my jsp. A good experience, but yet I'd rather be writing cryptic C++ code ;)
I am sure you have read about the functionality provided by J2EE App Servers.. all the distibuted stuff.. implicit middleware etc. Writing an app to achieve functionality like this will really take a huge team and loads of cryptic code. Btw are there any C++ App Servers which provide such services??
Also I spoke of the Dark side. EJB's are difficult to use. Don't Make me Eat the Elephant Again is an article that talks a bit on what the situation is today. There are alternatives to EJB like Spring + Hibernate which I have been hearing a lot of but have never had time to read about. Also the EJB 3 release will be coming soon which is based on J2SE 5.0 and heavily uses annotations which should really simplify coding.
Mohn.. could you mention a little about how the .NET framework handles persistence for the Enterprise?? I have heard that it is simple compared to the Java model.
Re: Adventures with Linux
Looking around I came across ndiswrapper on sourceforge. This is a really neat project which uses windows drivers to get linux to recognize the card. I had some trouble with the newest vesion (1.1), so tried different versions (.10, .09), compiled and can it. It worked! So configured "wlan0" and now writing this post in Opera 8.0 on Mandrake 10.0! Just had a feeling of euphoria!
Woohooo... Congrats man on finally getting your wlan working. Mohn had asked me to help with ndiswrapper ages back.. and as lazy as I am, he had to do it himself!!
You would think that having struggled with it for so long, I would be quite sick of it. In some ways I am, but I've also learnt a lot in the process. And this is the essence of Linux.
Exactly. There are so many things we just take for granted when we use Windows. But only for customization etc when you go deep into Linux do you understand a lot more about the OS and other stuff.
Thursday, May 19, 2005
SciTE Text & Code Editor
Recently I came across SciTE which in my opinion is one of the best I have ever used. It's simple and extremely fast. It's also extremely customizable and supports an array of programming languages!!
I think I'm going to stick with this editor for quite some time, hope you guys check it out!
Dinesh.
Wednesday, May 18, 2005
Integrating OpenEJB with Tomcat 5.0
I know what you guys are thinking - "Dinesh talking about EJB, GIVE ME A
BREAK!!" ;) But as the Walrus said "The time has come to talk of many
things" :)
I guess you all know that Tomcat is not an EJB Container and as such
requires external support for it to work with EJB's, well I at work have
been reading on EJB's for the past few days and as usual being my
impatient self, just couldn't contend myself with reading the book, I
had to see and run some code. Well, I already had Tomcat installed so I
was wondering if there's anything I can do to get it working with EJB's
and that's when I fell upon OpenEJB. (I think there's also Jboss)
I will not go into what you should do inorder to integrate the two cause
there's already an excellent article available on the subject at OnJava.com.
Revo, you'll really love this, that's if you already haven't done it.
Just try it out, it's really simple and yet so powerful.
It was a great moment to see my SessionBean being called from my jsp. A
good experience, but yet I'd rather be writing cryptic C++ code ;)
(Sorry, I'll be me, always!)
Dinesh.
Tuesday, May 17, 2005
Adventures with Linux
Here's a brief history of my dealings with Linux as a total newbie (warning: boring stuff ahead). What got me interested in Linux, was my India trip in summer 03 when Rahul and Hrishi were using it. Before that, I never really thought about trying it out and didn't have much interest in it. But the way they spoke about it, I couldn't resist having a go at it. So after coming back, I installed Red Hat 9 on a couple of machines. At the time, I had a network setup over the phoneline and wasn't able to get Red Hat to recognize the NIC. Basically I gave up after several futile posts to message boards and many email exchanges with Rahul. Last May, I installed Mandrake 10 in the hopes that it would work. No luck there either. I realize it was my network setup - which was quite rare. So I gave up on that too. Last summer, I changed over to a wireless network. This time, I was a little more hopeful because this was a more common network setup. Anyhow, long story short, I had a usb wireless adaptor and Mandrake didn't recognize it. I remember spending an interesting afternoon with Rahul on messenger giving me step by step instrutions to recompile the kernel with added support for wireless drivers. Unfortunately, didn't work. Also tried Knoppix without luck. Finally, I installed Mandrake on a laptop which had a wirless card built in. This was pcmcia so I was hoping for better. Again, no luck.
Looking around I came across ndiswrapper on sourceforge. This is a really neat project which uses windows drivers to get linux to recognize the card. I had some trouble with the newest vesion (1.1), so tried different versions (.10, .09), compiled and can it. It worked! So configured "wlan0" and now writing this post in Opera 8.0 on Mandrake 10.0! Just had a feeling of euphoria!
You would think that having struggled with it for so long, I would be quite sick of it. In some ways I am, but I've also learnt a lot in the process. And this is the essence of Linux.
I'll post some stuff about some stuff I've liked about Linux next time.
Monday, May 09, 2005
RE: Stroustrup's Interview Leaked...
Friday, May 06, 2005
RE: Stroustrup's Interview Leaked...
RE: Stroustrup's Interview Leaked...
Dinesh.
Thursday, May 05, 2005
Implementing "finally"
I wrote a really simple method that just has a try, catch, finally block and examined the bytecode generated using this really cool Eclipse plug-in.
Here's the java code...
public void testFinally()
{
try
{
System.out.println( "try" );
}
catch ( Exception ex )
{
System.out.println( "catch" );
}
finally
{
System.out.println( "finally" );
}
}
and here's the bytecode...
// testFinally()V
L0 (7)
GETSTATIC java/lang/System.out: Ljava/io/PrintStream;
LDC "try"
INVOKEVIRTUAL java/io/PrintStream.println(Ljava/lang/String;)V
GOTO L1
L2 (9)
ASTORE 1
L3 (11)
GETSTATIC java/lang/System.out: Ljava/io/PrintStream;
LDC "catch"
INVOKEVIRTUAL java/io/PrintStream.println(Ljava/lang/String;)V
L4
GOTO L1
L5 (14)
ASTORE 3
JSR L6
ALOAD 3
ATHROW
L6
ASTORE 2
L7 (15)
GETSTATIC java/lang/System.out: Ljava/io/PrintStream;
LDC "finally"
INVOKEVIRTUAL java/io/PrintStream.println(Ljava/lang/String;)V
L8 (16)
RET 2
L1 (14)
JSR L6
L9 (17)
RETURN
L10
LOCALVARIABLE this Ltest; L0 L10 0
LOCALVARIABLE ex Ljava/lang/Exception; L3 L4 1
MAXSTACK = 2
MAXLOCALS = 4
I don't understand bytecode. I would be interested in knowing more about it. But anyway, you don't need to be a bytecode specialist to understand how "finally" is always executed regardless of exception or not...
This is the "try" part
L0 (7)
GETSTATIC java/lang/System.out: Ljava/io/PrintStream;
LDC "try"
INVOKEVIRTUAL java/io/PrintStream.println(Ljava/lang/String;)V
GOTO L1
and this is the "catch" part
L3 (11)
GETSTATIC java/lang/System.out: Ljava/io/PrintStream;
LDC "catch"
INVOKEVIRTUAL java/io/PrintStream.println(Ljava/lang/String;)V
L4
GOTO L1
Notice any similarities? What is at "L1"?
L1 (14)
JSR L6
JSR is a jump instruction. So all this does is just to location L6. As you would suspect, it is the finally block...
L6
ASTORE 2
L7 (15)
GETSTATIC java/lang/System.out: Ljava/io/PrintStream;
LDC "finally"
INVOKEVIRTUAL java/io/PrintStream.println(Ljava/lang/String;)V
Voila. Mystery solved!
I have to say that the bytecode is NOT the most diffcult thing in the world to interpret. A lot of it is pretty self-explanatory. I realize this is a real toy example and it gets more complicated, but it looks like something one can pick up. It's the same situation with IL code in the .NET world. I think maybe IL is a bit easier to read.
Maybe not the most important thing, but something that's interesting and nice to know.
The essential Java language library
Seems like a decent list. Of the books mentioned, I can vouch for "Effective Java". Haven't read Bruce Eckel's "Thinking in Java", but he's a good writer... "Thinking in C++" was a good read and we've included him in many of our discussions! And I know Rahul is a big fan of "Design Patterns". As far as sites are concerned, onjava.com and theserverside.com have decent articles. onjava.com is part of oreilly which I really respect.
What are some of your fav books? We discussed books we'd LIKE to read long back, but what about books you've already read? I'll mention three - "Applied .NET Framework Programming", "Effective Java" and "The C++ Object Model". I really like books that go into detail and explain HOW things work, you know what's going on underneath the covers or talk about best practices rather than just talk about syntax. I think all these three do that and more.
Java turns 10
Warning - celebration is pretty pathetic.
Monday, April 11, 2005
Re: More on Mono
When you try to make something too systematic, you run the risk of unnecessarily complicating matters. It's for us to decide where to draw the line. Use the 'formal' tools on a broad level but don't limit yourself to those or try to adhere to them like they're sacrosanct. Keep the big picture in mind and let creativity gain the upper hand! At the same time, you can't just 'hack' your way through in large apps. It's for the individual to optimize based on his requirements.
As far as mono goes, I don't have experience with it but based on whatever little I've read/heard about it, here's my two cents anyway! I don't have a great feeling about mono. It might pick up, you never know but if I were to develop a software, I wouldn't use mono! It's hard to give precise reasons; it's just a general feeling you get.