Learn with Swift 2?

Discussion in 'Mac Programming' started by nope7308, May 25, 2016.

  1. nope7308 macrumors 65816

    nope7308

    Joined:
    Oct 6, 2008
    Location:
    Ontario, Canada
    #1
    Conventional wisdom tells us that Python should be your first programming language, but why not Swift? I ask because I'm only interested in developing applications for OS X, so Swift seems like a natural choice.

    Learning programming is something I've wanted to do for a while, but finding time has been difficult (life and all). To keep me motivated, I'd like to develop a Free Cell game as an end-goal. Is this realistic?

    I've started with an online tutorial for Swift, and it's actually really easy to follow (albeit I haven't done very much). I'm pleasantly surprised at how similar programming is to philosophical logic -- I find this oddly fun. There's also a certain satisfaction you get after writing some code that's error free. I also enjoy the colour, lol.

    My mind has atrophied quite a bit since university, so I want to learn as a way of staying sharp. Much like logic, I think I'll get a lot more interested once I get my footing, so to speak. I just trust that Swift will become standard because, well, Apple. Is this a silly assumption?
     
  2. superscape, May 26, 2016
    Last edited: May 27, 2016

    superscape macrumors 6502a

    superscape

    Joined:
    Feb 12, 2008
    Location:
    East Riding of Yorkshire, UK
    #2
    Really? I think that's debatable at best. ;-)

    [Pauses and waits for Python evangelists to turn up]

    If you're only interested in developing for OS X then the default development languages are Swift and Objective-C. Sure, you *can* make apps using languages such as Python (or even AppleScript, if you must). However, personally I like to stick to the defaults until I come across a compelling reason not to.

    It probably doesn't matter too much which one you choose. Some say Swift will eventually replace Objective-C, some disagree - you can toss a coin in the air as well as I can, I expect. The hardest bit (or so I found) is finding your way around the various Cocoa frameworks, and that'll be pretty much the same whichever language you choose.

    One thing I would say is that Swift doesn't seem to share much with any other language as far as I can see. At least if you learn Objective-C then some of what you learn will be pure C (since Objective-C is just a superset of C) and so will be applicable if you want to learn any other C based languages in the future.

    But, in short, yeah, nothing wrong with learning to code in Swift if your goal is to make OS X/iOS apps.
     
  3. nope7308 thread starter macrumors 65816

    nope7308

    Joined:
    Oct 6, 2008
    Location:
    Ontario, Canada
    #3
    Great, thank you for clarifying. Given my intentions, Swift seems like the appropriate choice. Now, on to the journey of learning. I hope FreeCell is manageable for someone learning to code, but I'll find out one way or another.
     
  4. neutrino23 macrumors 68000

    Joined:
    Feb 14, 2003
    Location:
    SF Bay area
    #4
    I've been learning Swift for similar reasons and really like it. I programmed professionally in the 80s but have been out of it for a long time. I like the strong typing and the way Xcode checks things as you type.

    I recommend the playground in Xcode as a great way to test things while you are learning.

    Check out the iOS programming class on iTunes U from Stanford University. The prof is Paul Hegarty. Read the Swift book from Apple first. As part of the class he works through a couple of sample apps that you can run yourself. This is great because it introduces you to iOS APIs as well as Swift. Be sure to update your version of Xcode before starting.

    I'm not the first to note this but it is amazing that you can go on iTunes U and listen to lectures from top universities across the country.
     
  5. macsmurf macrumors 65816

    macsmurf

    Joined:
    Aug 3, 2007
    #5
    I don't think there is any conventional wisdom when it comes to learning programming. If you enjoy using Swift, keep doing it. If it becomes confusing/unenjoyable maybe try a more "conventional" first programming language such as Python. The main thing is to have fun.
     
  6. 960design macrumors 68020

    Joined:
    Apr 17, 2012
    Location:
    Destin, FL
    #6
    I pose the question, do we really need to learn proprietary languages at all?

    For starters, I know Swift(and many more) and have developed both iOS and Mac apps using it. For the moment, I am writing applications in HTML5 / Javascript / PHP. Now everyone can use them.

    Your example is a free cell game. You could develop that entirely in Javascript. The JS would generate the simple HTML skeleton and instance the canvas. From there JS does the drawing, animating, sounds, pretty much everything. Add a little PHP ( AJAX ) to persist data to a server and you have something pretty amazing and usable by everyone be it: Windows, Macs, Android, Kindle, Ubuntu, iPads, Surface, ect. With a little responsive design thinking you can scale your app exactly how you imagine for different screen sizes as well, instead of relying on the 'automatic' resizing for each browser.

    In the end if you really want that app added to the app store, package it all up in a chromeless browser instance and submit.

    PS: It is a little more complex than just that; I'm trying to give a 'big picture'.
     
  7. chrono1081 macrumors 604

    chrono1081

    Joined:
    Jan 26, 2008
    Location:
    Isla Nublar
    #7
    The problem is web languages are incredibly messy, slow, buggy, and changing constantly. You also have to know a slew of different technologies to do something simple.

    Want a website that uploads to a server? Better know HTML, CSS, Javascript (with its helper JQuery), ASP.Net with one of its syntax helpers like Razor, SQL and potentially more. It's a mess and the tools (like debugging) are incredibly subpar compared to an IDE.

    Web is functional, but pretty weak. You can't do the amazing stuff you can on the desktop or mobile devices natively with web and have a good user experience.
     
  8. 960design macrumors 68020

    Joined:
    Apr 17, 2012
    Location:
    Destin, FL
    #8
    While I agree, most of the web application software out there does in fact follow your observations, it doesn't have to. I'm working extremely hard on closing that gap. While high end games will always be written in the lower level languages to keep the frame rate high, ( assembly for the main loops when I was growing up and now more so C++/C# ), most of the software and casual games written now can be served perfectly with plain new javascript.
     
  9. Starfia macrumors 6502

    Starfia

    Joined:
    Apr 11, 2011
    #9
    No, it's not silly – start with Swift. It was partially intended as a first programming language. There are technical reasons for people being on whatever side of the discussion which you'll inevitably get to someday if you're interested enough, and those reasons are finite.
     
  10. Superhai macrumors 6502

    Superhai

    Joined:
    Apr 21, 2010
    #10
    Oh, there are lots of them, and they all disagree with each other!

    If you are aiming at the Apple world, Swift is what Apple focuses on so it is a safe bet. It is an easy and powerful language. No matter what language you choose, after gaining experience moving to another language will be easier. Lots of programming involve in creating ideas and algorithms and those are not (usually) language-centric. However when you learn several languages one thing to note are what are their strengths and weaknesses.
    Even the "low-level" languages will usually use API's, libraries and frameworks to get where you want – faster. So those are the one you should master for the target system you aim for.
     
  11. KALLT macrumors 601

    Joined:
    Sep 23, 2008
    #11
    I would recommend Swift as a first language even if the goal isn’t to write Cocoa applications. Swift is very approachable and the ease with which you can implement your code into a simple iOS or OS X app, or even just a playground, to see your result, in particular with storyboards, makes Swift a very powerful and satisfying learning tool for programming as such. The steepest learning curve lies in the standard libraries and frameworks and those differ from language to language and platform to platform anyway.
     
  12. firewood macrumors 604

    Joined:
    Jul 29, 2003
    Location:
    Silicon Valley
    #12
    Look at the age of the languages and their popularity on the TIOBE index. Python is currently in wider use and has been around longer in the education industry. Thus, there's lots more tutorial material and a larger support community. It also has more libraries available and has deeper support on more platforms (you can even play with Python on iOS devices and run a limited version on IoT devices).

    Swift 2 is rising in popularity, level of tutorial material and size of community. But it's not in the same league yet. Especially with Swift 3 on the way.
     
  13. iphonedude2008 macrumors 65816

    iphonedude2008

    Joined:
    Nov 7, 2009
    Location:
    Irvine, CA
    #13
    While I agree that swift does not have as much learning material out as of now as Python, by virtue of being an apple language it has a huge support community. Tutorials are being written faster than can be read. And the comment about Swift 3 being a detriment to the existing tutorials is unfounded, as the biggest changes to the language that would be problematic to learners are the removal of some relic C syntax like the ++ operator. I think swift is an excellent first language if your goal is iOS or Mac apps, especially with apples recent emphasis on ease of use within Xcode.
     
  14. briloronmacrumo macrumors 6502

    briloronmacrumo

    Joined:
    Jan 25, 2008
    Location:
    USA
    #14
    C and Objective-C are marketable programming skills. Moreover, tons of code already written in C/Objective-C has to be maintained by someone. All that C and Objective-C is not going to be rewritten because there is mostly no good reason to do so. There is still many programmers maintaining old 1960s/70s COBOL code that everyone thought would die. Also remember: the educational programming language favorite is not necessarily the language that is used in the real world. I remember Pascal being taught in schools and the demand for Pascal skills is minimal compared to C. For OS X development I use C/Objective-C but Swift is certainly fine. I don't recommend going beyond those three ( C, Obj-C, Swift ) for OS X development.
     
  15. OS X Dude macrumors 6502a

    OS X Dude

    Joined:
    Jun 30, 2007
    Location:
    UK
    #15
    I'm starting with Python, purely as it's easier in terms of syntax - in spite of its performance trade-offs. Plus, it is used in big companies, so figured it was useful.

    I'm also learning Swift alongside it (again, syntax is much nicer than compared to an older language like Java and I feel I'm making good progress) along with SQL. My friend works as a data reporter using SQL and earns really good money for our ages (24), so I followed the money :p Plus, it's easy whilst also giving a solid understanding of programming as a whole. Additionally, I want to learn Max/MSP enough to make interesting instruments/effects in my band's music.

    I'm hoping to get a day job out of programming, ultimately. I'm good with languages overall, studying three foreign ones at school and getting As in all of them (not to brag). For me, the learning process between all types of language is very similar and it's one of the few things I seem to be naturally decent at. My only concern is getting used to these simpler languages and later finding Java and C# more tricksy. On the other hand, I'll have built up a good amount of knowledge by then so it could make it easier than I'm thinking.

    Anyway, good luck and hopefully we both get what we want from it :)
     
  16. Superhai macrumors 6502

    Superhai

    Joined:
    Apr 21, 2010
    #16
    In most cases a move from Python and Swift to Java or C# will mostly not feel difficult but a little different. The jump to C++ and C will maybe be a bigger jump as they have pointers and "unsafe" coding and the latter also have weaker typing. Actually I would even suggest a introduction to assembler before learning these languages just to understand these concepts.
     
  17. jaduff46 macrumors regular

    jaduff46

    Joined:
    Mar 3, 2010
    Location:
    Second star on the right....
    #17
    I believe Python and Swift would be good choices with which to begin. Python gives you machine independence (Windows or MacOS) and is pretty easy syntactically to pick up. I did it late in my career because I had a project and figured it would be fun to do in Python, given all the libraries and sample code available.

    Swift (haven't tried it) seems to be well supported and worth the effort if you want to focus on Apple hardware and apps.

    Also agree with Superhai above that having exposure to a low level language gives you a better sense of what actually happens in the machine after you compile something. My first CS at Duke used Assembler for the first half of the semester and PL/I (IBM high level language similar to C in syntax and structure) for just that reason.

    Having a complex problem to solve/work on is where you'll really learn how to use the languages to structure solutions. Mine was chess.

    Good luck and have fun with it.
     
  18. 960design macrumors 68020

    Joined:
    Apr 17, 2012
    Location:
    Destin, FL
    #18
    If you can write code you WILL get a job or create one. The fantastic thing about coding ( today ) is that there are no where near enough of us. In five years ( fingers crossed ) computers will write their own code; all we have to do is explain the problem.
     
  19. OS X Dude macrumors 6502a

    OS X Dude

    Joined:
    Jun 30, 2007
    Location:
    UK
    #19
    Even without a degree in Computer Science? Most of the bigger companies require candidates to have a qualification which, being self-taught, I won't have.

    I've been to uni once and don't particularly want to again due to the increased costs now. I started my last course the year before UK tuition fees went sky-high.
     
  20. Superhai macrumors 6502

    Superhai

    Joined:
    Apr 21, 2010
    #20
    Then make your own, own company, freelance or contract work. Remember also if you have proven record some companies will sponsor your degree if they find it necessary.
     
  21. OS X Dude macrumors 6502a

    OS X Dude

    Joined:
    Jun 30, 2007
    Location:
    UK
    #21
    I'm far too unsure of myself to ever run my own company, plus I'm a complete control-freak and in a decent-sized company you can't possibly know everything that's going on. I just about manage with my band!

    I like the idea of perhaps applying for a junior role with a company that will support me in that way, I think I'll need to write some letters/make some calls though rather than apply in the traditional sense for that kind of thing.

    I had a look and Swift 2 development is paying around £30-35k on average. I'd be happy with that!
     
  22. Ap0ks macrumors 6502

    Joined:
    Aug 12, 2008
    Location:
    Cambridge, UK
    #22
    You don't really need a degree, just experience. A lot of job listings will ask for a CS degree or relevant experience (4 years should be more than enough), so as long as you've published decent apps on the AppStore or contributed decent code to projects on GitHub or the like you should stand a good chance of getting a job.

    Some companies would rather hire an experienced developer over a graduate that they have to train, who may up & leave once they've been trained.
     
  23. OS X Dude macrumors 6502a

    OS X Dude

    Joined:
    Jun 30, 2007
    Location:
    UK
    #23
    Is there a likelihood of being sponsored by a company to get a qualification and then perhaps sign a contract with them to not leave for 3-5 years? Kind of like how Toyota do?
     
  24. 960design macrumors 68020

    Joined:
    Apr 17, 2012
    Location:
    Destin, FL
    #24
    When we hire someone, we ask them to write code. I don't care if they have a degree or not to get the interview. Now for the job, two candidates perform equally with code, then we look further down the chain to past performance and finally education. But the degree will only be used to qualify one equal candidate over another.

    As mentioned, start your own small company ( two or three people ), build a couple of programs, give them away for free. When you apply for your job, you'll have references, experience AND ambition.
     
  25. OS X Dude macrumors 6502a

    OS X Dude

    Joined:
    Jun 30, 2007
    Location:
    UK
    #25
    Thanks for the insight :). I think if I cannot find a job after becoming adept at both Swift and Python, then I'll release something for free just to get my CV up to scratch.
     

Share This Page