programming

All posts tagged programming

y83Je1OC6Wc

A friend of mine called me up recently to ask me how to get started with programming. I’ve gotten these requests more and more as the demand for programmers rises. I’m going to compile a list of resources to help anyone get started with what I feel are the basis for what anyone who wants to program will need. This list is by no means comprehensive and while this will get you started you should not feel like you can go from knowing nothing to building the next Facebook simply by following this guide. It will, however, give you a solid foundation with which you can build and grow to the point where you could potentially build something like Facebook or Instagram on your own or working with a small team.

Which Language Should I Learn?

This depends entirely on what you are trying to do. Some people want to make their work life more efficient by writing small programs to automate their daily tasks while others may want to create websites and web applications. For the first I suggest Python. It is easy to pick up for beginners, it forces good code formatting, and it can be extended to do a large amount of things including creating large websites and applications (Instagram runs on Django which is a web framework built on Python). If you really want to write web applications or create interactive websites I would recommend learning Ruby on Rails. I have written web applications in both languages and I am far more effective in Rails thanks to their mantra of “Convention over Configuration”. I’ll be writing a post about why I feel Rails is better than Django later. Pick your language based on your goals and read the online books I have linked below. They will help you set up your computer and teach you how to create very simple programs for you to have a good base of understanding for programming.

Great Starters Guides

Code Editor

You’ll need a program to actually write the code. I personally suggest Sublime Text 3. It is free, light-weight, and can edit any type of programming file. It has a lot of neat extensions and themes so you can customize it to fit your needs.

Learn Git

Once you have picked your language of choice, no matter what it is, you’ll want to learn Git. Git is a tool to help you version your project and files. Versioning is similar to saving but gives you specific moments to return to. Let’s say you are working on a Word document. You start writing a lot, hit save, then you write a bunch more but decide you hate all that and want to return to where it was when you hit save initially. You could hit CTRL+Z a bunch but it would be nicer if you could point to a specific version of the file and say “I want to start from there again.” With Git you can do that. You make commits, marking moments in time, with messages about the changes made. If you ever want to go back you can simply rollback to any previous commit undoing your current changes. This is useful when you have a working program and then start to do some complicated work only to find you have totally screwed up the project. Just roll back to when it was working and start again.

Github

While you can use versioning locally for your small projects you really start to see its true power when you make your software available for others to review and help; this is known as open-source software. Create an account on Github and they will guide you in pushing your local git versioned projects into projects that anyone can see and help you with. Don’t be afraid of others seeing what you might consider “bad code”. The point of doing this is so others can help you learn and progress. When you have a larger project others can write features and submit bug fixes for your code as well. Once you have a firm grasp of whatever language you have chosen you can even write code for other open source projects to help them with their features and bugs.

Conclusion

Everyone should learn a little bit of programming just like everyone learns a little bit of math. Obviously we can go very deep into mathematics and we can do the same with programming but everyone should have a grasp of the basics and have a foundation even if you don’t do it professionally. I hope this guide was useful and let me know if you have any questions or concerns in the comments below.

Growing up I was always interested in computers.  I helped put parts in computers and install programs as young as five or six.  As I went to school I always knew I wanted to do something with computers.  Sadly, I wasn’t able to take any computer related classes in middle school or high school because they simply were not offered.  I would have loved to take a computer science course before going to college to better prepare myself for the challenges that it brings.

Luckily, there is a group trying to change that.  Between December 9-15, 2013 is Computer Science Education Week organized by Code.org.  Their goal is to promote computer science education.  They’ve done a great job getting celbrities to back the cause and made a great YouTube video that you can see on this page and their site.

Computer science is not just for those who want to program.  Computer science is all about solving complex problems and critical thinking.  The solutions computer scientists come up with are manifest through a computer program but anyone can benefit from being a better problem solver.  Taking time to learn to program just a little bit will help you better see solutions to complex problems and understand how many of your favorite programs work and function.

Take time to program today or teach someone else.  The Computer Science Education Week website has a lot of great tutorials for anyone new to computer science.  If you already have experience but want to practice a bit more, head on over to GitHub and find an open-source project that interests you and contribute.

*args and **kwargs

As a recent graduate in computer science, I really probably should have known this, but today I learned.  This morning as the team and I were discussing some new methods and software to write the discussion came up about what were the *args and **kwargs we so often see in method declarations within Python.  Off to the Internet we went and found a perfect explanation from none other than StackOverflow.

Turns out *args and **kwargs are arguments given to a method.  Now, we all knew this to be true, this was not the interesting part.  The interesting thing to me was that you can put these in your method declarations if you want it to accept varying lengths of arguments rather than explicitly defined ones.  Very cool indeed.

Now, I’ve used arguments a lot in computer science especially command line arguments when writing small assignments for classes.  I knew these were passed in as *args but was unsure of what the **kwargs were.  From the StackOverflow answer they are both sets of arguments except the difference is that *args is an ordered list of values while **kwargs is a dictionary key-pair or key word arguments.  So passing in either a list or a dictionary will allow us to use these variables to allow our methods to take any number of arguments.

Probably should have known that.  Probably should have a deeper and better understanding of it.  I’m just getting started.  You learn something new everyday.

-Eric