Wednesday, May 31, 2006
Technical (Java) Interview Experiences and tips - I
| I'm much more composed now than I was 6 hours back. The last post which I decided not to take down speaks volumes about my state of mind then. I wrote that minutes after that grilling 55 min interview. Just a little background on what's going on. I'm looking out for a job because we are relocating to a new city and I began interviewing with prospective employers today. I went through a similar experience just 3 months back. For whatever reason, this experience is frustrating and teaching me so many lessons. So I decided to hell with anonymity and decided to blog about it here. Some Do's and Dont's. The process of getting a Project Lead job in India involves the following steps : Precursor 1. Making a resume and I confess I'm not very creative at it. 2. Posting a resume in a job portal or through referrals. 3. Answering to hundreds of e-mails from thousands of consultants within hours of posting the profile. 4. Hundreds of calls come for administrators and network guys if you are looking for a project lead position. Everything is software and IT for consultants. Its their job and they don't give a damn. Finally when something materializes, REAL interview calls start coming in. The criteria for every company varies. You can judge the kind of organization you are getting into by the way interviews are organized and conducted. Just like they say you can judge a man by the company he keeps, you can judge a company by the HR personnel the company employs. Every company typically has about 4-5 round of interviews of which atleast 2-3 are technical nature varying in complexity. What went wrong today? Interviewee - that's me : 1. preparedness : If you are not prepared, do NOT agree to take an interview. If you do, then only 2 things can happen. Either you try to prove that you are smarter than the interviewer or you end up saying "I don't know" for the answers you know too because you are not confident. 2. Location : The place where I took the interview was just not right. It was in the open with 37 deg C Sun rays right over my head that made my temperature and temper rise. Otherwise I think I did a good job. Interviewer: 1. If you ever happen to interview someone, please review the role you are interviewing the person for. Asking the person what each member in "system.out.prinln" does not make any sense. How many times do you really care before writing system.out.println as to what it does? 2. No Googling: Please please do not Google for Java Interview Questions and ask questions from there. People are smart enough to do the same before taking an interview. 3. Ask questions relevant to what is needed to get the job done and what you encounter daily in the project. Ask design and architecture related questions for a project lead and not what is the difference between classes111.zip and classes12.zip. Test for spontaneity and practical application, not theoretical knowledge. 4. Focus not on you: Your motto is to judge how good the person you are interviewing is. Your motto is NOT to prove that you are better than the person you are interviewing. I'm sure you get more chances and avenues to do that on a different forum. 5. Do NOT test syntax : In this age of Rapid Application Development, asking someone for the syntax of something is the most stupid thing one can do. IDEs do that for you. Use your gray cells to remember design patterns and better stuff. 6. Test the aptitude : Aptitude to be able to judge the right solution and the attitude to get the solutions by any means is what you need to test. Understand that one would not have answers to all the problems and one need not know anything. 7. Area of Expertise : Interview and explore their knowledge on an area of expertise extensively. A little knowledge of everything is not what you need. My interview this afternoons spanned from normalization techniques of databases to textbook definition of joins to Rational Unified Processes to Project Manegemnt tools to Reflection API of Java. What are you trying to judge by interviewing on all such varied topics? Have a focus area and attack that! 8. Problem Solving Approaches : The way a person thinks comes out best when you ask him/ger to solve a problem. I like ThoughtWorks way of interviewing. First they give youa problem to solve and then in the later round, ask you to critique it and improve the solution. |
Wednesday, May 24, 2006
Interview Questions for all type of Interview
Thursday, May 18, 2006
How to become a Java Developer?
| Who is this post for? Anyone trying to switch careers ( I was in mainframes, asp then php developer then a swing developer before I switched to this web-app java development), or who is already in Java and wants to get to the next level. What this post is about? Few years back I was slogging on a swing app without knowing what the market was all about - though the swing app taught me the good and bad about Java - it did not help me in getting a job. This post is a guideline for that directionless soul... this.post : Heres some philosophy of mine. Ask yourself - how much did you spend last year on books on technology? If technology is your livelihood, think of it as an investment. You need to invest a lot ( and read a lot ) to get good returns. So do not hesitate to buy books, magazine subscriptions - its worth every penny/paisa/rouble. Lets start. Step 1 : Get to know Java's strength. Assuming it was me years ago, happily coding php in dreamweaver and nodding along with the posters in slashdot who say how bloated and slow java is and how fast and nimble php or any scripting language is...Here are some of the arguments "for" java to that nay sayer that I was. Java is not for a 10 page web application. Java is not for a guest book like application. Java is for an enterprise. Something big - really big - having some 500 plus pages, 100 or more modules. Java is when you need your app to scale to crazy levels - say 2000 users per second? Java is when your app has to live and be maintained over a period of - say 10 years? Java is when your client wants important stuff like transaction, security, clustering, fail safe Java is when you have a team of 20 or more developers, 10 or more Analysts and a no-nonsense client who will sue your company for any goof ups. Ask yourself and try to find answers. How has Java become to what it is today? Sun is not microsoft when it comes to hype, marketing - still - how did Java become the next COBOL? ( meaning - something the enterprise trusts, and also there are lot of developers with Java expertise ). Why is there such a huge ecosystem in the Java world? Frameworks ( Spring, IBatis, nano container, pico container, Struts), IDEs ( IntelliJ, Eclipse, Netbeans, JDeveloper, WSAD), Webservers ( Tomcat, Weblogic,Websphere,Oracle App Server,JBoss), Object Relationship Mapping ( Hibernate, Toplink), Tools ( JUnit, Ant, Maven, Cruise Control), EJBs ( Entity, Session and Message Driven ) and the above list is not even 50% complete. Its a little overwhelming but it all makes sense - each one exists to solve a specific problem. You need not try and understand everything in one go - you simply cannot and even the most experienced developer might not know all. But once you have the fundamentals in place you can quickly master any of the above technologies or the new ones that are being cooked right now. I have given you a nice path to go from a dabbler to becoming a master - that I found through trial and error and from my friends and co-developers. So rest easy and keep reading. Check this link - comparision of programming languages to see for yourself how Java is doing. Step 2 : SCJP, fundamentals It takes a month of preparation to clear SCJP - Sun's certification program. What do you get out of this? Very clear understanding of the language's syntax OO Basics - Polymorphism, Inheritance, Encapsulation - are drilled into you Collections - A Java Developer's best friend I strongly suggest you take the SCJP exam. Everything else is built on top of this so its very essential to have a clear understanding of Java. Books I own : Head First Java, Khalid Mugal's book for SCJP. Step 3 : Jump into web application world Download Tomcat. Download Eclipse. ( Notice the No in Notepad.) Write a simple hello world servlet and print it on a web page. Send a string on the response to a JSP page and print the value on the JSP page Download mysql database server and start it up. Connect to mysql and try saving some data. Dont worry about the beauty of code, design etc- just get it working. Move on to Struts and see what MVC is all about. I have 2 posts on struts on my blog. If you have patience try reading them. Try writing a simple web application - a guestbook - in Struts. All along you might be asking - why the heck do I need to do so much? Again the answer is these technologies were not designed for a small app in mind. Its for a goliath - an enterprise. Here are some design tips : 1. Separate the business logic from the Action Servlets. Write unit tests to test the business logic. Write unit tests before you write business logic. This is called Test Driven development (TDD). Net is full of resources - this is a powerful programming style - and my company - thoughtworks - believes in it strongly unlike any other company. 2. Separate stuff like Database connection into seperate objects - and use that object in those objects that need database access. 3. Most important - keep all logic out of your JSPs. Its only for presentation. The most complex logic a JSP page can ever have is iterating a collection and displaying it on the page. If you are curious, explore custom tags - so you can even move most of the logic needed for presentation into java class files. Books I used : Head First JSP / Servlets, Struts in Action. Step 4 : Become a smart Java developer - with your best friend - Ant. Ant probably is the most widely used tool. Get to know Ant - try incorporating starting and stopping tomcat inside your build.xml. So you can do cool things like : ant startserver ant stopserver ant runalltests ant can also compile your application ant can deploy your applicaton ant can win you girls. Step 5 : Get adventurous Incorporate hibernate Try doing some AJAX stuff in your app - its very very easy - and might give you the edge in a job hunt Step 6 : Next step Having a fair knowledge of Java, Struts can get you a entry/medium level developer position. To go to the next step you can explore the following areas : EJBs - Great concept but bad reputation - Read Head First EJB. Design Patterns - Get to know Factory pattern, Command pattern - my favorite and the rest - Read Head First Design Patterns book. SOA, Web Services - These buzz words are picking steam this year - find out about them and arm yourself for that curve ball in the interview. If you have specific questions, email me or post a comment here and I will be more than happy to respond to your question. Good luck and welcome to the world of Java !! |
0 to struts in 60 minutes
| Steps to build a struts application Struts has become a standard for web applications. It lets you fit your web application in a MVC framework - which earlier I had wrongly thought - MVC is only for desktop GUI clients. What is MVC? M-Model V-View C-Controller Model deals with the data - JavaBeans containing the data. View deals with how you want to display the model Controller - How the model and view are to be controlled Lets take the example of a login process. Here is the scenario : User enters login name, password hits submit. The form data are sent to a servlet that talks to the database to see if the information is valid. If it is valid, it puts the name, role information in a javabean and sends the browser to a welcome page. If not it sends the browser an error page. Now with MVC scenario. When the user hits submit, the control does not directly go to the servlet but to a controller servlet. The form values are put in a javabean ( model ). The controller's main job is to see what the request is and finds the correct servlet to work on it - in this case the login servlet. The login servlet then authenticates and sends either of these two words : success or failure. Also if the authentication succeeds it puts the name,role information into a javabean ( the model ). The controller if it sees the return value as "success" sends the browser the welcome page ( view ) . The welcome page takes the value from the javabean ( model ) and displays it. You might be thinking what do we call the login servlet - the model or the controller.You might also think it lies somewhere between the model and the controller - but actually its the model. It just tells the controller where the logic flow should be going next - but it cannot change the logic flow by itself. Only the almighty controller has the power to change the logic flow. What are the advantages of MVC? * The control logic is in one place. Otherwise the servlets, jsps have fun throwing the logic between one another - and when it comes to maintenance mode its a headache when one has to follow the trial. Now if we have all the logic flows in one place its enough to go to that one place and see how things flow. In Struts this logic flow, controller, is held in an xml file - struts-config.xml. Now you can play with the logic flow - lets say for some reason you do not want to show the welcome page but want to directly take the users to another page. You need not touch the servlets ( means compiling, testing etc. ) - vs - you touch the struts-config.xml file - make the change you want to do - and restart the server. ( no recompiling, testing is necessary yes - but need not worry about the servlets throwing any exception etc.. as we never touched the servlets ). * Lets say you want to toss out the current JSP view and have a new design. All you have to make sure is you display the javabeans in the right places. The Model and controller need not be touched at all. Isnt it beautiful !! * Lets say you change the model - for instance your application goes the EJB way. Authentication is not done with a simple servlet but by a complex session bean. As long as the session bean creates the same javabean with name,role - the View(JSP page) need not be touched at all. * Lets say tomorrow a new version of Struts comes - or another alternative to Struts comes along - it has a new controller - instead of struts-config.xml file they change a couple of things. No problem your model, view never get affected. What you need? Tomcat MySQL Eclipse A web browser Coffee/Tea Where to start? Go to the wonderful Apache site. http://struts.apache.org/download.cgi Download the binaries. Unzip it. There will be a directory called webapps. There is a nice little template file called struts-blank.war. Rename it as antiPC.war ( anti ProCrastinator - thats the name of our struts app - you can name it whatever you want ) Start tomcat. Go to tomcat manager ( http://localhost:8080 ) and deploy this war file. Tomcat will neatly unzip the war file and deploy the application too. Click on the link for antiPC http://localhost:8080/antiPC You should be able to see the welcome message. If not try to fix the problem. Look at catalina.out to see if there is any error messages, missing class library anything. And then? Time to start working on our struts application. Fire up eclipse. If you havent installed sysdeo eclipse plugin its a good idea to install it. Google for sysdeo plugin and load it in. Its useful. Start a new Java Tomcat project (antiPC) and make it point to webapps/antiPC directory. PS: If its not windows OS - eclipse might start throwing tantrums saying file not found. In your terminal editor navigate to the directory where webapps is. See the ownership of antiPC directory - it might be root. So do a sudo chown -R youruserid antiPC build.xml - the oxygen for your struts app !! It cannot live without it. In eclipse navigate to antiPC/WEB-INF/src/build.xml The build.xml cleans,compiles,generates javadoc and creates war file for deploying. We can remove the last 2 steps for now. So make these changes from : from : to: Click on the WEB-INF/src directory and click on Run as ant build. It should say something like this : Buildfile: /usr/local/tomcat/webapps/antiPC/WEB-INF/src/build.xml clean: [delete] Deleting directory /usr/local/tomcat/webapps/antiPC/WEB-INF/classes [mkdir] Created dir: /usr/local/tomcat/webapps/antiPC/WEB-INF/classes prepare: resources: [copy] Copying 1 file to /usr/local/tomcat/webapps/antiPC/WEB-INF/classes compile: project: BUILD SUCCESSFUL Total time: 4 seconds And thennnnn? You are all set to play with your struts application. Next I will explain how to set up a login page, connect to database, etc. |
Monday, May 15, 2006
Java Interview attended by our Banta Singh Enjoy :-)....
| Q. What is the difference between an Abstract class and Interface? A. Terms are different ... nothing more Q. What is JFC ? A. Jilebi, Fanta & Coffee Q. Explain 2 tier and 3 -tier Architecture ? A. Two wheelers like scooters will have 2 tyres and autorickshaws will have 3 tyres. Q. I want to store more than 10 objects in a remote server ? Which methodology will follow ? A. Send it through courier. Q. Can I modify an object in CORBA ? A. As you wish , I do not have any objections. Q. How to communicate 2 threads each other ? A. Non living things can't communicate. Q. What is meant by flickering ? A. Closing and opening of eyes at girls. Q. Explain RMI Architecture? A. I am a computer professional not an architect student. Q. What is the use of Servlets ? A. In hotels, they can replace servers. Q. What is the dif ference between Process and Threads ? A. Threads are small ropes. Make a rope from threads is an example for process. Q. When is update method called ? A. Who is update method? Q. What is JAR file ? A. File that can be kept inside a jar. Q. What is JINI ? A. A ghost which was Aladdin's friend. Q. How will you call an Applet from a Java Script? A. I will give invitation. Q. How you can know about drivers and database information ? A. I will go and enquire in the bus dep ot. Q. What is serialization ? A. Arranging one after the other from left to right. Q. What is bean ? Where it can be used ? A. A kind of vegetable. In kitchens for cooking they can be used. Q. Write down how will you create a binary Tree ? A. When we sow a binary seed , a binary tree will grow. Q. What is the exact diffe rence between Unicast and Multicast object ? A. If in a society, if there is only one caste, then it is Unicast, else it is multicast |
Wednesday, May 03, 2006
Top 10 Interview Questions
| To help you get started, here are 10 probable questions that you will be asked during the interview process, along with some suggestions on how to answer each. But first, some general tips: 1) don't feel as though you need to literally answer the question; 2) be brief in your response, yet be prepared to expand should you be asked to do so, or should you judge it a good opening for a more complete response; and 3) be positive in your responses, even when the question is negative. 1. Why did you send me your resume? Suggestions: Emphasize what you can do for them versus what you want from them. Shape your response along the lines of, "I sent my resume with the belief that my skills of A, B and C, along with my experience of X, Y and Z, would prove a valuable resource to your company." Example: "I sent you my resume, highlighting my technical talents in IT along with my managerial experience, confident that you would see me as a valuable resource. Allow me to be more specific as I learn more about your immediate needs." 2. Tell me about yourself... Suggestion : It is tempting, with such a question, to tell your life story. Resist this temptation. Respond with a quick overview highlighting your skills and accomplishments, and flavor your answer with a comment about your style and personality. Example: "My career is a balance between the technical and managerial. Early in my career, I focused on providing technical solutions to business problems, and, more recently, on providing solid leadership in the re-engineering of the IT department. Beyond my many skills and experience, I believe my success is due largely to my ability to quickly engage others, motivate team members and clearly communicate." 3. How can you help us? Suggestion: If there are identifiable corporate needs, than address them; if not, then be careful not to go out on a limb saying you can do certain things that may not be of interest. Rather, turn the question and response from what you CAN do, to what you HAVE done. Example: "Not knowing the particulars of your current situation, allow me to share with you some recent successes which are representative of my talents. (give an example and quantify) With that said, may I ask how that begins to address your needs?" 4. What are your strengths? Suggestion: Be selective of your many strengths and choose three or four that directly relate to the position or identified corporate needs. Sometimes a mere listing of skills has high impact and is most effective. Yet, be prepared to expand and give examples if prompted. Example: "Three strengths or skills quickly come to mind: namely, 1, 2 and 3. (pause) I mention these particular skills or strengths because they have served me well throughout my career and, I believe, would prove valuable to your company as you address issues of A, B and C." 5. What are your weaknesses? Suggestion: Minimize your response. Even though the interviewer might ask for "weaknesses," give just one at a time. Make it realistic, yet don't give ammunition to fire back at you. Mention some "weakness" that in a different context might be considered a strength. Example: "I'm tenacious and I hate to give up, yet I do realize the value of time and the importance of not taking decisions to halt an effort as a personal failure." 6. What types of problems do you like to deal with? Suggestion: Not all problems are negative. Sometimes it might involve fixing something that is broken, although it could also involve capitalizing on an opportunity. Reflect for a moment on the position and why that position exists, then reference some responsibilities and activities in which you thrive and which you believe would contribute to that company's productivity, grow and profit. Example: "I enjoy a mix of problems, both the quick daily problems that I can address based on my knowledge and experience, as well as larger problems that involve input from many sources, careful analysis and strategic thinking. My preference, too, is toward quantitative issues that can be resolved in a matter of weeks." 7. How do you motivate others? Suggestion: Think for a moment about human behavior and your philosophy of managing; then comment on your style of encouraging and supporting others toward completing a common goal. Be prepared with concrete examples. Example: "Ultimately, a person can only motivate himself/herself. The role of the manager is to understand what motivates individuals and provide the support for that person to be successful. It takes patience in listening and understanding others, an expressed confidence in the person and a reinforcement of that person's progress toward a goal." 8. What would your boss say about you? Suggestion: Although we have all been criticized from time to time, be positive and highlight some of your qualities and strengths. If your relationship with your boss is strained or negative, generalize the response to bosses you have had over the years and the compliments that they have paid you. Once again, choose comments that reinforce your candidacy for the position for which you are interviewing. Example: "I've had the good fortune of having bosses who are very supportive of my work. They have commonly complimented me on my analytical and problem-solving skills. In addition, they recognize my leadership abilities and willingness to push myself and others toward concrete results." 9. What do you hope to be doing in three years? Suggestion: Indicate that you would be first looking to do an outstanding job in the position under discussion. As to the future, show your ambition, yet be realistic and avoid mentioning positions by title. Be careful not to set yourself up as a competitor with the interviewer. Example: "First, let me say that I would certainly look forward to being part of your team and am confident that I could do an outstanding job. As to the future, I think my success would bring other responsibilities. So, regarding your question, I would see myself playing an increasingly important role in the company's leadership and growth." 10. Why should I consider hiring you over other candidates? Suggestion: Emphasize that, while not knowing the other candidates, you are confident that you have the skills, experience and demonstrated accomplishments that have prepared you for such a role and that assure your future success. This question provides a perfect opportunity to close by asking for feedback and the interviewer's full support in moving forward. Example: "I have been in your position of making hiring decisions, and I have always asked the question, 'Who is skilled, motivated and most likely to fit with the team?' From our discussion, I hope I have clearly conveyed my skills and experience, and my strong desire to be part of your team. Bottom line, I am confident I can get the job done for you in a timely and profitable manner." |
Tuesday, May 02, 2006
Apache Struts Tutorial
![]() Few days back I got a very good simple step-by-step Struts tutorial, recommend for starters. It's provided with codes. Think it will help beginners to getting started in Struts Framework. Download Simple Tutorial or Download Very Good Big Tutorial |
What makes a plugin secure?
| Here are some characteristics of a secure plugin: 1. It is digitally signed by the publisher by a third party issued certificate. This way the user at least knows where the plugin in coming from. 2. Inform the user of any actions which can lead to any changes in the system before hand and allow user to reject the proposed actions. 3. Give user the option to save current system settings such that the user can go back to it after the plugin has finished execution if the user so desires. Items 2 and 3 above are sometimes the responsiblity of the application installing and using the plugin and not the plugin itself. From the end user perspective they are the same. So the the word plugin here can mean either just the plugin or the plugin together with web application driving it. Both java applets and activex components are plugins. Both are written to the disk and saved for future use. ActiveX components can be used by applications other than the web browser while for most practical purposes, java applets can only be used from a web browser (there are stanalone java applet hosting programs out there but they are mostly used by developers and not by end users). The ActiveX component installation requires modification to system registery and hence the end user must have administrative privilege in order to install it while Java applets don't need any adminitrative privilege for installation. One can argue that this makes a signed Java Applet a bigger security threat than an ActiveX component since even a user with minimum previlege can download and run it without the knowledge of the system adminstrator. The only way to avoid this situation is to set the browser to not allow Java Applets all together. A conspiracy of the Microsoft haters? Lets face it whenever it comes to deploying any technology produced by Microsoft, there are always two camps: one which loves it for its simplicity and ease of use and the other which hates it just because it came from the "evil empire". The case of ActiveX vs. Java Applet is even more polarized since it also involves a technology produced by Sun Microsystems, by far the most visible Microsoft adversary. I hope after reading this blog, you examine the security issues related to ActiveX and Java applets in a technology neutral manner as both can be written in a secure or malicious way. |
