Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

nope7308

macrumors 65816
Original poster
Oct 6, 2008
1,040
537
Ontario, Canada
Hi All,

I'm interested in computer programming as a modern form of literacy, but it's very difficult for a beginner to navigate the programming literature/landscape. Would anyone recommend Swift or Swift 2 as a first programming language? If so, what resources would you recommend? Are there any (free) online courses on Swift that are geared toward absolute beginners? My research hasn't turned up much.

I gravitated toward Swift because its a modern programming language that isn't likely to be eclipsed anytime soon, and since I'm only interested in programming for the Apple ecosystem, it seemed like the logical choice. Is there anything I should be aware of here?

I'd prefer to work on a specific project so that I can maintain momentum and confidence by setting small, achievable goals. Unfortunately, I know so little about programming, I don't know what would even qualify as a feasible project. I think this is why I would benefit from a highly structured course/tutorial, where small projects are basically assigned to you. Does any of this make sense?

I'm somewhat technical, but I have no background in computer programming. The closest experience I have to programming is elementary symbolic logic, which isn't saying much. I also work at a university, so I have the option of taking a formal course and only paying the incidental fees (~$100). Should I go this route instead? My only concern is being taught a bunch of other things that I don't want/need to learn -- I'm not interested in the history of programming, for instance.

Playing around on Code Academy has been fun, but they don't have anything for Swift. Any advice would be appreciated, but please keep it civil. Thank you!
 
  • Like
Reactions: Edgar Spayce
@larswik was learning a while back and was using a blackjack game as a learning tutorial.

Something simple like that is a good place to start, well defined rules and possibilities.

Can you think of something like that that you could use and would be familiar enough to you?

B
 
@larswik was learning a while back and was using a blackjack game as a learning tutorial.

Something simple like that is a good place to start, well defined rules and possibilities.

Can you think of something like that that you could use and would be familiar enough to you?

B

Nope. Like I said, no comp sci experience whatsoever.
 
Nope. Like I said, no comp sci experience whatsoever.
Thanks @balamw for remembering.

nope7308, I have quit more times learning to program because I was to anxious and tried to learn quickly and got lost. I bought a book 5 years ago or so called "Learn C on the Mac". With that book and this forum I was able to get proficient at C in about 10 months or so. After that I took a city college class, intro to programing using Pascal, and it filled in all the blanks i missed with C. When I was finally ready to move to an object oriented programming language like Objective-C I tested my skills and wrote a C based blackjack program and posted it here on this forum. The code did not look pretty but it worked.

I would say to start very simple and skip Swift for now, start with C. C will allow you to jump to other languages more easily like Java, PHP and Objective-C. You will always use C, its been around for decades and many languages build on C.

Learning to program was a 2 step process for me. You can learn a programming language, but how do you write a program? They are not the same thing. C was just a basic set of tools that performed tasks, like a hammer, socket wrench, screw drivers and so on. But writing a program was like building an engine for a car. I knew how to use those tools but not build an engine. Creating a blackjack game was like building an engine, but how do you do it? Where do you even start?

Swift is a less wordy language but can get very complicated when working with objects, I am still learning it and it is still changing and evolving since it is still new. I bet everyone on this forum can help you solve C problems but only a hand full that are really good with Swift.

If you get that book, or any C book, redo all the tutorials your own way, change them around and really experiment and try things so you understand those tools. You will never master programming, you will just get better and better at it.

Last thing I would say, don't race through a book. Had one guy years ago that read the Learn C on the Mac in a couple weeks and was just as lost at the end of the book. If you try to force the issue, and learn faster then you understand, you will get frustrated and give up thinking its to hard.

There are great people on this forum that have been here since I started still helping. A good C book and this forum will give you a good solid foundation of programming and then you can move to other languages more easily. When you are ready to move from C, write a command line blackjack game, build that engine with your C tools.
 
Nope. Like I said, no comp sci experience whatsoever.

Not comp sci experience, life experience!

What's something you think that a computer could help you do? Simple games like blackjack/21 or tictactoe are good. Otherwise, simple things like an address book, a book/CD/movie catalog, ...

What fits in your world experience? What do you want to do with your new found literacy?

B
 
