I am entering college now and as a math major, I'd like to get a head start by teaching my self how to program this summer. What would you guys recommend? What language and resources?
mk taught himself to code by creating Hubski. You could do something like that. Find something you'd like to have exist and create it. I'm not a programmer, so I am not the right person to answer, but I always think that having a project with a clearly defined goal is a great way to learn how to do something. It also helps to have a mentor. There came a point where mk was beyond simply doing things himself and he needed some help/guidance. akkartik was pretty instrumental in the early days of Hubski in that regard. Also, if you see this shout-out akkkartik, I hope you are well. I have no doubt that you've been working on some cool stuff. You should join a Hubski call sometime, it would be nice to see you.
Good luck ao. Enjoy your summer!
I'm here! Thanks for tagging me on this thread, though. It's right up my alley. I've been teaching a couple of people programming using arc, and hacking on hopefully a better way to teach programming. Hope to have it working soon for everyone to check out!
That's pretty much true. However my first foray into programming was in Fortran, working with a physics professor in undergrad. He basically said: "Here's my program, start changing it.", which suited my learning style well. I used it to model phase transitions, and it resulted in my first publication. I picked up Arc because Lisp looked cool, if not somewhat familiar, and I wanted to learn enough that I could make most any basic app I could imagine. I grabbed the code for hacker news, and started changing it.
Personally how you first learned is what seems to be the best way for me. Having sonething that works, you can play around with and have an end goal just seems to be the magic I need. I can't count the number of times I've been missing one of those and it's just led me to spinning my wheels for a day and then abandoning the project.
Yes, I think it's critically important to find what learning style works best for you, and just go with it. You can spend endless energy and kill motivation trying to learn the way you think you should. No doubt my learning approach has drawbacks, but they are far less than the drawback of not being motivated by the approach.
Heh, well, if you don't mind me being tangential. A friend got me into it around middle school. His father programmed software which was eventually bought out by a company that works with substance abuse clinics and his brother, within a few years of our friendship, got a job at Microsoft. Anyway he'd been programming stuff for a while when he introduced me to it. He taught me the basics and shared really cool programs he'd made with me. Somewhere around the end of middle school, I learned there was a class at the High School on programming. The teacher was nice enough to let me install Visual Basic (6, I think) that was used in the class to tinker with on my own. I was really lucky to do this because by the time I reached the correct grade to take the class, it was no longer available, probably due to lack of interest (South Carolina... enough said?). So anyway I just kept taking classes whenever/wherever I could, got into college Comp. Sci. program and the rest is history. Basically start with something simple, and try some free online tutorials. Some starting concepts that are important: Variable Typing - in some languages variables are just names and will hold whatever you want them to... text, a number, whatever. That's weak typing. Some languages you define the type of variable and then it will ONLY hold those values. Your integer variable will only ever contain whole numbers etc. This is strong typing. The definitions aren't as exact as that... basically strong typed languages can be more rigid, but in return provide some automatic error checking (You can't put your String (text) in that Integer!) which a weak typed language would only stumble over once you run the program. Data Structures - These are ways of organizing data. A queue is like stuff waiting in line. It comes out of the line in the same order it entered the line (FIFO - First In, First Out). Stacks are the same but the order is reversed (LIFO - Last In, First Out). There are a lot more complicated structures, but mostly these will be built into default libraries so if you know one which would be useful you don't have to write/rewrite it yourself. Object Oriented - Basically a focus on defining "objects" which contain variables in a set structure (data structure!). If you define a Ball object as having a diameter, a position, and a direction, then all Ball variables/objects/instances will contain those values. Object oriented programming ideals can be generally used independent of language but some are built specifically for it. Language API - As I mentioned above, this is a list of functions/methods/tools you don't have to make yourself, they come included in default libraries the language supports. Very useful once you've got some programming foundation so you understand the lingo used. There are a lot of resources available to ease you in. Good luck!
Isn't it hash table (instead of set structure)? Object Oriented - Basically a focus on defining "objects" which contain variables in a set structure (data structure!).
Best way to learn and have some experience is to actually solve a problem. Don't just "learn to program," actually solve a problem and you'll find yourself A) Learning, B) Applying the knowledge in the real world. Now go find out what problems you can solve and what language is the best to solve it with?
I second this, strongly. You can learn theory all day long but it won't help a jot. OP, do you have a specific area you're interested in? Say, the web? Or mobile apps? Or mobile games? Or full fledged actual games? It'll be pretty easy to suggest some next steps once that sort of thing's identified. Source: successfully taught myself Casio graphical calculator programming, QBasic, HTML et al, LAMP stack, Node... by finding something I liked in each that gave me a goal to work towards.
Python is a good language, especially for beginners. I'm not really sure what the best way to start learning it is, but you can try the official tutorial: https://docs.python.org/2/tutorial/ At least finish up to (and including) chapter 5 of the tutorial. I'm pretty sure about 75% of the stuff I do in python is using the information covered in ch 1-5. Probably another ~20% is just googling some other library's API and using it.
I haven't had the opportunity to use Python much, but I like it a lot. Learned it through "Learn Python the Hard Way", which I thought was a pretty good introduction.
I was going to have an edit to my post but you replied before I could type it: and I agree with Creativity, it's important to try your newly-found skills and actually make something. Try to think of something cool to do (that doesn't necessarily require a GUI, i.e. something in the terminal). You could look into python's urllib and make some sort of website scraper, or you could find some website you use's API and try to do something with that. If you're completely lost, you can try some problems on Project Euler - since you're a math major, some of those things might be right up your alley anyway. ---- That having been said, it might be easier to learn a little bit of programming first without trying to also create something, then later after you feel comfortable you can start trying to apply it.
This seems like the ideal way to start. Great response! I appreciate it.That having been said, it might be easier to learn a little bit of programming first without trying to also create something, then later after you feel comfortable you can start trying to apply it.
I can also recommend edX, they offer a couple of courses where you'll get introduced into programming basics (granted, at a pretty decent speed). I did there a Python as well as a C# course, and both would be fine for beginners, if they're eager to learn. If you look specifically for Python, I can recommend Introduction to Computer Science and Programming Using Python by the MIT. It started just two weeks ago, so you'd have to do a bit of catching up, but while teaching you the basics of Python (a very versatile and beginner friendly language), the course also teaches to 'think like a programmer'. A book I'd recommend, would be Think Python which is free and available for Python 2.x as well as 3.0. Another resource: once you started to get a feeling for the stuff, you can also check out pluralsight.com, a great resource for tutorial videos. While lacking a bit of content for Python, it offers a lot of general programming tips or for example C# stuff. Good luck! PS: The cs50x course amar mentioned is also one of the courses I did and I liked it as well! With the MIT and this one, you should be more than fine on a basic level.
I believe I was 15 when my friend started really getting into software development. I watched him grow into owning his own business, and managing some lucrative contracts while becoming a autodidact computer wizard. I always felt I was too dumb, or the complexity so significant that I would never be able to grasp programming. I was 22 when I finally sat down and created my first 'HelloWorld' program in C#. I piddled and attempted to "get-it" it for about a year. I can honestly say it was frustrating, probably THE most frustrating thing I've ever done. I banged my head against walls for days trying to meagerly grasp the concepts I was using and most of the time I'd lose.
I worked with him for about a year afterwards, digging through his designs in within his WPF application; expanding things and creating new features where I could, and inevitably breaking things where I couldn't. I noticed my little side projects growing in complexity and sophistication while I slowly believed I was figuring out what was going on... Fast forward to today: I'm above a junior level dev now, for sure. While it will be many, many years before I can remotely call myself a senior, I managed to land a job at small but great company doing work for the oil and gas industry (a very big company). I remember six months ago, I was retarded. Six months before that I was an infant. Every six months the cycle continues and I get better.
I still have no idea whats going on (but at least I'm getting paid for it now!).
No-one has mentioned JavaScript, which was the first language I 'learned'. JavaScript is used to give websites function, it's loosely typed and good for learning because you can get results very easily, especially when coupled with HTML.
I don't think it's the fastest way to learn if you have the patience for other languages here, but if you find other things mentioned a bit daunting, I made some .pdfs designed to teach 10-15 year olds how to program JavaScript
I'm conflicted in suggesting JavaScript. It's a pretty easy language to learn, very easy to set up (you have a web browser? Great, you're good to go), and very popular. But, it's sometimes just a terrible language. I don't know if I'd want beginners thinking that all languages make that little sense.
I agree. JavaScript is something that must be learned, but I am glad that it wasn't my first exposure to programming. My appreciation for JavaScript is still growing, but that has far more to do with what can be done with the language than with its actual properties. I so wish browsers spoke Lisp. :)
Same. I really don't like loosely typed languages, and JavaScript has some things that don't seem 'propper'. I also can't find any free IDE for it so I spend a lot of my time switching between Firefox's debug window and the code. After I did some JavaScript, I did a C course which was when I really started to understand how things worked, but I think the C course would have been more confusing had I not done some JavaScript first.
Javascript was the first language that really got me into programming. I had gone college classes in C++ and Java before, but javascript was the first time I could write something and see the immediate effect on something I cared for. I dabbled in userscripts as it was a fun way of tweaking what I already liked into something I liked even more; great for motivation.
I have been using http://www.freecodecamp.com/ and http://www.codecademy.com
As far as I can tell, it's not really important which language you chose. If it's your first time, you will learn the trade of programming and how to think about problems and that's what's important. I think it's important to work on a project or something tangible, where you could look back and say 'Yeah, I did this and it's pretty cool' whether it's a calendar or a little game or something you come up with. You should check out https://www.khanacademy.org/computing ; and other MOOCs from Udacity or EdX.
Start with a simple language that has simple concepts to understand. I first learned PASCAL in high school; it doesn't get much use in the real world but it's a solid and easy functional programming language. Visual BASIC was another easy high school course, that gets more use (I think you can make Excel macros with Visual BASIC so if you use Excel a lot, you may want to learn it for the application benefits). I liked both of those because I got to program fun stuff, like a game of Blackjack. If you've gotten your toes wet with simple languages like those, you might then get into Object Oriented Programming (OOP), which is languages like C++ or Java, though you can really branch out once you understand the basics of modern programming and use a language that suits your needs. I like to use ActionScript 3, which is used for Flash, so I make Flash games with it. Also, if you've ever seen Dwarf Fortress, the creator says it's almost entirely written in C. Beware! Java and JavaScript are entirely different, like Iceland and Greenland. I like JavaScript, but Java is a nightmare. But basically it's entirely up to you what you want to learn based on why you want to learn it. If all you want to do is make a website, then learn HTML, CSS, and whatever other languages are specifically made for the web (I don't know). If you want to learn to make an app for your phone, look up what languages are proper for such things (I know you can make some apps in Flash, but I bet there's something more applicable out there now). The key is really to have a goal in mind that you're interested in, because at the beginning, it can really be a slog when you don't know what you're doing. Having a great teacher really can't be beat. When I was in high school, my first programming teacher was awful, and I didn't really understand what I was doing, but the second teacher was amazing and I learned a ton and loved every second of it. But of course if you're learning on your own, Google is your best friend. You can find tutorials on pretty much anything. Programming requires zero money to pay apart from the upfront cost of owning a computer. HTML can be written in Notepad, and I use a free program called FlashDevelop when I work with ActionScript and XML. I think Eclipse is a free program for Java and other languages, as well. But to reiterate the main question to ask yourself: what do you want to accomplish by learning a language? What do you make to make with it? That will help narrow down your choices. From there, start by finding a supporting program, and Google "(language) tutorial". The website StackOverflow I think is particularly good for when you're running into an issue programming.
Minor quibble - Pascal is not a functional language, as it is usually defined. LISP and Haskell are examples of functional languages.
This will be long. I've spent a lot of time thinking about my path as a programmer, and how a CS education doesn't necessarily result in a good programmer. Alright here it goes: To give you some context for my pedigree: I taught myself computer programming in 8th grade (I'm a senior in college now). By the time I was a senior in high school, I was capable of creating a GameBoy emulator (play) from scratch (I worked with a classmate; we split the load evenly). I majored in electrical engineering, but picked up a CS minor on the side. I'm probably a better CS person than an EE, but I am mostly interested in cyberphysical systems at this point, so that worked out well. Now for the good stuff: - What I found most useful when I was starting out was having a goal. Just wanting to learn program without an good intrinsic motivator will just lead to some mixture of frustration and boredom. I wanted to make video games, and that was my initial motivator for wanting to learn more. As I learned more about programming and CS, my goals changed and evolved. - My second big piece of advice is to fail early and fail often. When you start out, you won't know what projects you are capable of tackling at your skill level. You will inevitably pick projects that are not really feasible. Eventually you will get bored or frustrated with the project and move on to working on something else. Picking projects that you can finish isn't necessarily important though. What's important though is that you pick projects that motivate you. Every time you fail you will learn something new, and every project has unique challenges that will help you grow. The more a project motivates you, the more time you will spend attacking and attempting to overcome these challenges, and the more you will learn. - My last piece of advice is to join a community. Find a good IRC channel or forum that is noob friendly, but has experienced programmers involved. The community will serve as your mentor and give you advice on how to approach problems, educate you on what tools you might use, teach you new concepts, etc. Read as much as you can. Now as per what language, this is somewhat dictated by your goal, but I'm going to say Python. You can learn with any language, but python is a good choice. It is widely popular, so there are plenty of resources out there. It isn't the fastest language around, but when you need to speed advantage other languages can give you, you will know enough programming that changing languages won't be a problem. If you want to make a website, you will need to learn html/css/javascript as well. If you stay as a math major, I recommend picking up Mathematica at some point. It was a life saver in my probability class last semester when I had to do some really nasty integrals that wolfram alpha chokes on. Best of luck!
:edit:
I don't feel any particular language is better than another. At the end of the day, it's just syntax. It's just which one best suits the task at hand. I recommend figuring out a project you'd like to make, simplify it greatly and pick a language that would suit it well. For example, if you want to make a game, use unity3d/c#. If you want to make a web app/site, look at something like python, ruby, js or something. desktop app? Depending on the platform, c#, mono, objc, etc. I myself find that without implementing what I read I'm never going to retain it. background: Full time dev. I need to switch languages at least every few years. And I help onboard jr devs and this is how we do it a lot of the time. Give a simple project and let them go.
I tinkered around before then, but really only got it when I read K&R. That's probably not the best place to start now though; even in the unix world, C doesn't have the same place in the ecosystem it used to. The Structure and Interpretation of Computer Programs is a good book if you're mathematically inclined. There are lecture videos of the authors teaching a class from it that are well worth watching too. If you're looking for something more practical, start with the python tutorial, find some libraries for the sorts of programs you're interested in. Sign up for an algorithms class, and maybe combinatorics or graph theory if your school offers them, later if you decide you like programming.
MIT doesn't use it anymore. I think it's a fine introduction for a newbie who is comfortable with mathematics, because it tries to be something like an Elements for programming. It's not really an introduction to programming as engineering, but no book is a good introduction to programming as engineering, and certainly no book that doesn't assume some background.
I would you suggest you to learn python language as it is very easy to learn and you don't need to have much experience of coding to learn it. The best resource is to learn here -> Learn top languages in 2017 including python language
I learned programming in high school through three classes. I started out doing visual basic which I think is a good platform to learn the basics of programming but you'll need to move on to something like C or Java so you can get experience with object oriented programming.
I'd like to learn to program myself. Every time I have searched which language to learn first people have suggested Python from a number of different websites. Personally, I need someone to help me learn. I need someone to do it with me. Anyone want to learn Python together? Someone who honestly wants to learn together. I was thinking a good project to do to learn would be build a portable IRC client with GUI(Graphical User Interface.) I figured once we got it portable on desktop we could move toward making it a webapp.
Hi -- I'm a professional software engineer, and I first began coding about three years ago, after finishing college (where I studied biology). Here are my suggestions. As a beginner, you'd do best to learn a simple and modern language like Python or Ruby. Python is my top recommendation. I would avoid languages like C and JavaScript initially -- though both are widely used, C is too syntactically clumsy for an absolute beginner to learn quickly, while JavaScript is just a bit on the strange side. You could certainly learn JavaScript as a first language, but I think it'd be a much more natural choice for your second language. I learned Python using a free "MOOC" (Massively Open Online Course) at https://www.edx.org/course/introduction-computer-science-mitx-6-00-1x-0 -- that's essentially an online version of MIT's Computer Science 101 course. If you'd like something a bit shorter, I've heard great things about another free course, https://www.coursera.org/course/interactivepython1. Indeed, that Coursera course begins in just a week, on July 11. You could also poke around on codecademy, as others have recommended, but you won't learn in much depth there. I'd suggest starting with an open online course or by self-studying from a textbook ("Invent Your Own Computer Games With Python" is one that I haven't read, but that comes highly recommended, and is available for free online at https://inventwithpython.com/). Feel free to ping me with any questions.
Came here to suggest MOOCs. It's also true that solving your own tasks is beneficial, but sometimes it's hard to find those in your daily life.
Somewhat tangential thought here. I learned to program way back in the stone age (think punch cards, job control, and Fortran). So that's probably not immediately relevant. What is relevant (besides having a problem to solve) is being aware that if you're thinking of programming as a vocation, you're committing to a LOT of learning. Programming evolves; we know how to do things a lot better than we used to; we have better infrastructure and hardware than we used to; we're able to design languages with better internal constructs.
So think of languages as tools in the toolkit that can be applied when appropriate, and the tools change over time. In my life as a programmer(), I've learned Fortran, Job Control, Assembler (various), Pl/1, Pascal, Basic, Visual Basic, C, C+, Java, Ruby, Groovy, php, python, javascript, html, blah, blah, etc, etc, currently starting to look at functional programming languages.
My point being there's always something new (and interesting) to learn, and it's part of the job. tl;dr - Learning programming never stops
I learned Visual Basic when I was a kid. I did write some small application. The problem was I did not understand how the code could tell the computer to do something. It was so frustrated and I quitted coding after that. I didn't understand the abstraction of computer layer machine code, transistor... After that I began to learn electronics, and I realized the brain of the computer was all about logic gate. We human used high level programming languages to make it easier for us to tell the computer what to do. From my experience before learning to code you need to understand the fundamentals of computer. It makes your life easier. And by the way learn by coding, do some real projects. You become better and better every day.
To begin with, I am not professianal programmer, It is just hobby. My serious programming experience started with Pascal (ABC I think) in high school. I didn't really liked the language, but I loved programming itself. Wrote couple programms. First one consisted of generating labyrinth and walking through it using keyboard, algorigthm of finding way included. Another one - modeling simple ring collisions. I find this problems quite interesting to start with, there may be some difficulties with graphics, though. Later on, I started learning C one summer myself, liked it more then Paskal, studied basic syntax, pointers, classes, streams (then, way later, templates and inheritence). Programs I wrote were: file input/output - just to sort it out; programm couting days between 2 dates - I used classes there first time and labyrinth again. Then there were cources at university, have written 3D game analogic to infinite tic-tac-toe using DirectX as a project - do not really recomment go into such thing. Year later wrote programm (on MFC), plotting graphic of given formula - that was goog programming experience. Now I am working with raw Windows API. So, if u don't want to go into web programming I would recommend to start with c or c, if you haven't much programming experience. There are plenty of tutorials for begginers, I suppose all will do. Try to think of some problems for yourself and solve them. Do not rush into using graphics (use pseudographics), API and additional libraries. When you will want to do more advanced stuff, be ready to study much of documentation. Oh, and I'm quite satisfied with Visual Studio.
It really depends on what you are interested in. My first language was bash (wouldn't suggest that as a first) because I was really interested in how linux worked. I bought a book about shell scripting and used it to guide myself while I just experimented with it on my own exploring what I could do. I didn't really start to grasp it until I wrote my first program. If you are looking at a language to start with, both ruby and python are fairly beginner friendly with a lot of learning resources available. I use both in my job currently (systems engineer). These are two pretty popular resources:
Ruby: http://learnrubythehardway.org/book/
Python: http://learnpythonthehardway.org/book/ I would figure out what you want to program first (AI, systems, webapps, etc). That will help you decide what to learn a lot.
Try html first then learn php. They are used for making webpages, which can be for beginners to advanced. Note... These days you may want to skip web pages and jump into app development for iPhone or android phones. I believe there are good tools out there to get you started. Java would probably come in handy. But don't reinvent the wheel, in the real world you cut and paste lots of code and also work with other coder son the same apps or pages, if your in the field that is.
Like a few that have commented, I strongly recommend you try and learn by having a problem to solve...but in case you can't think of one, there are a few sites that poses programming challenges. Here are the two that I know of off the top of my head: - Codewars - Project Euler Have fun :)
Those are still theory problems though. They're problems with a defined, theoretical solution. Good for a math major if they're sticking to math problems, but if outside of that, doesn't cover good practices for a number of other areas.
You're right. They're more supplementary problems than anything, but I considered it as an opportunity to improve on one's understanding of the fundamental concepts of programming. It's really a step behind solving real world problems. Also, I thought providing something up the poster's alley might help the learning process as well. It's definitely by no means the end-all be-all of their learning process, though. Having gained (and still gaining) better understanding of programming through solving problems at work, I still strongly recommend the real world problem solving approach.
I didn't, yet. I'm working on it (starting by trying to figure out Byond code because I had an idea for content to add to my favorite SS13 servers, probably will be moving to some other code to implement OTHER game ideas later).
I learned the fundamentals and theory at college. I had taught myself html in high school, but that's not really programming. I learned how to build functioning full featured applications on my own and through work. My education helped a lot.
I highly suggest Harvard's introductory material. [CS50.tv](www.cs50.tv). It's really very good. I also suggest you try to do the "Hacker edition" of the assignments. Yes, they are much more difficult, but they actually make you think even if you know what you're doing. They also get you a little more in tune with some of the tools and practices that you'll use in your actual projects.
I used to dabble with TI-BASIC on my calculator, but my first real language was Java. I would not recommend it as a first language, it tries to enforce a lot of bad practices. I would recommend Python and C as first languages, in that order. It is important to realize that you will not learn programming from any class. It is something you must do yourself. I saw a study recently that said those who excel in programming are those who are able to follow arbitrary but consistent rules, even though they are completely meaningless. Do not attempt to equate programming rules with rules in Real Lifeā¢ The most important rule I have is "never use global variables", and that includes standard library functions that necessarily imply global variables. The sole exception is writing to `stderr`, which is for debugging only (When e.g. writing a compiler library, error messages go to a user-provided stream). Of course, `main` may pass `stdin`, `stdout`, or `stderr` as an argument to the other functions. Also, make sure you find a way to enable as many warnings as possible all the time. Consider all warnings as fatal errors, and if you must suppress them, only suppress them around one specific site (e.g. `#pragma GCC diagnostic push/pop` around it)
Try C for start. It can be an easy and complex language at the same time... but for start it's awesome because it's easy to learn the basics of programming. C only becomes complex when you go deep into the language. On the resources level, it really depends on what you're doing. For example, for some languages, Unix based OS's are best, like C or C. But for other languages, like C# and ASP, Windows is the one. The same applies for IDE.
I'm 38 years old, employed fulltime as a senior developer (engine developer and part project manager), and a self taught programmer (did programming since I was about 11 years old up until my career, did a uni education along the way which contributed with little - most of what I know came from working on projects on my own). The main thing I tell people who want to learn programming, is, as others have mentioned, to have a project, to have an actual goal, and to find new projects. Experiment with ideas or get an actual programmer to give you a list of ideas. Look for the projects that give you just a tiny spark of energy or motivation, and where you can build up a sense of ownership and control ("this is mine, and I know exactly how it works!"). A goal is the main "engine" that will drive your learning process, and an important reason why self taught programmers with many different projects are usually better, more motivated and more flexible programmers than those who learnt it in college / uni (with some exceptions of course). Why are projects so important? Every single component in programming; conditionals, loops and so on, exist only because they have a specific mechanistic purpose they can solve. So it will be a very slow and difficult process to try to learn programming without any guiding purpose (like reading a book). The project is actually the only place programming comes from. Many people want to make you believe that programming is just different words with different meanings, that you can use "patterns" for development, or that making a project is about what sort of third party applications you include, but believe me, those people have a superficial knowledge of programming at best. Each project has its own language, and its own shape and structure. Programming arises from the project. Anyway, good luck! As you fight yourself through the pain of debugging and rewriting, and your projects start getting gradually bigger, you will slowly acquire new skills, such as fast typing speed, more efficient planning, and endurance.
I would recommend going to the individual programming subreddits and browsing all their wikis because they've tailored them for questions such as this. I am still at barely an intermediate level, but I used /r/rails and /r/ruby in conjunction with a night course I took that combined HTML, CSS, HTTP, rails, etc. in an 8 week bootcamp format. I won a half scholarship for the program, so it was a no-brainer.
As a math major, you might enjoy Haskell. It's theoretically very elegant but also very powerful. Programmers often consider it to be hard, because it's quite different to other languages, but people have reported success in teaching it as a first language, especially to mathematically minded people. Learn You a Haskell For Great Good, which is free online, is a good place to start. Otherwise, I would second the recommendations of Python and [codecademy.com](codecademy.com).
Late to the party but I'll share anyway... Personal experience: my first formal dive into learning programming was as part of a basic part-time IT diploma. Dabbled a little with C, Java, and VB.Net, but regardless of the language the lessons did touch on fundamental concepts like variables, conditions, loops, checking of user inputs, etc. Then afterwards I went into a more "proper" course (just finished recently actually) that utilised Python 3 as the main teaching language, with some C thrown in for academic requirements. That class went into further exploration of the methodology of structuring code for a given problem. Techniques like sorting, memoisation, object oriented programming, that kinda jazz. Because I'd become familiar with the fundamentals from the earlier course, I wasn't quite as lost in all of this, but I did notice many pure beginners struggling and even dropping out midway. Seeing how you're a math major, I suspect Python may be a good fit as there are suitable relevant libraries for the language, and it can mostly handle huge calculations better. But if you do become genuinely interested in what makes Python tick, you could move down to lower-level languages like C that gets pretty close to the inner workings of the computer machine. (Heck, Python was written in C) EDIT: I should add that Haskell's also great for the mathematically inclined, since its syntax can be quite algebraic. The way Haskell functions are defined isn't too far off from how mathematical functions may be defined. Gets pretty deep with function composition and mapping too.
I first learned rudimentary Python from a friend. I'd say start with Python for sure, as it gives you a solid grasp of what you are doing, without overly complicating things. As far as how, if you can find a friend who is willing to teach you the basics, go for it. Then, I'd say try to build something and learn as you go.