Study Objective-C , Ruby OR Python? [closed] - python

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I am working on C++ since last 4-5 years . Recently I have bought iphone and macbook and want do do some programming for iphone.
So I have started reading one book about Objective-C. I have also learn that we can program with Ruby and Python on MAC.
So my question is which one to study? Which language you guys see the FUTURE???
Can we program with these languages on other platforms? Or are these only limited on MAC?
I am just a beginner in objective-C.Need some expert thoughts which way to go.
AC

If you want to program for iphone then you should use objective-C. The entire iphone API is based on objective-C, and you have the benefits of using interface builder and IDE support from Xcode.

I use all the languages C++, Ruby, Python and Objective-C. I like each one in different ways. If you want to get into Mac and iPhone development as others I recommend Objective-C.
One of the benefits not mentioned is that Objective-C is a proper superset of C (C++ is almost a superset), that means you can bring over all your C programming knowledge from doing C++ to Objective-C programming. In fact you can also mix in C++ code in Objective-C code.
You can't do that in a seamless way in Python and Ruby. The reason why you can do this is that Objective-C is actually a very simple language.
Originally it was just C with a custom made preprocessor which took statements like this:
[rectangle setX: 10 y: 10 width: 20 height: 20];
and converted it to this before compiling:
objc_msgSend(rectangle, "setX:y:width:height:", 10, 10, 20, 20);
Apart from that Ruby, Python and Objective-C are very similar in their object model at least compared to C++. In C++ classes are created at compile time. In Objective-C, Ruby and Python classes are things created at runtime.
I wrote some stuff on why Obj-C is cool here

Objective-C is the only way to program an iPhone if you want to produce native programs that can be sold in the App Store.
Some of the more advanced concepts in Objective-C are now being added to languages like C# (eg: extension methods in C# v3.0). Learning to think in Objective-C will be useful, the OO model you learn will be applicable to most other languages and environments as an addition to your C++ experience.
Ruby's object model is closer to that of Objective-C than is Python so I suggest also learning Ruby but not until you have your Objective-C skills down solidly.
Note that you can use Objective-C++ and use C++ for all but your GUI code by having .mm suffixes on your files - this works on both iPhone and Mac. Given your C++ experience, that help you be productive.
If you want to program iPhone, don't bother learning the new Objective-C 2.0 memory management but you can still use the Properties model (iPhone effectively has a subset of the Objective-C 2.0 runtime).

Which language you guys see the FUTURE???
Future of what? iPhone development? Objective-C.
Web Services? Python/Ruby in parallel for a while. At least until people start trying to do maintenance on large Ruby applications and get frustrated with it's opacity.
Real-time game engine development? Embedded applications? Future of what?
"Can we program with these languages on other platforms? Or are these only limited on MAC?"
Ruby and Python: Yes. These are designed to run on any platform that supports C.
Objective-C: Yes. It's open source, it's in the GCC, it should work almost anywhere.
Learning a new language is not a zero-sum game. You can learn more than one language; learning Objective-C now does not prevent you from learning Python or Ruby in the future.

As a Perlite, I'm just going to point out that OS X has Perl as well as Python or Ruby.
As far as Perl/Python/Ruby goes, programs are almost completely cross-platform. It is fairly easy to run a Perl/Python/Ruby program on any platform and it works more or less the same. There may be some minor differences, but they're not major.
Objective-C, while not strictly confined to OS X, is only really used in OpenStep-based environments, which generally means OS X and the iPhone. The only Objective-C compiler I know of is gcc, and I imagine you can write Objective-C on Linux, but I don't know if Windows support is very good (if it exists).
As for which is the language of the "future", all 3 (or 4) languages will be used very widely in the future. No one can really predict this kind of thing, and none of the languages are really going to die off (unless Apple switches to a new language as a "standard" for making Mac programs), so you'll be pretty safe with any of them.
My advice: try them all out and see which one you think most suits your style, and learn that one.

