Bloomberg LP Interview Question
SDE-2sCountry: United States
Interview Type: Phone Interview
//
// How do you decide whether we should use Java or C++ for a
// particular project . what are pros and cons
//
// -- chad August 01, 2015 in United States
// Bloomberg LP Interview Question
//
//
// Java : Quick Development
// C++: Efficient Development
// Java: Safe Programming
// C++: System Programming
// Java: Portable for OS
// C++: More Control
//
// -- spiderman August 30, 2015 | Flag
//
// What he said.
//
// Where possible I try to use Java. The container classes as per
// the standard container library in java.util.* meet most application
// needs with ease. Of course, being familiar with all the nitty gritty
// details as to how to use Vector<type>, HashMap<type> and List<type>
// effectively comes in really handy. The number one reason why I like
// Java where possible is because of the strong type checking and the
// more efficient handling of memory allocation issues. You can still
// have memory leaks in Java but it happens much more rarely.
//
// But whatever you can do in Java you can do in C++ by way of effective
// use of the STL. You would use C++ when memory and performance issues
// are required over portability. The big issue with C++ is that your
// responsible for memory management much more than inside Java.
//
//
// (c) 2016 Perry Anderson, All Rights Reserved, worldwide.
//
//
If the project has a heavy workload of computation and is speed critical, or relies on system level functions and API's, use C++;
If the project requires intensive web utilities and running across platforms, use java.
For projects with no obvious favor of above properties, use what you feel comfortable.
Well, Java is mostly used for web based applications due to its highly portable nature. So I would recommend using Java for web applications, whereas C++ can be used to model system level applications. C++ has the advantages of both procedural and object oriented languages, so it can be used with great flexibility in designing system apps. But Java on the other hand was built for web.
- Nav August 01, 2015Pros and cons of using Java:
Pros:
1.Highly portable apps
2.Support for scripting languages, hence essential for any web based application
3.In built support for multithreading
4.Code written is highly secure
Cons:
1.High level language, so low support for developers looking to fix system level issues
2.High run time cost
Pros and cons of using C++:
Pros:
1.Extremely flexible given that it supports multiple programming paradigms
2.Provides cross platform access to multiple features available in platform specific libraries
3.No trademark issues unlike Java(owned by Oracle), hence developers have more freedom in using or even building new libraries
4.Support for automatic resource management
Cons:
1.No standard inline documentation mechanism available.
2.Support for exceptions, which is bad since C++ is primarily procedural, so it is not thread safe.
3.Memory allocation problems