ENTRIES TAGGED "programming"

An introduction to TypeScript

At Fluent 2013, O’Reilly’s conference dedicated to the Web Platform, JavaScript and HTML5, Microsoft’s Luke Hoban spoke about TypeScript, a strict superset of JavaScript that adds optional static typing, modules, and classes.

In Introduction to TypeScript, Luke presented a 40 minute introduction to the language, how it relates to JavaScript and ECMAScript 6, and how TypeScript looks and behaves in IDE environments and within the context of complete applications.

TypeScript is an open source project from Microsoft that aims to help developers work on larger applications that could benefit from features like static typing but without eschewing JavaScript and its wealth of libraries and tools. As TypeScript is a strict superset of JavaScript, all JavaScript code is legitimate TypeScript code and TypeScript compiles down to idiomatic JavaScript so it runs on any runtime that JavaScript does too.

Some key parts of Todd’s talk include:

  • What is TypeScript? [at 01:48]
  • A demo of TypeScript [at 05:14]
  • A look at how typing helps [at 06:40]
  • How classes in TypeScript work [at 16:20]
  • The TypeScript ecosystem / community [at 21:53]
  • TypeScript 0.9 [at 25:48]
  • A look at generics support [at 29:18]
  • TypeScript in the context of a full app [at 34:40]

If you want to learn more about TypeScript, check out the official TypeScript homepage which includes a simple tutorial and an interactive playground that lets you type TypeScript code on the left hand side of the screen and see the JavaScript translation on the right.

Comment |

7 Ways to be a Better Programmer in 2014

Great tips to help you sharpen your skills

Coders make resolutions, no? If your to-do-better list is still empty, consider these ideas from other programmers to put to use in the New Year. Even the smartest folks have room to grow. The following excerpts are contained in the book 97 Things Every Programmer Should Know edited by Kevlin Henney.

  1. Check Your Code First Before Looking to Blame Others
  2. Continuous Learning
  3. Don’t Be Afraid to Break Things
  4. The Professional Programmer
  5. Take Advantage of Code Analysis Tools
  6. Ubuntu Coding for Your Friends
  7. You Gotta Care About the Code

Read more…

Comments: 32 |

Which Language Should You Learn First?

If everybody should learn to code, what's the right tool for learning?

What’s the best programming language for a beginner to start with?

It seems like a simple question, and one that lots of aspiring developers ask themselves, but it’s actually somewhat loaded. Are you asking because you want to get a job as a developer? Because you want to get in on the mobile app craze? Because you’ve been tasked with improving your company’s web offerings, even though you’re not a developer? Or just out of personal interest, for the fun of it?

Read more…

Comments: 22 |

The Feedback Principle

Gracefully maintain a desired value in the presence of uncertainty and change

In a previous post, we introduced the basic feedback concept. Now it is time to take a closer look at this idea.

Feedback is a method to keep systems on track. In other words, feedback is a way to make sure a system behaves in the desired fashion. If we have some quality-of-service metric in mind, then feedback is a reliable method to ensure that our system will achieve and maintain the desired value of this metric, even in the presence of uncertainty and change.

Read more…

Comment: 1 |

A Programming Life: Choose Your Own Adventure

Honesty, Evaluation, and a Success Story

I caught up with, Amye Scavarda (@amye), Client Advisor, Acquia, and Leslie Hawthorn (@lhawthorn), Community Manager, Elasticsearch at OSCON 2013 where both gave a talk on how to grow a career, that you’ll enjoy, in the open source world and beyond. Turns out it might not be so hard.

Key highlights include:

  • Some old school first steps in taking a look at your work life [Discussed at 0:57]
  • Don’t start by trying to improve what you are worst at [Discussed at 2:38]
  • How and when should you learn new programming languages? It depends. [Discussed at 4:09]
  • Success stories aka how this has worked for Amye [Discussed at 5:24]

You can view the full interview here:

Read more…

Comment |

Upward Mobility: If I Were King of XCode

Even a great development environment has room for improvement

As the not-so-mysterious September 10th Apple event approaches, it’s widely anticipated that the final version of iOS 7 will be released at the same time. Along with it will come a new version of XCode. While XCode is a pretty awesome development environment (in my opinion, at least), there are a few things that just irk the heck out of me. So, if anyone at Apple happens to be listening, here’s my laundry list of things I’d like to see fixed.

Read more…

Comments: 2 |

Upward Mobility: To Storyboard or Not to Storyboard

That is the question for iOS developers