As has been noted by others, if you want to program the iPhone, Objective-C is the way to go.
Objective-C is pretty Mac-specific; of course, the Gnu Objective-C compiler is avaialble for other platforms as well, and there is also GnuStep, but I think the main applicability of Objective-C today is for programming Macs and iPhones.
Python and Ruby on the other hand are available on a large number of platforms (including both Windows and many Unix-dialects). Personally, I prefer Python, but I would say both languages are very usable and pretty easy to approach.
Note also that both Python and Ruby have Objective-C bridges available, which allows you to write quite fancy Cococa applications in any of those languages.

If you program with Objective-C, your main goal should be writing Cocoa applications on the Mac. Beyond that, it has little use. Ruby and Python are useful scripting languages, and there are also bridges to write Cocoa applications.
If you want to write apps on the Mac, I would start with Objective-C. There is more support available.
In terms of the future, it seems like a lot of people are jumping on the Ruby bandwagon at the moment. Good luck.

To program on Mac OS X, you really do need a good foundation in Objective-C. The vast majority of documentation will assume Objective-C. Even if you choose to program some applications in some other language, you will be better off having a good understanding of it.

Ruby. With Ruby you will be able to do both web development (Rails/Sinatra/etc.) and very soon program on the MAC/Iphone platform with the Macruby project. Why not get the best of both worlds?
Tommy

