2 Questions: java calling system commands? PERL vs Java?
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
o.o Perl is OOP, but it's not as much OOP as Java, :-\ and ya know, I prefer to use console stuff my self, you may want to check out ncurses for perl...If you're interested in building gui apps for terminals
mhh...ok. Then I need your help deciding what's next on this lifetime learning programming experience. Maybe PERL is not for me either.
I'm insterested in a language that:
1. Has an easy syntax. Java is really a pain --in my humble opinion.
2. I want flexibility. I mean, I want to create shell script like programs (like calling system commands like the program above). In the above program it took me several lines just to untar a simple tarball.
3. Eventually I want to create GUI apps. The swing package in Java is just too much.
4. Speed. Not only compiling and executing the program but also coding it.
Should I go back to C, learn C++, learn PERL, stick with JAVA? your opinions are always taken in consideration. That's why I post stuff in this forum in first place.
In my opinion, java's only "grr" feature about the syntax is CaSe-sEnSitiVitY.
other wise, what's there to pain? how easy is:
System.out.println("hello!! greetings to humanity!");
or
mybutton.setBackground(Color.RED);
very nice.
There is no perfect language. They all have their pro's and con's. I'd have to agree with titanium_geek, Java's syntax is pretty good compared to some other languages. I think you're going to find that for what you want to do, you're going to have to learn more than one language. I'd stick with one and learn it well. I'd start with C. I started with Java and then learned C and I felt like I was doing it backwards. You might want to check out this link as well.
Eventually I want to create GUI apps. The swing package in Java is just too much.
Unfortunately, most GUI libs are fairly complicated. Personally i find Java's Swing to be fairly well designed (ignoring the mess that original awt was).
From the list that you gave though, i think Perl would be the better choice for you right now (+ Tk for gui).
Originally posted by randomx mhh...ok. Then I need your help deciding what's next on this lifetime learning programming experience. Maybe PERL is not for me either.
I'm insterested in a language that:
1. Has an easy syntax. Java is really a pain --in my humble opinion.
2. I want flexibility. I mean, I want to create shell script like programs (like calling system commands like the program above). In the above program it took me several lines just to untar a simple tarball.
3. Eventually I want to create GUI apps. The swing package in Java is just too much.
4. Speed. Not only compiling and executing the program but also coding it.
Should I go back to C, learn C++, learn PERL, stick with JAVA? your opinions are always taken in consideration. That's why I post stuff in this forum in first place.
randomX
If java syntax is a problem with you, you may not have a solid foundation in understanding how java and OOP in general work b/c it is fairly easy to pick up and understand.
But If you want speed and be able to exec programs and shell comands i would say go for C. I am learning it right now and it is easy to bang out quick code to do something.
If java syntax is a problem with you, you may not have a solid foundation in understanding how java and OOP in general work b/c it is fairly easy to pick up and understand.
I have to slightly disagree on that. True, oop isn't all that *hard*, but if you have little to none programming experience, it can take some time to trully understand it's effectiveness and use it appropriately.
As evidence i only need to look at some of the students that are in semesters lower than me, or the numerious comp sci unversity drop outs who started with java.
Most people can *understand* it, but when it comes to coding, it's a different story.
Well, actually I do have a strong background in programming. I'm just looking for different avenues. At college I didn't really have the time to explore other languages or even question the instructor of why we were using that languange instead of that one and so forth. We were using Java for upper division courses and that was it.
C and Java look pretty much the same but they smell different when it comes to syntaxing. I don't think that Java syntaxing is a problem. I think it's boring and lengthy.
I think Java syntax is boring because it requires a lot more code and compilation time to achieve something simple... that maybe some other language could have done the same task with in half the code and half the time. (See some code above this post..in the first page to prove you what I saying)
I don't know if I can give you an example but for starters, java requires like 10 commands to get input from the keyboard....it's very picky when it comes to when and where you declare the variables....to get a simple math function like exponents or factorials you need to use the Math.lang function....
I already know the power and beauty of C, the boredom of Java, and so far I getting to know the flexibility of PERL.
As somebody else said, there's no perfect language and you gotta use whatever suits best your needs. I think PERL is my next language.
randomx
PS: I think this topic is getting old --if you ask me.
I think you understand that it's merely a matter of taste. Some people like C, some people like Java. Other like both. Really, you got to use a language that's both appropriate to the task as well as easy for you to program with.
I'm personally not a great fan of Perl (there are just some things that deeply annoy me). That doesn't mean i won't use it when a job calls for it. It's good for some things, bad for others. I guess i prefer a higher level abstraction that Java offers.
So yeah, look at the Tk module, it's the gui lib you've been looking for.
I completely agree with you. Programming languages are just a matter of taste and they are certainly bounded by what you need to do.
You mentioned that PERL has some annoyances. Since I'm just picking it up I think it would be a good idea to know what type of annoyances your are refering to and what workarounds you are using to overcome those weakneses on the language. Just to be ready when I run into those limitations.
thanks again for your inputs. randomx
A third question...Do you know of any cool link or ebook or book to learn QT Designer? by the way, I loaded the perl gui library you suggested. So far so good.
Dunno, those comparisons don't really matter to me that much. Unless i'm really in the need to do something super fast and resources are limited, sure i would probably do it in C (or C++). Other than that, most pcs have more than enough resources to handle something higher up and i would save up on development time.
Most in complaints aren't related to speed or performace, but pure easy of use of the language, ie syntax, etc
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.