What fits in your world experience? What do you want to do with your new found literacy?
B

Well, I'd love to be able to build a program that analyzes a set of data to determine if there's any statistically significant patterns over a period of time. Ideally, this program would be able to automatically extrapolate the relevant data from source files such as excel, and then automatically generate graphical output of the results.

For example, let's say I want to analyze enrolment data for an academic department over the period of two semesters. This would include information such as course title, year of study, day/time, instructor, classroom, and so on. I have data from each week of each term, and so I can track how enrolment has fluctuated over the two-semester period. Ideally, this program would be able to automatically extract/format the relevant data from the weekly spreadsheets, and then perform statistical analysis to determine what is the principal driver of, say, dropping enrolment numbers. This could provide useful insights -- e.g., courses scheduled before 9am have high drop rate, Prof. X has excellent student retention rates, etc. In addition, it would be helpful if visual aids were automatically generated based on the output results (e.g., graphs, pie charts, etc.).

I just described SPSS, lol. But seriously, I'd like to be able to create a program like this, but designed for one very specific purpose, so that I can simplify the functions and layout, thus making it more accessible for non-technical users. I'm absolutely neurotic about UI functionality and design, so although I could probably find a program to meet my computing needs, I'm unlikely to ever be entirely satisfied with it.

I realize this isn't a feasible project for a beginner, but hey, you asked!
 
Well, I'd love to be able to build a program that analyzes a set of data to determine if there's any statistically significant patterns over a period of time. Ideally, this program would be able to automatically extrapolate the relevant data from source files such as excel, and then automatically generate graphical output of the results.

For example, let's say I want to analyze enrolment data for an academic department over the period of two semesters. This would include information such as course title, year of study, day/time, instructor, classroom, and so on. I have data from each week of each term, and so I can track how enrolment has fluctuated over the two-semester period. Ideally, this program would be able to automatically extract/format the relevant data from the weekly spreadsheets, and then perform statistical analysis to determine what is the principal driver of, say, dropping enrolment numbers. This could provide useful insights -- e.g., courses scheduled before 9am have high drop rate, Prof. X has excellent student retention rates, etc. In addition, it would be helpful if visual aids were automatically generated based on the output results (e.g., graphs, pie charts, etc.).

I just described SPSS, lol. But seriously, I'd like to be able to create a program like this, but designed for one very specific purpose, so that I can simplify the functions and layout, thus making it more accessible for non-technical users. I'm absolutely neurotic about UI functionality and design, so although I could probably find a program to meet my computing needs, I'm unlikely to ever be entirely satisfied with it.

I realize this isn't a feasible project for a beginner, but hey, you asked!

Swift is a very new language. For this reason there are not a lot of resources targeting the absolute beginner. If you want to build nice UIs for the Mac the only reasonable choices seem to Objective C and Swift. At the moment Swift is probably not an option which leaves Objective C. On the other hand, Obj-C is IMHO a language that is somewhat cumbersome to use. I suspect that Obj-C would not be used at all today if it was not for the fact that it was the only language supported by Apple to program on the mac.

From the aspect of data science there are two open-source languages that seem to be heavily used: R and Python. Nobody in their right mind would recommend R as a language to learn how to program in. On the other hand, Python is often mentioned as a good learning language and in your case that is my recommendation as well. It is a stable language with a nice set of features and is, in some respects, quite similar to Swift. There are also a ton of learning resources available.

(One of) my summer projects is actually to get a firmer grasp on statistics using Python. I found a great (free!) book which actually teach in the way that you describe but with the goal of teaching programmers to do statistics and not the other way around. Nevertheless, I invite you to spend ten minutes looking through it to see what you can do with Python.

Python is not really what you want in terms of GUI programming but it could be a fun place to start. After getting a solid foundation in Python it might seem less daunting to transition to Swift.

I don't have any specific recommendations when it comes to learning Python but I'm sure there are lots and lots (and lots) of recommendations on the net.
 
Macsmurf nailed it... the problems you want to tackle are best handled in R or Python... Python is very easy to learn and has many resources aimed at the beginner.

