Posts

Showing posts with the label Programming

Use of Private Constructor in OOPS

If we set access specifier of a constructor to private, then that constructor can only be accessed inside the class. A private constructor is mainly used when you want to prevent the class instance from being created outside the class.  This is mainly in the case of singleton class. Singleton classes are employed extensively in concepts like Networking and Database Connectivity. Using private constructor we can ensure that no more than one object can be created at a time.  Example of Private Constructor in a Singleton Class public class SingletonClass {     public static SingletonClass singletonClass;     private SingletonClass()      {     }     public static SingletonClass getInstance()      {         if(singletonClass == null)          {             singletonClass = new SingletonClass();         }     ...

Diamond Problem in Multiple Inheritance in OOPS

Image
The diamond problem occurs when two super classes of a class have a common base class.  Suppose there are four classes A, B, C and D. Class B and C inherit class A. Now class B and C contains one copy of all the functions and data members of class A. Class D is derived from class B and C. Now class D contains two copies of all the functions and data members of class A. One copy comes from class B and another copy comes from class C. Let’s say class A has a function with name display(). So class D have two display() functions as I have explained above. If we call display() function using class D object then ambiguity occurs because compiler gets confused that whether it should call display() that came from class B or from class C. If you will compile above program then it will show error. This kind of problem is called diamond problem as a diamond structure is formed (see the image). That is why major programming languages like C#, Java and Delphi don't have multiple inheritanc...

What is the difference between Singleton Class and Static Class? Which one to use and when?

Almost both singleton class and static class serve the same purpose which creates confusion among developers and architects about which one to use. When to use singleton class and when to use static class. In this article I have tried to differentiate between the two. Following is the list of differences between a singleton class and a static class: 1. Singleton classes are more inclined to the object-oriented concepts as compared to the static classes. With Singleton classes, you can use inheritance and polymorphism to extend a base class, implement an interface and capable of providing different implementations. While a static class cannot inherit their instance members. So, Singleton classes are more flexible than static classes. 2. Singleton classes can be passed as an object to other methods while a static class allows only static methods and you cannot pass static class as parameter. 3. If your requirement is to maintain the state, then singleton class is the better choice than s...

Can Software Developers enjoy their personal life?

Can Software Developers enjoy their personal life? Normally in any job around the world, you have to work for 40-45 hours a week. But is this really true for a software developer? As a software developer, if you have to grow in your professional life, you have to sacrifice your personal life. This statement is intimidating, but true to some extent. Mainly, the initial years of a software developer are very crucial and you have to work extensively to thrive in your career. Only the lucky software developers get flexible working hours in the office otherwise most of the software developers have to compromise their personal life. In a software industry, you will have to face: 1. Tight Deadlines 2. Excessive Work Load 3. Staying Late Nights 4. Working on Weekends 5. Code quality and code delivery at same time 6. Bug fixing If you are a software developer, you have to try hard to maintain work-life balance. Software development is full of uncertainties. Any time any thing can happen in your...

5 Advantages and Disadvantages of Software Developer Job

5 Advantages and Disadvantages of Software Developer Job  No job is perfect. Every job has some advantages and disadvantages. If you are enjoying your job, that job is best for you. You should carefully choose a right career for you as it can make your life heaven or hell. If you have chosen for becoming a software developer, you must know the pros and cons of this career. I would like to share the advantages and disadvantages of software developer's job. Advantages of Software Programming Job 1. Good Pay: As compared to other jobs and professions, software programming job's pay is high. 2. Portable Skills: You learn a lot of things like programming language, software tools etc. in one company and can apply that knowledge in another company. When you switch from one company to another, you also get a good salary hike. 3. Work Anywhere: You can work from anywhere. All you need is one laptop and the internet connection. Work From Home is a very good facility in this field. 4. ...

Should Interviewers ask Puzzles to Software Developers in an Interview to evaluate their skills?

Should Interviewers ask Puzzles to Software Developers in an Interview to evaluate their skills? Programming is not about writing lines of code, it is about solving problems for the people. Some interviewers ask puzzles in an attempt to gauge software developer's ability and approach to solving problems. Puzzles can be useful in assessing problem solving skills, which is of course one of the key aspects of programming. Interviewer's expectations in that case are to hear you articulate your approach to the problem. What other data would you try to gather? How would you test your hypothesizes, etc. The point of asking the puzzles is to watch how developers work toward the solution, not necessarily if they get the right answer. You can spot good programmers pretty quickly just by watching this process. The interviewer must have been referring to problem solving and logic skills, which is part of the everyday work of a programmer. When given a problem, you need to be able to analyz...

Devexpress vs Telerik vs Infragistics: Which one to choose and why?

Devexpress vs Telerik vs Infragistics: Which one to choose and why? Devexpress, Telerik and Infragistics are the great third party tools for you for both your windows and web application. These third party tools mainly support .NET technologies like WinForms, Silverlight, ASP.NET and WPF. Devexpress also supports windows application built in  Delphi programming language and I am currenty working on it. Also I have heard some other third party tools like ComponentOne, SyncFusion and Januscontrols but never worked upon them. Which one is good, which one to choose and why? Although this is difficult and time consuming task, but let's try to solve the confusion. Why do we require these third party tools for our application? These all thrid party tools are mainly used for improving the user interface which standard controls cannot provide. Devexpress, Telerik and Infragistics third party tools provide a lot of exciting features and components which you require like attractive dashboards...

24 Frequently Asked Basic SOA Interview Questions and Answers

24 Frequently Asked Basic SOA Interview Questions and Answers SOA stands for Service Oriented Architecture. If you are preparing for SOA interview, the following SOA interview questions and answers can be very useful to you. Basically, these SOA interview questions and answers cover basic concepts of SOA like services in SOA, characteristics and principles of services in SOA, loose coupling of services, contract, address and bindings in SOA, main benefits of SOA to the business and IT, difference between services and components in SOA, requirement of SOA to the business, pitfalls of SOA etc. Let's have a look: 1. What is a Service in SOA? In the real world, a service is what we pay for and we get the intended service.  Example 1 (from Real World): You go to a restaurant and order food. Your order first goes to the counter and then it goes to the kitchen where the food is prepared and finally the waiter serves the food. So in order to order an item from a restaurant you need three ...

Apple iPhone Application Development - Initial Steps

Apple iPhone Application Development - Initial Steps Today, Apple iPhone application development is in full swing and iPhone developers are in great demand. In order to develop iPhone apps, you should be a good Objective C developer. If you have good grip on C++, OOPS Concepts, I can guarantee you that you can learn Objective C easily and quickly and can start building your iPhone apps. There are a lot of iPhone apps development tutorials available on the internet and very good iPhone apps development community on the stackoverflow, so you will not feel alone if you stuck anywhere while iPhone app development. Today, companies are hiring a lot of iPhone app developers for building their iPhone apps. XCode is the full featured tool which eases your iPhone app development to a large extent. A lot of demos, sample codes, sample applications are available on the internet which can fulfil your basic iPhone app functionalities. So, I am just giving the initial steps which you should take whi...

Difference between Unicode, UTF-8 and UTF-16 (Unicode vs UTF-8 vs UTF-16)

Difference between Unicode, UTF-8 and  UTF-16  (Unicode vs UTF-8  vs UTF-16 ) Unicode is a character set.  UTF-8 and UTF-16 are both encodings of Unicode.  A character set is a list of characters with unique numbers (these numbers are sometimes referred to as "code points"). For example, in the Unicode character set, the number for A is 41. An encoding on the other hand, is an algorithm that translates a list of numbers to binary so it can be stored on disk. For example UTF-8 would translate the number sequence 1, 2, 3, 4 like this: 00000001 00000010 00000011 00000100  Our data is now translated into binary and can now be saved to disk. All together now Say an application reads the following from the disk: 1101000 1100101 1101100 1101100 1101111  The app knows this data represent a Unicode string encoded with UTF-8 and must show this as text to the user. First step, is to convert the binary data to numbers. The app uses the UTF-8 algorithm to decode th...