I have a pretty simple question for the forum, and hopefully it doesn’t spark off a huge debate between everyone. I develop web applications using PHP/SQL and recently ended up working on a project that required me to develop a standalone program in Java. It was this that got me thinking: Which language is best for programming for Linux; which language is better for something that needs to be implemented on both windows / Linux. (C or Java or etc.) I know there is some element of personal taste involved, as everyone I know uses .NET and tells me what a huge idiot I am for using PHP, but in the end I think there are real pluses and minuses involved with each.
scragar
11-30-2008, 08:59 AM
Depends entirely on the level of involvement, time and effort you are willing to put into programming perl is a classic, but it's a bit complex in some parts.
Python is becoming popular, it's a bit too heavy for my personal liking, but it's very easy to learn.
C/C++ both classics, very efficient, but the negative is that it needs to be compiled, and since windows doesn't have quite the same libraries as available on linux, BSD or mac (not to mention the messed up way windows treats libraries) you may need a bit of practice to write a sufficient make file.
assembly Yeah, as fast as you can get, in that it makes you do everything by hand, very efficient, but it will take you forever to write anything of any real size.
PHP-cli & PHP-GTK You can execute PHP scripts on the command line, and using PHP-GTK produce gui's as well, by far the least learning involved, but PHP-GTK is fairly new and buggy to the whole GUI creation programs thing, and you might need to compile it yourself if your distro hasn't got around to making a package(and I've never been able to get it to compile for 64bit yet, you sorta have to compile it for 32 bit and run it in a compatability mode, which means having 2 copies of PHP around, one 32 bit and one 64 bit, and since they will both want the same config file... let's just say it's not a pretty thing to have)
I'm sure someone else will agree or disagree with me, but meh.
drhowarddrfine
11-30-2008, 10:02 PM
Any language you use now can be used on Linux so there's no decision to make. If you want to write Java or PHP, feel free to do so. If you are forced to use .NET, you can install Mono. Just pick what you want to use.
Stephen Philbin
12-04-2008, 05:46 PM
I picked up Java last year. I chose is because I wanted to make programs I could use on my computer, but I didn't want to exclude people that use Windows and Macs from being able to use what I make. Unfortunately, though, it turns out I have accidentally excluded the majority of Mac users. I learned to build my program's GUIs using a method that requires version 1.6 of Java to be installed on a user's PC, but it seems that good ol' Mr. Jobs refuses to allow owners of Macs to upgrade their installations.
I got some mails from people that were using my Colourcoder (http://www.stephenphilbin.com/colourcoder) program. Some of them wanted to know why it worked on their Windows machines, but not on their Macs. One of them got back in touch and told me how to get version 1.6 on your Mac: buy a brand-spanking-new top-of-the-line Mac.
So I'm pretty into Java at the moment and I think the Netbeans IDE is great, but it could be a while before my Java becomes as portable as I was hoping.
svidgen
12-04-2008, 07:19 PM
If you need to develop something that will be user-run cross-platform, Java is probably the way to go.
If you need the application to run very efficiently ...
... either write more efficient code, or write it in C. But, bear in mind: unless you're using a top-end commercial compiler, your C/C++ apps won't be running top speed anyway. And if you're not writing efficient code, even a good compiler won't make your applications efficient.
As far as .NET ...
... personally, I will probably continue to avoid learning proprietary technologies unless absolutely necessary. Though, I would be interested in seeing some benchmark data to support the claims that .NET is "better" than PHP (with a caching package). Or perhaps some examples of common tasks that are significantly easier in .NET than PHP ... Anyone with links?
Also keep in mind ...
... If you need nontechnical types to be able to use your application, use a compiled language. Scripted and pseudoscripted languages (like Java) require a 3rd party VM or interpreter to be installed. Additionally, once that VM or interpreter is installed, running the application isn't always clear-cut. For example, installing JavaVM on Windows XP does not associate .jar files with the java.exe -jar, as is necessary to run the apps.
... Just some things to think about.
scragar
12-04-2008, 07:29 PM
As far as .NET ...
... personally, I will probably continue to avoid learning proprietary technologies unless absolutely necessary. Though, I would be interested in seeing some benchmark data to support the claims that .NET is "better" than PHP (with a caching package). Or perhaps some examples of common tasks that are significantly easier in .NET than PHP ... Anyone with links?
I don't understand that, caching for .net might make it run faster, whoop de do, I can, with a bit of work(OK, a lot of work), compile my PHP script directly into PHP as a module, it runs with a similar speed to C, many times faster than caching can normally achieve.
as for tasks being easier in .NET, I don't know, doesn't sound right, google a script to do a goal in PHP and you'll find hundreds of results for most tasks, google the same things for .NET and you'll most likely not find something you will be allowed to edit yourself.
drhowarddrfine
12-04-2008, 10:44 PM
I was trying to find a way to schedule a simple script or code to schedule automatically fetching a web page from a web server. It seemed an impossible task (to do easily) and I was frustrated because I knew I could do it with about 10 lines in bash. I got no responses though one guy did come up with an adequate (for now) vbscript that essentially uses the same Win32 api calls I was familiar with.
When .NET first came out, and I was trying to learn it, I complained about there being far too many functions to be able to keep track of it all. Someone who worked at a Microsoft house told me I shouldn't try because there's over 10K or 12K of them and no one can know them all. Which leads me to say that .NET is not for a small house or the lone developer, maybe not even a medium sized group.
Everything should be done in assembly.
scragar
12-04-2008, 11:03 PM
...
Everything should be done in assembly.
Ahuh, and that would take how long to produce even the more simple pieces of software?
svidgen
12-05-2008, 12:14 AM
@scragar
I think you may have misunderstood what I meant--either that or I've misunderstood what you mean. I'm for PHP and against .NET for the moment. My intention, however, is not to make my opinion seem like anything more than what is is--an opinion.
So, if anyone can provide real performance benchmarks, that would be ideal in determining whether PHP, or PHP with caching, or "customized" PHP, or .NET, or .NET with option A or B or C, etc. is more efficient. I also wonder whether .NET could be better in terms of code size and simplicity--I'm not sure, since I don't code .NET. However, if anyone has code samples to indicate a remarkable level of ease and simplicity over PHP, such code samples would be nice to see.
In any event, I'm not even sure efficiency is one of parkofgrey's concerns. And as far as which is easier or more "nice" to code in, perhaps the best way to resolve that is to ask a few .NET programmers and a few PHP programmer to code the cleanest tree (or some other data structure) they can. Then, make a decision based on whichever code is more compact or easier to understand or whatever ...
Chances are, .NET doesn't offer much over PHP aside from a commercial library of compiled tools for complex tasks--which can actually be really handy for some projects.
@scragar and @parkofgrey
So, what are we primarily looking for in the "best" language here? Are we looking for something that runs amazingly efficiently? Something that's easy to distribute to various OS's? And if so, are we speaking in terms of web applications? Is our concern being able to generate code quickly and efficiently, due to the natural elegance the "best" language has? Are we looking for a large open-source support group? Or perhaps we're looking for access to professionally (commercially) written pre-compiled modules that have teams of programmers working to ensure that specific complex tasks run like the wind.
... well?
drhowarddrfine
12-05-2008, 01:44 AM
Ahuh, and that would take how long to produce even the more simple pieces of software?Not much longer than when I code in C, but I have experience. Especially in an OS where it's a lot of calling system calls or libraries. Then it's little different than C.
I'm more likely to have trouble and waste time debugging HLLs than I do with assembly.
That's an interesting article, and I agree with it to some extent. However, one of the goals address by HLL's is maintainability. The "Hello World" program in PHP may look like this:
<?php
print "Hello World!\n";
?>
In assembly (modern or "archaic"), while I can't remember what it would look like, I know it's more complicated. Though modern assembly is becoming somewhat of a HLL itself ...
So, why is the above code easier to maintain? There are several reasons, not all of which apply to maintaining the code itself.
Because the PHP application uses an abstract language, it's easy to understand: it's like learning a new "real" language--something people are born knowing how to do. If someone wants to change this application, it's very simple--even for someone who doesn't know how to program (if they're shown how to open and edit the PHP file). HLL's are much more self-documenting than assembly.
Another reason that HLL's are more "maintainable" is sort of a back-end thing: our "Hello World" program can be optimized without changing the source code of the program itself. The interpreter can be updated to take advantage of new instructions or algorithms without affecting what the "Hello World" developer needs to do. Additionally, fundamental bug fixes and optimizations can be made to an entire set of applications that rely on a particular function or construct without the application developers having to change even a single line of code.
The primary advantage I see in using assembly is control: a HLL programmer often can't (or doesn't know how to) communicate directly with the hardware or the OS, limiting the power of the language. Additionally, I thought it was really cool to know [nearly] exactly what's going on with the bits and bytes in my programs when I was learning assembly.
Though, for most things, I think it's generally more cool to be able to develop things rapidly using the right HLL for the job, since HLL's are usually designed and optimized for the rapid development of a particular type of application. In the case of C, the optimization lies in making common tasks quick and easy, while still allowing a large amount of control over the hardware. PHP: web development; ... Perl: text parsing [command line utilities]; ... Java: platform independent "object-heavy" applications; .... etc.
It's all a matter of what you need your code to do and how you plan on distributing it--it's niche.
Am I right? Or am I drunk?
drhowarddrfine
12-05-2008, 11:26 PM
one of the goals address by HLL's is maintainability. The "Hello World" program in PHP may look like this:
<?php
print "Hello World!\n";
?>
In assembly (modern or "archaic"), while I can't remember what it would look like, I know it's more complicated.
$ db "Hello World!"
mov eax,$
push eax
call _system_call
Though modern assembly is becoming somewhat of a HLL itself ... (drhowarddrfine just vomited all over himself)
I hope you aren't talking of the HLA crap.
HLL's are much more self-documenting than assembly.
mov eax,3
mov ebx,2
add eax,ebx
What is the result? I find HLLs much more cryptic than assembly.
char (*p)(void); What the hell is that?! (Yes, I do know.)
The interpreter can be updated to take advantage of new instructions or algorithms without affecting what the "Hello World" developer needs to do.In assembly, you can implement any new instruction set without a compiler and without waiting for any other source to implement it.Additionally, fundamental bug fixes and optimizations can be made to an entire set of applications that rely on a particular function or construct without the application developers having to change even a single line of code.Are you talking about in libraries? We use libraries.
The primary advantage I see in using assembly is control: a HLL programmer often can't (or doesn't know how to) communicate directly with the hardware or the OS, limiting the power of the language.The more you use libraries, APIs and the OS, the less effective assembly becomes since a lot of it just becomes pushing values on the stack and calling the API.
I agree code gets written faster using HLLs. I really don't have a programming background. I've always been a hardware guy and had to be forced to learn C many years ago. I consider anything higher than that just rapid prototyping. When I try and learn things like Python and Lisp (the only two languages I have an interest in besides Javascript) I feel like I'm wasting my time because the methods and philosophies they try and instill in you are methods and philosophies I can use, and do use, in assembly and C.
I'm sure my background makes me feel that way. When I code, I visualize the data running between registers, the cpu, memory and i/o. When I write *p=0; I think mov (esi),0. When someone says they don't understand pointers, I think, "YOU DON'T UNDERSTAND POINTERS??!!!!!"
So I'm going on a bit of a rant here. My whole thought is pretty much like the article I linked to above. I don't see everyone switching to assembly tomorrow even though God wants you to.
svidgen
12-06-2008, 12:36 AM
char (*p)(void);
You generated a cryptic example to prove your theory. Bad form, friend.
Your "Hello World" app, despite the fact that it's incomplete (http://www2.latech.edu/~acm/helloworld/asm.html), is very cryptic to anyone who doesn't know assembly. It doesn't read like a natural language. And doesn't assembly programmer need to know what OS you're running it on to know what system call you're making? (that's really a question) In either case, assembly, as far as I know, is highly hardware and OS dependent, whereas many other languages are largely not, especially scripted languages and languages like Java, which are compiled to run on a VM.
In assembly, you can implement any new instruction set without a compiler and without waiting for any other source to implement it.
If you're talking about writing your own compiler, then I can say the same about any HLL. Though a HLL programmer isn't usually concerned with writing new compilers--teams of people are already on top of making those better all the time.
Are you talking about in libraries? We use libraries.
Not really. I'm talking about what the compiler turns even basic things like print "hello world" into. I'm talking about how the compiler decides to organize the stack and which particular instructions the compiler chooses to use. In your assembly program, you decide which instructions to use--which allows you more power, but also restricts the compiler from making many optimizations for you.
Honestly, I think that everyone should at least take an intro class that teaches assembly and machine organization and so on. I just don't think many developers will use assembly after having had the class.
Anywho, I'm not saying "don't use assembly." I'm saying, "use the best tool for the job." I find that the best tool for web development, command line, and GUI jobs is rarely assembly ... If you're writing an OS, a driver, etc. ... it's probably best to throw in at least a little assembly.
That sound right?
drhowarddrfine
12-06-2008, 12:19 PM
You generated a cryptic example to prove your theory. Bad form, friend.Not at all. The same thing in asm is 'call p'.
Your "Hello World" app, despite the fact that it's incomplete (http://www2.latech.edu/~acm/helloworld/asm.html), is very cryptic to anyone who doesn't know assembly.I only left out the extraneous stuff just like your example left out stuff but, still, if one reads my example, of the addition, you can see it is hardly cryptic at all and anyone can figure out what it's doing, but no one relies on undocumented code, do they? :)
It doesn't read like a natural language. And doesn't assembly programmer need to know what OS you're running it on to know what system call you're making? (that's really a question)Assembly libraries.
I really hesitate to get into these discussions because, every so often, some HLL coder gets on the assembly forums and asks these same questions so we just point him to the faq. It's very tiring.
If you're talking about writing your own compilerNo. Give me a new version of a processor with new instructions and I can implement any instruction by just entering the hex code. We were using MMX and, um, (argh, age related memory) the other register thingies, years before they were available in compilers.
In your assembly program, you decide which instructions to use--which allows you more power, but also restricts the compiler from making many optimizations for you.I love it when I write code and it does what I tell it to and not what the 'assembler' wants to do. You are right, though, you do have to organize things and optimize your code yourself, though many assemblers will help with organizing the stack, structs, etc., and some will optimize your code for you.
Honestly, I think that everyone should at least take an intro class that teaches assembly and machine organization and so on. I just don't think many developers will use assembly after having had the class.Without a knowledge of assembly, you get this "What do I care? I've got gigabytes of memory and 4Ghz processor!". Bloatware. I love the utilities I find on the assembly boards and 'demoscene' where someone wrote a full blown office suite and apologizes cause it went over a 1K download. (Well, I might be exaggerating with that one.)
I remember the days when scripting was only used to start up executables and little else.
svidgen
12-06-2008, 03:37 PM
Seems as though we each of our own conception of cryptic. And that's fine by me. My whole point was that you've gotta use the right tool for the job. And even determining which tool is the right tool depends a little on the person.
Wouldn't you agree?
drhowarddrfine
12-06-2008, 05:49 PM
Oh, definitely, but there's nothing you can't do with assembly. :)
svidgen
12-06-2008, 05:56 PM
Hehe ... true. Though, I'm pretty sure I've heard the same thing said about hope--and I wouldn't know how to write a DBMS on hope alone ...
drhowarddrfine
12-07-2008, 12:44 AM
There is one, written completely in assembly, and I've got a copy on a CD somewhere. It was a product for sale in the 80s or 90s, but the two guys who ran the company parted ways so, several years later, they released the source. It was very successful but I don't recall anything else.
svidgen
12-07-2008, 12:52 AM
A DBMS? I was hoping to find one written purely on hopes and dreams--not assembly. Anyone can write a DBMS in assembly ...
andr105
12-09-2008, 11:51 AM
I use only Perl. And I'm glad.
svidgen
12-09-2008, 11:58 AM
There was a time when I used only Perl ... I too was glad. Now, I am glad I use PHP (for web development).
drhowarddrfine
12-09-2008, 03:24 PM
With all due respect to Perl, I just had a tough time with it. I hate to say any language might be on its way out but I will with Perl.
scragar
12-09-2008, 04:19 PM
With all due respect to Perl, I just had a tough time with it. I hate to say any language might be on its way out but I will with Perl.
Perl is a very old language, and it always evolves, it's not fair to say it's on it's way out, it's hay day was long ago, but that doesn't mean it's losing popularity right now.
slaughters
12-09-2008, 04:36 PM
...
As far as .NET ...
... personally, I will probably continue to avoid learning proprietary technologies unless absolutely necessary. Though, I would be interested in seeing some benchmark data to support the claims that .NET is "better" than PHP ...
I've always considered PHP pretty "proprietary" :)
P.S.
There is no "better" language, only "better" programmers :)
P.P.S.
Except COBOL no body can program anything better in COBOL :)
scragar
12-09-2008, 05:53 PM
I've always considered PHP pretty "proprietary" :)
P.S.
There is no "better" language, only "better" programmers :)
P.P.S.
Except COBOL no body can program anything better in COBOL :)
Every language has a purpose, even cobol(OK, that's to annoy programmers, but it has a purpose)
webdeveloper.com
Copyright Internet.com Inc., All Rights Reserved.