C or Java for Seismology Equipment: What's Best

In summary, the conversation revolves around whether it would be better for the person to spend time learning C or converting the software to Java. The group agrees that learning C would be the most efficient option, as the syntax is similar to Java and picking up a second language is easier than learning the first. However, the person expresses concerns about the difficulty of C and the potential for errors. Suggestions are made for using a translator or finding a Java driver for the equipment. The conversation ends with resources for learning C being shared. Overall, it is recommended for the person to learn C in order to effectively control the equipment.
  • #1
mgiddy911
335
0
I may be taking control of the running of some seismology equipment, which is run via C code. I know very very little about C code. Would it be better for me to spend the time to thoughroughly learn C, or could it be possible for me to convert the software to Java. I have a pretty god understanding of Java. If I knew the concepts behind the C code I may be able to formulate an dea of how to do the same thing with java.
Let me know what you think
 
Technology news on Phys.org
  • #2
If you know Java thoroughly, picking up C should be a piece of cake. I personally wouldn't convert anything -- just learn C.

- Warren
 
  • #3
Thank you for the suggestion, I sort of knew the answer was going to be just learn C, but I am very busy and it will take me a long time to learn C right now, i was hoping just somehow there'd be an easier way, But it looks like I'll just have to brush up on C, which I am assuming is going to be quite different than any programming I am used to.
 
  • #4
The syntax of C is virtually identical to the syntax of Java, with the exception that C does not have classes or exceptions. Java syntax was actually chosen specifically because it would be familiar to C programmers. Don't worry, it probably won't be nearly as difficult as you might imagine. Picking up a second programming language is much, much easier than learning the first.

- Warren
 
  • #5
Until he finds pointers...
 
  • #6
Almost everything in java is a pointer. :tongue:
 
  • #7
I would say going backwards (Java to C) would be much easier than the other way around.

I thought there is some tranlators that can convert C to Java (or at least C++ to Java which would work). You could look into that and give it a test run. As long as you save your original code, trying a translator couldn't hurt.
 
  • #8
Java and C might look similar but they are a few light-years away. Most notably Java is an OOP language, C is not. Java makes it hard to screw things up while in C...

In C you must be very very careful. Even at simple things such as reading a line from the Console is pain. e.g. you should not use fgets function since the user can supply null input or gets() is also a dangerous function that can be overflown. Therefore you should use the getline() function but it is not part of the ANSI C only GNU C there is ... complicated even at simple things, and don't get me started on pointers...

You can't just automagically convert C program to Java and expect it to work. You can rewrite the same C program in Java but you should be very careful, it is very easy to make a copy paste error.

I would recommend you, if you have the programm running in C, learn good C programming and just use C to do the job.

On the other hand you can make a GUI or whatever in Java and call C functions from Java via the JNI but that is a bit advanced.

Controlling equipment? Maybe there is a "driver" for Java? I am only a bit familiar with EPICS but I know that you need not program in C, you can get a "driver" that enables you to program in Java (CAJ/JCA) and the driver then takes care of the C part.
 
  • #9
I don't think it will be a piece of cake, to be honest. I went from Java to C and though the elementary syntax is the same, the general approach is very different. Especially since you'll be reading someone else's code. If the code is more than a small app, expect on spending some time on it. These will be helpful:
http://beej.us/guide/bgc/output/htmlsingle/bgc.html
http://www.cs.cf.ac.uk/Dave/C/
 
Last edited by a moderator:
  • #10

1. What is the difference between C and Java for seismology equipment?

C and Java are both programming languages commonly used in the development of software for seismology equipment. C is a low-level language that is closer to the hardware and allows for more control over system resources. Java is a high-level language that is more portable and easier to learn. In terms of seismology equipment, C may be better for applications that require high performance and low-level control, while Java may be better for applications that require cross-platform compatibility and ease of use.

2. Which language is more commonly used in the seismology industry?

Both C and Java are commonly used in the seismology industry, but their usage may vary depending on the specific application and organization. Some companies may have a preference for one language over the other, while others may use a combination of both. It is important to research the specific needs and requirements of the organization before deciding which language to use.

3. Are there any limitations to using C or Java for seismology equipment?

Both C and Java have their own limitations when it comes to developing software for seismology equipment. C may require more time and effort to learn and may have a steeper learning curve, while Java may not have the same level of control over system resources. It is important to consider the specific requirements of the project and the strengths and limitations of each language before making a decision.

4. Can C and Java be used together in seismology equipment development?

Yes, it is possible to use both C and Java together in the development of seismology equipment. This may be beneficial for projects that require a combination of low-level control and cross-platform compatibility. However, it may also add complexity to the development process and may not be necessary for all projects.

5. Which language would you recommend for beginners in seismology equipment development?

If you are new to seismology equipment development, Java may be a better choice as it is generally easier to learn and has a larger community for support. However, if you have experience with other programming languages, C may also be a viable option. Ultimately, the best language for beginners will depend on individual preferences and the specific requirements of the project.

Similar threads

  • Programming and Computer Science
Replies
2
Views
831
  • Programming and Computer Science
Replies
3
Views
3K
  • Programming and Computer Science
Replies
3
Views
2K
  • Programming and Computer Science
Replies
2
Views
1K
  • Programming and Computer Science
Replies
1
Views
677
  • Programming and Computer Science
Replies
21
Views
12K
  • Programming and Computer Science
Replies
1
Views
3K
  • Programming and Computer Science
Replies
11
Views
1K
  • STEM Academic Advising
Replies
3
Views
910
  • Programming and Computer Science
Replies
33
Views
8K
Back
Top