"Learn C first" has been the mantra for many, many years... and I am very excited to see it die. I do not see it pertaining to the demographic of hobby programmers that are so prevalent today. C has been, in fact, often used as a gate to keep people out of programming. If we want computational thinking to become a basic literacy, we need languages that are inclusive.

Most introduction to computer programming courses at the college level are taught in Python or Java today. If you do have the ability to take one of these courses for free, it would get you up and running fast. Also there are many uni courses available for free online, including the one at MIT (python).
 
Most introduction to computer programming courses at the college level are taught in Python or Java today. .
I took the Java class right after the pascal class which was the intro to programming class at my city college. There was no prerequisite before the Java class like intro to programming. The first day in the java class the instructor asked how many are new to programming and is this your first class? About half raised there hands. He said I recommend the intro to programming class first, because by the end of this class there will only be a couple of you guys left.

By the end of the semester there was only about 60% of the class left. Learning in school means you learn at their pace, that's not always the best way some people are quick learners, others slow. The first few weeks was covering the basics of C and then it launched into object oriented concepts. An intro to programming class takes what you learn in Java the first few weeks and spreads that out into a whole semester.

I still wonder today how many people that gave up on that class thought programming was to hard and never tried again, when simply they just started at a level that was to overwhelming for them.
 
  • Like
Reactions: chown33
FWIW this is also the kind of work I do, and in the past 10 years or so I have gravitated to Matlab as a total data analysis / computational engineering environment.

I have tried migrating off to Octave (open source Matlab equivalent) or R or Python, but have not found any real reason to switch.

Many of my larger Matlab projects leverage C/C++/Fortran code (as mex files) or Java/C# for some GUI stuff or Perl when appropriate.

IMO the language is incidental. The real key skill to programming is the breakdown of a process into its small constituent parts and figuring out how to interconnect all those parts. If many of the parts you need already exist in the language/environment then it is appropriate to solve the kind of problem you need.

This is particularly true of Obj-C where many problems can be solved with the application of the proper use of existing classes/methods/etc... Much of the work is actually in getting the data you need to operate on in the right format for the other code to operate on.

In that sense, the actual code writing is a lot like plumbing. All about the interfaces.

The emphasis on Model View Controller in Obj-C/Swift is excellent for beginners as it provides some framework for why different bits of code belong in different blocks of code and how they should be interfaced.

B
 
  • Like
Reactions: throAU and page404
This discussion got really technical, really quick! After some thought, I realized that I've never been able to find a really nice Freecell game that isn't fugly. Might this be a good starter project for learning how to program? I take it I should begin with Obj-C, if I'm going to be neurotic about the UI/design in OS X? I just downloaded some intro tutorials to programming, so I'll be following along with those over the next few weeks/months, and then I'll attempt something a bit more original/creative. From what I gather so far, once you pick up one language, it becomes exponentially easier to pick up others. I guess it's just the different syntax that you need to memorize after you grasp the logical structure of the various constituent parts? Anyhow, my mind has atrophied over the last few years, so I actually welcome the challenge of all this.
 
Nope. Like I said, no comp sci experience whatsoever.

When learning programming or coding for the first time, it's a far FAR easier path to pick a language designed or targeted for educational purposes and for which there already exists tons of books (for beginners, dummy's, idiots, mortals, etc.) and tutorials, etc. You can then pick and choose among learning paths until you find one that fits YOU.

Swift does not meet that spec just yet. (But might in a couple years). Unless, by sheer luck, the current docs match your brain's needs exactly.

It's easier to switch programming languages than to learn a harder/bigger one at the very start.

The currently best documented starter language is likely Python (used to be BASIC 30 years ago). Learn that at least to a basic level first, then learn Swift 2.
 
I think Swift would be a great first language to learn. It is simple to use, and Playgrounds let you see exactly what your code does as you type it. There’s no need to mess with compiling setting up a specific configuration, to play around. Just install Xcode, start a new playground, and have at. There is plenty of beginner-oriented documentation and tutorials. Even just following along with the official Swift Programming Language book will get you most of the way there.
 
There's a lot more to learning to program than just learning any one language, such as Swift. There are very few or no equivalents to the Knuth books or other classic works on CS and other programming techniques in Swift (yet).
 