Storyboarding was introduced in iOS 6, and it offers a way to consolidate all of your disparate Interface Building files into a single overarching whole. Although it’s tempting to jump on board and use it just because it’s the new thing, there are some things to keep in mind.

  1. Storyboards require you to make the jump to iOS 6; there’s no backwards compatibility for earlier versions. While this isn’t as much of a factor as it was a year ago, if you have legacy iPad 1 customers, you’re going to be locking them out of your app if you move to storyboarding.
  2. Having all your XIB files consolidated may sound good, but if you have a lot of them, you can end up with a new storyboard that’s so big that it is unwieldy.
  3. Storyboards are more than just a consolidation move; you also have to adopt a whole new programming style to move between your screens. Instead of explicit pushes and pulls off of view controller stacks or opening of modals, you are firing off segues that cause new view controllers to be created and transitions to occur.

The last point isn’t a bad thing per say. It’s a much more MVC-like paradigm: for example, where the overall controller knows what a transition means, and the individual views are only responsible for requesting a transition. It’s also much more like the way that Android does things. But it’s a different style of programming from traditional iOS UI development, and has a learning curve associated with it.
Read more…

Comment: 1 |

Upward Mobility: Android for iOS Developers, Part 4

Sensors indicate activity on the planet's surface, captain!

Our mini-Encyclopedia Galactica can do a few things now, but it’s hardly ready to offer up the recipe for a Pan-Galactic Gargle Blaster yet. If we want to take things to the next level (or at least the next screen), we need to learn how to move between Activities.

Moving between Activities is the Android equivalent of switching between view controllers, but more formalized. In some ways, it’s very similar to the storyboard and segue metaphor introduced in iOS6. To begin with, we need to create a new Activity in ADT, using the File->New->Other menu pick, and then choosing Android Activity from the choices under Android. I chose to name mine DetailActivity, and place it hierarchically under the MainActivity. By doing this, the back button will return me to the original Activity when I hit it.

Screen Shot 2013-07-01 at 10.51.56 PM

Using the blank template, I then added a large TextView at the top, an ImageView, and another TextView set to 10 lines of smaller text at the bottom.

Screen Shot 2013-07-02 at 12.33.29 AMNow we need to teach the MainActivity to navigate to this new page. I added a Button to the MainActivity layout, and then wired a listener up to it in the code in the onCreate method:

The mechanism that you use to transition between Activities is called an Intent. You create an Intent with the application context and the class of the Activity you wish to navigate to. Notice that unlike iOS, you don’t actually instantiate the new view you’re going to, so there’s no way to pre-populate values in the next view. So how do you pass in values? You stick them on the Intent, using the putExtra method. In this case, we put the planet name into the Intent, so that the detail page will know which planet to display.

One of the big gotchas with passing data via Intents is that you can’t just throw any old object onto it. Because of the Android architecture, it either has to be a simple object like a String, a primitive, or something that implements Serializable. You can also put Bundles or Parcels onto it.
Read more…

Comment |

Really Understanding Computation

Tom Stuart's new book will shed light on what you're really doing when you're programming.

It’s great to see that Tom Stuart’s Understanding Computation has made it out. I’ve been excited about this book ever since we signed it.

Understanding Computation started from Tom’s talk Programming with Nothing, which he presented at Ruby Manor in 2011. That talk was a tour-de-force: it showed how to implement a more-or-less complete programming system without using any libraries, methods, classes, objects, or even control structures, assignments, arrays, strings, or numbers. It was, literally, programming with nothing. And it was an eye-opener.

Shortly after I saw the conference video, I talked to Tom to ask if we could do more like this. And amazingly, the answer was “yes.” He was very interested in teaching the theory of computing through Ruby, using similar techniques. What does a program mean? What does it mean for something to be a program? How do we build languages that can handle ever more flexible abstractions? What kinds of problems can’t we solve computationally? It’s all here, and it’s all clearly demonstrated via Ruby code. It’s not code that you’d ever use in a real application (trust me, doing arithmetic without numbers, assignments, and control statements is ridiculously slow). But it is code that will expand your mind and leave you with a much better understanding of what you’re doing when you’re programming.
Read more…

Comment |

Thinking in Code

Multithreading for your brain

Allen Downey, is a Professor of Computer Science at Olin College of Engineering. He has written three books for us, so far, Think Python, Think Stats, and Think Complexity. I recently got the chance to sit down with him to talk about how writing good code can and should actually change the way you think—and make you a better programmer.

  • Think differently when dealing with natural language, math, and code [Discussed at 0:38]
  • Better code equals a better brain [Discussed at 2:05]
  • Look to Python for a jumpstart [Discussed at 4:43]
  • Manage the complexity of code for long lasting programs [Discussed at 7:12]
  • Dealing with legacy programs? Try to see the big picture. [Discussed at 8:40]

You can view the entire interview in the following video.

Read more…

Comment: 1 |