What language should I learn to develop Cross-Plataform software, coming from PHP? [closed]
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this questionI've been "programming" in PHP for about 3 or 4 years I think, and I think I'm pretty good at it already, so decided to move on to something more complex. I understand that PHP is too flexible (you don't have to declare the type of a variable, for example) and that I'll have to get used to code in such ways.
So basically I want to write applications where I could control many CPU cores and create Windowed applications. Being able to use a 3D l开发者_如何学Cibrary like DirectX or OpenGL would be plain awesome.
I really don't know much about languages that would be appropriate for this kind of applications. So, in your opinion, what language should I learn? And what book should I buy to learn it?
Python would be the easiest step for you (there's no "declaring types of variables" in it either, for example) and meets your other requirements (multiple cores via multiprocessing, OpenGl, etc). C# is next easier (you do have to declare variable types, but, like Python and PHP, it manages memory on your behalf) but the multi-platform aspects (everywhere but on Windows you'd have to rely on the Mono project) are less convincing; Java might still offer a better "multiplatform" experience, though for other aspects C# is richer (but, they're two languages with basically similar power and difficulty).
C++ is definitely going to be the hardest one (you have to manage your memory as well as declare things), but also the most powerful (as you get to manage your memory, as well as doing everything you mention and much more besides).
So, it's your call: how much do you value ease of learning / transition / use, vs sheer power, flexibility, multiplatform goodness, and the like? The right choice may depend on what relative weight you put on these factors. As for the book, if you pick Python (I won't recommend my own books as that would surely be biased;-), Wesley Chun's Core Python may be best; if C++, my favorite is Lippman's, Lajoie's and Moo's "C++ Primer". Not sure what books are best for C# (or Java).
C++ is the typical choice for large cross-platform projects. Mastering how to write cross-platform applications in C++ is quite a challenge though, but definitely worth it IMO.
I really liked Alex Martelli's answer, but I would add a couple more ideas. In terms of ease of use, you could try Visual Basic or REALbasic. Both would get you windowed programs very quickly, and REALbasic would definitely be cross-platform in that it allows you to compile for Mac, Linux, or Windows easily. However, I'm not sure how much control either one gives over use of multiple cores or multiprocessing.
Like Alex Martelli said, there are a lot of options, so you can really pick whichever suits you best, but whichever you pick, I wouldn't rely on only one book to learn it. Since learning a programming language takes time and patience, use several books, friends, and the internet to teach yourself the language and the logic. And you might consider getting books on Computer Science in general (for example, The Art of Computer Programming by Donald E. Knuth).
PHP is more similar in syntax to C / C++ than Python, but Python is easier to learn and more modern.
If you're on Windows, you might like to try C# or if not, Java. Both of these languages have a C++ style syntax but are easier to learn than C++.
"Cross platform" is a bit too general. What, exactly do you want to do across platforms?
Rich internet platforms like Silverlight and Flash/Flex are definitely cross browser, and will run outside of the browser on Windows and Mac.
If you want a programming language that you can use in any environment, then C++, Python, Ruby, and Java are strong choices (also C# if you're willing to consider Mono), but that does not guarantee that code you write on one platform will run well (or at all) on other platforms. The problem isn't the languages as much as interfacing to the operating system, platform-specific libraries, user interface platforms, etc. Portability is hard, and probably won't get easier when you look at coming problems like highly parallel programming.
You don't say exactly why cross-platform is important; that may also shape your choice. Particular application or service types? Particular tools that you like that happen to also be cross-platform? Are you interested in application code, infrastructure code, platform code?
My personal bias is towards C# and .NET. The next version of .NET is going to have some awesome parallel programming tools and greatly improved threading models. WPF and Silverlight are exciting on the graphics front, but that's much higher level than DirectX or OpenGL, so it depends very much on your goals.
Flex, Flash, and the AIR Platform could be your best bet.
Failing that, mastering the Mozilla XUL Platform might be the way to go.
Both platforms are already cross-platform, and you'd only need to build your application once, and it should run across all OS that support the platform (Mac, Windows, Linux, and more)
精彩评论