From the aspect of data science there are two open-source languages that seem to be heavily used: R and Python. Nobody in their right mind would recommend R as a language to learn how to program in. On the other hand, Python is often mentioned as a good learning language and in your case that is my recommendation as well. It is a stable language with a nice set of features and is, in some respects, quite similar to Swift. There are also a ton of learning resources available.

This statement is very true. Python does have a nice module selection for this from what I hear.

I am in the process of learning R and even with some programming in the past it can be, well, not the most intuitive process. To me it seems sometimes more like it can be programming me more than I it. You will use the basics like control structures (loops and such) but at some point you turn, quite heavily, to using packages from the cran repos. Each with their own way of being used properly. Not a bad thing all in all, but you can get a learning curve just from the plethora of options available.

Granted you don't have to use these and reinvent the wheel so to speak, but many of the "go to" packages are well written, very efficient and have stood the test of time as it were over years of refinement.

Coursera offers free classes for this under their data science specialization tracks if any interest.

For gui presentation best you are getting is their add on server called Shiny. In a nutshell its a packaged way for web presentation. end user doesn't see code, they just see the representation of it. There are non-web ways as well in, of course, other packages lol.


Beyond that the r studio ide (free) (from same company who makes Shiny) is pretty decent. You write and run code, it displays results. When you hit the graphics packages it will show your graphs to screen nicely. NIce feature as I learn graphing now and sometimes need to tweak things before I eventually run code to output to a file.
 
This statement is very true. Python does have a nice module selection for this from what I hear.

I am in the process of learning R and even with some programming in the past it can be, well, not the most intuitive process. To me it seems sometimes more like it can be programming me more than I it. You will use the basics like control structures (loops and such) but at some point you turn, quite heavily, to using packages from the cran repos. Each with their own way of being used properly. Not a bad thing all in all, but you can get a learning curve just from the plethora of options available.

Granted you don't have to use these and reinvent the wheel so to speak, but many of the "go to" packages are well written, very efficient and have stood the test of time as it were over years of refinement.

Coursera offers free classes for this under their data science specialization tracks if any interest.

For gui presentation best you are getting is their add on server called Shiny. In a nutshell its a packaged way for web presentation. end user doesn't see code, they just see the representation of it. There are non-web ways as well in, of course, other packages lol.


Beyond that the r studio ide (free) (from same company who makes Shiny) is pretty decent. You write and run code, it displays results. When you hit the graphics packages it will show your graphs to screen nicely. NIce feature as I learn graphing now and sometimes need to tweak things before I eventually run code to output to a file.

I agree that R is a great tool (along with R studio). Just not as a first programming language. I also like Matlab a lot but again, I don't consider it a good language to start out with. These languages are not really general purpose even though they are very useful within the domain of data science.

Lucidmedia mentioned a Python course from MIT. Apparently they wrote a book as well. Just for kicks I saw the first lecture and I really like their approach. What they want to teach people is computational thinking rather than a specific language and they seem to use Python a a tool in that respect. That means that one learns Python more as a side effect than as a goal in itself.

Different languages promote different ways of thinking about and solve problems which is why it is useful to know several but you have to start somewhere. The TS mentioned computer programming as a modern form of literacy which I think fits nicely with the MIT approach. On the other hand, people also learn differently. What is right for one person might not be right for someone else.
 
I started up the actual python course through the edx online stuff and would say its a good course. RL got too busy and was in the verified track so I opted to withdrawal before time limit on course refund expired. Do intend to go back to it at some point.

The verified class options seen in online stuff just a personal choice. It smooth's over submission for CPE's to keep an IT certificate I have current if ever audited. Not under the gun so to speak for completion that course at just go your own pace and if not meeting deadlines in a timely manner not a hassle is a very good "audit" option. get to see the assignment aspect which was interesting up to the point I withdrew.
 
There's a lot more to learning to program than just learning any one language, such as Swift. There are very few or no equivalents to the Knuth books or other classic works on CS and other programming techniques in Swift (yet).

Well, these books are not tied to any specific language. In the case of Knuth a made up assembly language called MIX is used, this would be as relevant to Swift as any other language.
 
would be as relevant to Swift as any other language.

I tend not to agree with that view. API/toolkit driven languages and environments require less knowledge of the nitty gritty.