Just my two cents...As I'm sure you're aware, Apple and others in the respective communities are doing a lot of work with Ruby and Python, for both Mac and iPhone development. Objective-C will pretty much get you into Apple arenas only these days (though maybe that's not a bad thing;) However, if you are only going to learn one language in the foreseeable future, think about where you will be using it, and what for. Ruby and Python will get you a lot further if you are looking beyond solely Mac desktop and iPhone.

I have written small games, interpreters, and tons of awessome stuff in Ruby. I Wouldn't recommend It to write intensive AI programs for instance, but It's fun to learn and powerful for most applications. Even when I do most of my work in C++ Ruby is my favorite language for subjective reasons.
Objective C as most people said Is a must in iPhone development, and fun if You're enthusiastic about learning languages.
I haven't tried Python, but I hear nothing but good things about It, and PyGames Is quite popular.
I would learn the three ( well...I would skip objective C unless You're curious about getting into iPhone development), the most languages you know, the best professional You will be. As a good professor of mine always said..It's not about being the master in just one language, It's about knowing the pros and cons of each one to choose the right one according to the particular problem You want to solve.
Cheers !

Objective-C is only Mac/iPhone, and I recommend you to learn if you want to develop applications for Mac/iPhone.
Python is everything and it's future, but python more preferable for web development. Python is Google :) Python is web, games, science, graphics, desktop, etc. Also it's very good choice if you are C/C++ developer.
Not sure if i can recommend you to learn Ruby...

Related

Jython - Using Spring, Programming in Python?

Ok, I'm a total newbie in this stuff.
So, I know Spring is really good as a framework, and I've been programming in Python for a while, so I was wondering if somehow I can use the Spring Framework but use code from Python.
I heard that maybe Jython was a good possibility for doing this, since it's (I think) Python running on the JVM, right?
So, is this possible? For me to use Spring while coding in Python?
First, you're right that Jython is Python running in the JVM. And it's not just running in the JVM, it can interact with it in pretty much all the ways you want—use Java classes as Python classes, implement Java interfaces in a Python class and pass it to Java code, etc.
However, unlike some of the other JVM languages, Jython doesn't make any attempt to be semantically equivalent to Java (or to a superset of it). And of course Python and Java have very different idiomatic styles.
So, in short, just about anything is possible, but not everything is pleasant, as Marcin says.
For specifics about how Spring works with Jython, a quick Google search turned up See how Spring Python works with Jython. And in fact, it's part of a blog called "Spring Python", which is part of a site also called "Spring Python". It seems like this may be a port of Spring to Python rather than about using Jython with Spring. ("This project takes the concepts of Spring and applies it to the language and environment of Python. This includes pragmatic libraries and useful abstractions that quickly gets you back to working on the code that makes you money.") So, that might be another alternative for you.
The next search result was Jython Spring MVC Controllers.
And there were half a dozen other promising results. So, I think you'll have no problem finding information and examples.

PC^2 equivalent compatible with Python

I will be running a programming competition for high school students in the near future, and was originally going to use PC^2 (Programming Contest Control System) for the automated judging of the solutions. This software is commonly used in the ACM's International Collegiate Programming Contest regionals as well as the world finals. This is an excellent system which I have used before, but one of its pitfalls is its language support (Java, C, and C++). I'm a little bit concerned, as not all high school students who may be attending will have exposure to any of these languages. However, many local high schools teach introductory programming courses in Python. Is there an equivalent system to PC^2 which has Python support?
You can use some open source implementations of the online judges.
for example ONJ http://sourceforge.net/projects/onj/
It is easy to configure and it can be made compatible to run on languages of your choice. You dont need local copies of it on every system where the students will sit, you can just run it on a server and give the students its web-link to submit their solutions.
Do it with Sphere Online Judge, contest hosting is free of charge, many languages available.
I actually found a much better way to accomplish this. In their latest release, PC^2 added support for interpreted languages (such as Python, etc). Since PC^2 requires an executable, you need to "stub out" the compile command and simply invoke the interpreter with the script.
The full guide can be found at http://pc2.ecs.csus.edu/wiki/Interpreted_languages
Assuming you are still interested, PC^2 is very adaptable. I run a scripting contest using it and support Python, Perl, PHP and Ruby. Basically, PC^2 expects a language to compile and then run. You need to write a dinky script that pretends to compile the code and return success. Then the run script simply runs the scripting submission. Pretty easy to do.
You can visit http://acm2012.scusa.lsu.edu and look at the scripting contest info. Feel free to contact us for more info.
It's simpler than one may think. The following is for pc2 9.2.3-2565
Add language as follows (python here as an example):
Display Name: Python
Compile Cmd Line: touch OK
Executable Filename: OK
Program Execution Command Line: python {:mainfile}
python3.3 or python3.4 will work too.
pc2 could be easier, of course, but there does not seem to be much support left at CSUS. Reseting contest would be even greater feature; the current need to clone directories for test, practice, and actual contest is very awkward. Better management of the database (like the ability to remove things) would make it into a great tool. It is alright, but it could be great.

Is Ruby or Python not suitable for iPhone or Mac app development because of speed, and any compiler that can help boost the speed? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
I am reading a little bit on Objective-C, and since it comes from Smalltalk, like Ruby does, so I wonder, is it true that if using Ruby, (if Apple change XCode to support it), to develop iPhone or Mac app, it is not suitable really because of the speed? For example, Angry Birds probably isn't as smooth as it is now if using Ruby, vs if Objective-C, it is compiled and running as machine code.
But currently, is there any way of compiling Ruby or Python code into machine code so that it is running in the similar speed zone as Objective-C programs can?
On desktop those are fine languages to use, and for Python you could use py2app to deploy your app. You wouldn't want to write low-level graphics routines in an interpreted language, but that's what libraries like PyGame are for.
(Not that this is a particular advantage, but note that one of the most popular 2D game frameworks on iOS is a port of a 2D game framework for Python: http://cocos2d.org/ )
Until recently the iOS developer terms specifically disallowed running an interpreter, so nobody used Ruby or Python on iPhone. Apps programmed in those languages will probably start showing up, but you won't find much about that just yet.
Ruby/Python can be fast enough for Mac and even iOS development. It depends on performance requirements for your applications. It should be acceptable for most use cases.
Apple is developing Ruby implementation specifically targeted for Mac application development - MacRuby. Another option would be to use RhoMobile, a mobile development framework using Ruby.
Also OS X is bundled with Python and PyObjC library by default, which enables developing cocoa applications with python.
Possible ways to speed up your Python applications:
Use Cython. A python-like language, that compiles to c, to ease interoperability with c code.
Use Pyrex or Shedskin. The former compiles a subset of python to C, the latter to C++.
Use PyPy or Psyco. Both compile Python code to machine code on the fly.
For Ruby you might want to look at Rubinius - Ruby implementation that compiles to native code on the fly.
Python and Ruby themselves are not too fast, but many programs today are written to basically do none of the heavy lifting alone. For instance, if you want to save a PNG file as a JPG, you are certainly going to use the built in system calls to do it. In that case it does not really matter if it takes 0.00001 seconds in Obj-C, or 0.001 seconds in Python to process the mouse click, when the optimized system code to convert the image is the exact same code in both programs, and takes, say 1/2 a second to run. On the other hand if you are making a low level data munger of your own design, then you might want some C. Basically all languages that you would use on a Mac allow you to write something in C, and call it from that language, so even that does not slow you down.
Pick the language for the task based usually on what everyone else is doing for that problem, intersected with your abilities.

Can you really use the Visual Studio 2008 IDE to code in Python?

I have a friend who I am trying to teach how to program. He comes from a very basic PHP background, and for some reason is ANTI C#, I guess because some of his PHP circles condemn anything that comes from Microsoft.
Anyways - I've told him its possible to use either Ruby or Python with the VS2008 IDE, because I've read somewhere that this is possible.
But I was wondering. Is it really that practical, can you do EVERYTHING with Python in VS2008 that you can do with C# or VB.net.
I guess without starting a debate... I want to know if you're a developer using VS IDE with a language other than VB.net or C#, then please leave an answer with your experience.
If you are (like me) either a VB.net or C# developer, please don't post speculative or subjective answers. This is a serious question, and I don't want it being closed as subjective. ...
Thank you very much.
update
So far we've established that IronPython is the right tool for the job.
Now how practical is it really?
Mono for example runs C# code in Linux, but... ever tried to use it? Not practical at all, lots of code refactoring needs to take place, no support for .net v3.5, etc...
If you want to use Python together with the .NET Common Language Runtime, then you want one of:
Python.NET (extension to vanilla Python that adds .NET support)
IronPython (re-implementation of Python as a .NET language)
Boo (Python-like language that compiles down to C#-equivalent MSIL code)
Using Python in Visual Studio without using the CLR seems like a bit of a waste to me. Eclipse with PyDev would be a much better choice.
I find it odd that your friend is against C# but is ok with Visual Studio. There is, after all, an open source development environment for .NET called SharpDevelop. The C# language is a standard. .NET is free (as in beer) and there is an open source implementation of that platform called Mono. The only "un-free" thing is Visual Studio (though there are "Express" versions which are free as in beer).
This has been discussed before in this thread. I personally prefer eclipse and pyDev.
I don't know why you would want to - perhaps something like IronPython Studio would be a happy medium. But as I said I don't know why you would want to use Visual Studio for Python development when there are much better options available.
Always choose the right tool for the right job - just because you can drive a nail with the butt-end of your cordless drill doesn't mean that you should. Visual Studio was not designed for Python development and as such will not be a perfect environment for developing in it. Please use the list I have linked to choose a more appropriate editor from that list.
As a side note, I am wondering why your PHP friend refuses to use C# (a free, industry standardized language) but is okay using Visual Studio (an expensive, closed-source integrated development environment).
Firstly, there seems to be a question as to whether python (or various implementations) are as 'powerful' as C#. I'm not quite sure what to take powerful to mean, but in my experience of both languages it will be somewhat easier and faster to write a given piece of code in python than in C#. C# is faster than cpython (although if speed is desired, the psyco python module is well worth a look).
Also I would object to your dismissal of Mono. Mono is great on Linux if you write an application for it from scratch. It is not really meant to be a compatibility layer between Windows and Linux (see Wine!), and if you treat it as such you will only be disappointed.
It just seems to me that you are taking the wrong approach. If you want to convince him that not everything Microsoft is evil, and he is adamant about not learning C#, get him to learn Python (or Ruby, or LUA or whatever) until he is competent, and then introduce him to C# and get him to make his own judgement - I'm fairly in favour of open source, and am far from a rabid Microsoft supporter, but I tried C#, and found I quite liked it.
I think that getting him to use python and visual studio in a suboptimal way will turn him against both of them - far from your desired goal!
Go here for a discussion on the Visual Studio IronPython IDEs.

PyObjc vs RubyCocoa for Mac development: Which is more mature?

I've been wanting to have a play with either Ruby or Python while at the same time I've been wanting to do a bit of Cocoa programming.
So I thought the best way to achieve both these goals is to develop something using either a Ruby or Python to Objective-C bridge (PyObjc or RubyCocoa).
I know that ideally to get the best learning experience I would learn each techonology independently but I don't have the time. :)
So my question is which is a more mature platform, PyObc or RubyCocoa, main things I am looking for:
Documentation of API
Tutorials
Tools
Supportive Community
Completness of Cocoa API avaialble through the bridge
Regarding point 5 I don't expect that the entire Cocoa API will be availble through either bridge but I need to have enough Cocoa APIs available to develop a functioning application.
While you say you "don't have time" to learn technologies independently the fastest route to learning Cocoa will still be to learn it in its native language: Objective-C. Once you understand Objective-C and have gotten over the initial learning curve of the Cocoa frameworks you'll have a much easier time picking up either PyObjC or RubyCocoa.
I would echo Chris' assesment and will expand a bit on why you should learn Objective-C to learn Cocoa. As Chris says, Objective-C is the foundation and native language of Cocoa and many of its paradigms are inextricably linked with that lineage. In particular, selectors and dynamic message resolution and ability to modify classes at run time are required to implement Cocoa technologies such as Distributed Objects and bindings. Although these features are available in other dynamic languages such as Ruby and Python, there is enough of a mismatch in the language models that you will have to at least understand Objective-C to understand Cocoa. I suggest you take a look at this previous question for further discussion: Do I have to learn Objective-C for professional Mac Development?
Fortunately, Objective-C is very easy to learn. I often tell people it will take them a day to learn Objective-C coming from C/C++/Java or LISP, Scheme, or any of the 'newer' dynamic languages such as Ruby and Python. In addition to expanding your mind a bit, you'll learn to at least read the code that is used in virtually all of the Cocoa documentation and examples.
As for Ruby vs. Python, the bridge capabilities are very similar. In fact, they both use Apple's BridgeSupport (shipped with Leopard) to provide the bridge description. Both are supported by Apple and ship with Leopard. It's a matter of personal taste which language you prefer. If you choose Ruby, I suggest you give MacRuby a look. It's definitely the future of Ruby on OS X, as it reimplements the Ruby runtime on top of the Objective-C run time. This provides some nice performance and conceptual advantages (including integration with the Objective-C garbage collection system, a feature currently lacking in PyObjC which uses the native python gc). MacRuby also includes a custom parser that makes the syntax of bridged objective-c methods a little nicer. The downside of MacRuby is that it's not quite ready for production-level use at the time of this writing (June 2009). Since it sounds like this is a learning project for you, that's probably not an issue.
Both are roughly equal, I'd say. Better in some places, worse in others. But I wouldn't recommend learning Cocoa with either. Like Chris said, Cocoa requires some understanding of Objective-C. I like Ruby better than Objective-C, but I still don't recommend using it to learn Cocoa. Once you have a solid foundation (no pun intended) in Cocoa/Objective-C, then the bridges can be useful to you.
Apple seems to be getting behind Ruby scripting for Cocoa but not RubyCocoa. They are hosting and I believe supporting MacRuby. I often wonder if MacRuby is Apple's answer to a higher level language for OSX prototyping and full on application development.
ObjectiveC is nowhere near as much fun or as productive as either Python or Ruby. That is why people want to pick a python or ruby with good Objective C access. Advising them to learn Objective C first misses the point imo. I have really good things to say about pyobjc. Its ability to interoperate painlessly with Objective C frameworks is superb. I have less experience with Ruby Cocoa and that was partly because when I last looked it didn't seem to have as clean and relatively painless interoperability. I feel hesitant about MacRuby because it seems to go too far. In pyobjc you can write plain python and only subclass/use Foundation and Cocoa objects when you really want/mean to. From what I understand of MacRuby it is a Ruby on top of Cocoa. So a string is always an NSString. I am less happy with that. YMMV.

Categories