Examples of applications and benefits of using C, C ++ or Java

Well, I am reviewing for my upcoming 2 exams on the CS course, and probably something like this will appear. my question is what is the ideal application that will be especially useful for the programming functions of each of the three languages? I have a vague idea, but a second opinion can really help.

  • Java

    Portability, convenient for graphical interfaces.

  • C ++

    Fast, but may require significant changes to move from system to system, good for image processing.

  • C

    I am not sure about small embedded applications here

Some clarification on this will be really appreciated, thanks again StackOverflow

+6
java c ++ c
source share
6 answers
  • C: device drivers and other low-level stuff.
  • C ++: applications in which you do not want to annoy the user to install the runtime
  • C / C ++: real-time applications; or in cases where the execution time of the programs is extremely short (the C / C ++ program terminates before the jvm done); in cases where the memory area should be small.
  • Java: in almost all other cases (in the absence of a suitable domain, a specific language exists); Mobile Applications; network (especially to the server)

java performance is IMHO, no more problem. This is at least comparable to C ++, and in many cases it even surpasses C ++ - we redefined a large number of crunchy applications in Java, and it works an order of magnitude faster than the old one implemented in C ++. Surprising? Well, I think the main reason is improved tool support, faster turn cycles, and less time spent connecting existing libraries at the same time. Using Java, we have more time to focus on algorithms. In addition, some things that can slow down C ++ applications are simply not a jave issue (like creating temporary objects).

regarding GUI development, I think swing has come a long way and SWT is native, so here is also a java option.

The C ++ standard should be portable at the initial level in theory, but in practice this is not so. Not only streams, but also network access, access to the file system (i.e., a standard function for determining the size of files), etc.

And even incompatibility on one platform is a problem - we have std :: string, but how many libraries still exist using our own string classes? If I create my own GUI with one library and want to store data in a database, I must first convert.

Another example: if I want to use regular expressions, should I use boost :: regex or the GNU library?

+4
source share

Where Java really is in its element is web applications. And thanks to the development of JIT compilers, at present its speed is often comparable to the speed of C ++.

I believe that standard C ++ is quite portable across platforms, the problem occurs when you want to use things that have never been standardized. The biggest one that comes to my mind is topics.

In addition, to create an efficient, fast and elegant C / C ++ program, you need a lot of skills and experience. Without these features, you can easily make inefficient, buggy, and ugly C / C ++ programs. This does not mean that you cannot do it in Java (or in any programming language), but the main errors in C and C ++ are much more dangerous than in Java.

C is used in locations close to metal, and / or where performance and efficiency are the highest requirements, including operating system kernels and device drivers.

+7
source share

At least in my experience, it's pretty difficult to compare C ++ with Java because they follow in different ways. Almost the only way to compare them in a meaningful manner is to calculate the complexity of the graphs compared to the software “size” for both:

alt text Black line = C ++, red line = Java.

Especially if you look mainly at really small projects, C ++ may seem almost impossible - adding even a few functions is a lot of work and adds a lot of complexity to the code. This (especially) at the stage where almost everything that you do means searching, building, training, etc., Another library, which is usually not dependent on others.

For projects of this size, Java is often much more attractive - it comes with a much larger standard library, which (basically) matches roughly the same style, so what you know about one part is pretty good for the other parts. You also get things like garbage collection, so your memory management tends to be relatively trivial.

For large projects, the situation is reversed - operator overloading, which is why some of the libraries that are difficult to master also simplify their use as soon as you know how to do it. Similarly, patterns that are really hard to wrap around can solve a much wider range of problems without using new code. Instead of collecting garbage to simplify memory management, you will learn how to use RAII to simplify the management of almost all resources.

Unfortunately, it is often quite difficult to assess where a particular project lies on the horizontal axis. Worse, if it is really close to the intersection, the difference between them is usually not 10 or 15% - it will most likely be on the order of 2: 1 or 3: 1. In many cases, the choice is the difference between great success and a terrible failure. .

However, I think most of your ratings are mostly incorrect.

Portability: almost everything all over the board. Not as difficult with C or C ++ as most people think, and (unfortunately) is almost as easy with Java as they think.

GUI: Java makes it easy to work with graphical interfaces - both ugly and non-responsive. Qt (for example) has the same mobility, only a little more work, but much nicer.

Speed: rarely there is a reason for choosing one over the other. Yes, C ++ usually wins, but for most applications this will not make any real difference.

As for C, yes, this is useful for small embedded systems. Its main advantage is that it minimizes the environmental structure necessary to obtain a working system. C ++ takes a little more, and Java is much more (although this may not be appropriate if this environment is already guaranteed, such as Java on many mobile phones).

+4
source share

Well, I'm not quite sure about the superiority of Java with respect to the user interface, since there is Qt in C ++ these days. But other than that, Java is very good with regard to portability. Today JavaFX Java is also a good option for RIA and proprietary systems. And IMHO, indeed, Java is much simpler than C ++.

I also think that C is mainly for embedded systems and places in general where you need to do things related to hardware.

+2
source share
  • Java is good for portability. Built in garbage collection.
  • C ++ - Useful for processor intensive applications that will greatly benefit from OOP.
  • C is good for working at a low level, including kernels, drivers, and built-in work (although C ++ also sees more actions)
+2
source share

Just as C is simpler than asssembler, Java as a higher-level language offers many advantages to the developer.

  • Memory management is simplified.
  • Security type
  • Significantly rich library accessibility - why reinvent the wheel.
  • More rich tool support.

Theres the reason Java has taken over the world and hers because developers can do a lot more time with Java than C. Even Microsoft recognizes this and tries to encourage developers to use dot net for business applications, rather than c / C ++ . One fine day, Office itself can be a managed application (under VM), and not unmanaged (c / C ++).

Most large sites today use java, not c / C ++.

  • Gmail
  • Google maps
  • Ebay
+1
source share

All Articles