With swift and many other languages, some of the basic constructs like loops can be designed out where a for becomes an implied "foreach", etc...

It's usually the first thing I do when trying to optimize othe people's Matlab code. Vectorize for speed, reliability and readability. Less chance of stuff like running your loop to the wrong length of the length is implied by the container.

B
 
I tend not to agree with that view. API/toolkit driven languages and environments require less knowledge of the nitty gritty.

I wasn't trying to say that it's a requirement to learn Swift, but that books like these are language agnostic to a large extent. So the fact that Knuth doesn't use Swift in his books isn't an argument to not learning Swift. So the point is if you want to learn about theoretical CS concepts, the fact that you use Swift is not really all that relevant.

I think a more important issue is the availability of Swift beginner books that assume no previous knowledge if you want to learn Swift as a first language. I have not looked into the availability Swift books however, but I think once say Big Nerd Ranch or A-Press have one available there should be no problem to pick Swift as a first language.
 
Hi All,
but it's very difficult for a beginner to navigate the programming literature/landscape.

Honestly? Pick one and get started - don't get bogged down in the language wars. It doesn't sound like you're aiming for a career in programming, so there's nothing to lose. If you're "interested in computer programming as a modern form of literacy" then you'll want to study more than one language, anyhow.

As others have said, the main drawback with Swift is that it is new, the design of the language hasn't quite settled, so you might not find any good, beginner-level courses. A few years down the line, it might be a good choice, and I wouldn't rule it out.

Maybe start with Java or Python (plenty of introductory material) to learn the basics of programming and think about switching to Swift if/when you want to start developing interactive Mac applications with graphics.

Bear in mind that there is a big jump (and a very different sort of mental demand) between learning the basics of algorithms and creating interactive applications for modern operating systems.

As for 'C' - these days its a bit like Latin: many current languages are partly derived from it, its not very good for expressing modern concepts and only priests, lawyers and archaeologists* actually need to use it.

(* Linux kernel developers are definitely priests of some type, C++ is the first choice for 'language lawyers' and ISTR the protagonist in Vernor Vinge's 'A Deepness in the Sky' described himself as a 'programmer-archaeologist')
 
  • Like
Reactions: page404
Learning programming is not about creating UI to start with. You will be reversing a string of text or playing "think of a number between 1 and 10" game in a terminal. Until you have written programs a couple of pages long and with half a dozen functions, it's best to stick to a simple language that doesn't tempt you with just using standard libraries for everything or do stuff behind your back. C is a standard choice here. Maybe you can do the same style of programming in Swift, but I doubt there are good books and online materials for the purpose. Memory management is going to be extremely confusing before one learns how it uses malloc and free underneath.
 
"Learn C first" has been the mantra for many, many years... and I am very excited to see it die. I do not see it pertaining to the demographic of hobby programmers that are so prevalent today. C has been, in fact, often used as a gate to keep people out of programming. If we want computational thinking to become a basic literacy, we need languages that are inclusive.

You are confusing learning programming with writing applications. Simple languages like C are best for learning how computer can sequentially execute lines 1 through 10 and use previous results in a new computation. Get to the stage where you understand loops and breaking up repeated code into functions, and you are ready to switch to production language that best solves a particular problem you have in mind, like Swift for an iOS game.

Having people use methods on integers and strings is a horrible thing before they understand how these methods might be implemented. Some hidden out of sight code executes out of sequence and often has side effects many lines later. Someone might muddle through a copy and paste UI sample, but will never be able to create anything original.
 
  • Like
Reactions: firewood
Just retired, having spent my career in technology and finance. I believe you will find that learning to design solutions to problems will be the ultimate determinant of how well you do and how you feel about what you're doing. For me there's a sense of pride in creating something new that solves a tough problem. The specific language really doesn't matter all that much.

For example, I've migrated from PL/I and Assembler in school to mainframe BASIC, C/UNIX, VBA and most recently Python over a span of 40 years. The language depended on the operating environment of where I was working at the time. But having learned early on to design tight solutions to problems, migrating between languages wasn't that big a deal.

I'd suggest starting with Python or C. In the case of Python, it's free and there's a pretty wide selection of websites and books to get you going.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.