Latest Post
Showing posts with label Programming. Show all posts
Showing posts with label Programming. Show all posts

Google Unveils Dart, an alternative to Javascript

Written By Unknown on Monday, 10 October 2011 | 05:38

dart-logo
Google today launched an "early preview" of Dart, a programming language the company hopes will help Web application programmers overcome shortcomings of JavaScript that Google itself feels acutely.

Programmer and project leader Lars Bak detailed the project in a talk today at the Goto conference conference today in Denmark and in a blog post. Dart is geared for everything from small, unstructured projects to large, complicated efforts--Gmail and Google Docs, for example.

"If we want to focus on making the Web better over time, we have to innovate," including with new programming languages, Bak said in an interview today.

Google also unveiled a Dart language site including open-source tools for writing Dart programs, code samples and tutorials, supporting libraries of supporting software, the Dart language specification, and forums for discussion.

Google is a big company, though, and others within the company remain strong JavaScript adherents. And Bak, while not denying Google has big ambitions, was quick to proclaim JavaScript alive and well.

"It's not going to replace JavaScript," Bak said. "JavaScript is is a cornerstone of the Web today, and it will continue to be for a long, long time."
Bak bristled at some of complaints about Google's approach to creating Dart in-house and not through a more collaborative approach.

"I don't buy the argument that before writing any line of code or designing any features, you put it in a standards committee, because that would just be a lot of screaming," Bak said. "You have to have coherent design before you start adopting Dart as a standard."
Making a standard is a goal, though. "It will be fairly lonely to create a standards committee when here's only us in it. We first have to get the backing of other partners before we can make a standard that's useful," he said.

Google is releasing Dart now for the next step in its maturation: outside feedback and participation. "We hope the other browser vendors will be excited," Bak said, adding that today is the first that Google has shared details about Dart with them or others.

Google is evaluating the best way to integrate Dart directly into its Chrome browser, something Bak is keen on. One reason: it will enable a "snapshotting" technology that dramatically improves a Web app's start-up time. Snapshotting involves taking an application and "serializing" it into a single block of data.

In one test of snapshotting, a 55,000-line Dart program loaded in 60 milliseconds compared to 640 milliseconds without it, Bak said. A conventional JavaScript program would load in comparable time as Dart without snapshotting, he said. "I can see a lot of optimizations that 'll be applicable to Dart" when it's integrated directly into a browser, he added.

Here's Bak's quick description of Dart:

Dart's design goals are:

• Create a structured yet flexible language for Web programming.

• Make Dart feel familiar and natural to programmers and thus easy to learn.

• Ensure that Dart delivers high performance on all modern Web browsers and environments ranging from small handheld devices to server-side execution.

Dart targets a wide range of development scenarios: from a one-person project without much structure to a large-scale project needing formal types in the code to state programmer intent. To support this wide range of projects, Dart has optional types; this means you can start coding without types and add them later as needed. We believe Dart will be great for writing large web applications.
Dart programs will be able to run within a Dart virtual machine--essentially a layer of software that acts as a computer to execute programs. They'll also be able to run using a compiler that translates Dart code into JavaScript code for browsers that don't support Dart, Bak said.

Google's Chrome browser has served as a vehicle to get the company's technology such as WebM and SPDY useful for at least a portion of Web users. Though the 2010 Dart/Dash memo said Google planned build Dart support into Chrome, Bak was cautious about making any definite statements beyond saying browser integration brings benefits. It's notable, though, that Bak led development of Chrome's V8 JavaScript engine, so he's hardly a stranger to the Chrome team or to the challenges of improving Web-app speed.

Building Dart into Chrome could let Google build Dart versions of its advanced Web apps that--if the language lives up to its billing--could be better than those Web apps today.

"Google has a lot fairly big Web applications. That includes Gmail and Docs. I hope many of these apps will be converted into Dart," Bak said--but cautioned that was his personal option, not an explicit plan.
Introducing new programming languages is tough. Though many hope that computing can improve by reforming or replacing languages, the incumbent power of existing languages is strong. Educating thousands or millions of programmers, building developer tools, and creating supporting libraries of code all can take years. As newer languages such as Java, JavaScript, and C# attest, though, it is possible.

Google also is trying to gain a foothold for Go, a programming language geared more for native software that today would most likely be written with C or C++.

Dart is designed to address several shortcomings Google sees with Web programming today, according to the Dart technical overview:

• Small scripts often evolve into large web applications with no apparent structure--they're hard to debug and difficult to maintain. In addition, these monolithic apps can't be split up so that different teams can work on them independently. It's difficult to be productive when a Web application gets large.

• Scripting languages are popular because their lightweight nature makes it easy to write code quickly. Generally, the contracts with other parts of an application are conveyed in comments rather than in the language structure itself. As a result, it's difficult for someone other than the author to read and maintain a particular piece of code.

• With existing languages, the developer is forced to make a choice between static and dynamic languages. Traditional static languages require heavyweight toolchains and a coding style that can feel inflexible and overly constrained.

• Developers have not been able to create homogeneous systems that encompass both client and server, except for a few cases such as Node.js and Google Web Toolkit (GWT).

• Different languages and formats entail context switches that are cumbersome and add complexity to the coding process.
The priority right now is to hear what the rest of the world thinks and to get them participating in Dart's development, Bak said.

"At this point it is mostly the language we are focused on," he said. "We hope to get positive feedback on the language."

Online IDE - C/C++, Java, PHP, Python, Perl and 40+ compilers & intepreters

Written By Unknown on Wednesday, 24 August 2011 | 10:47

online_ide
ideone.com is a... pastebin. But a pastebin like no other on the Internet. More accurate expression would be online mini IDE and debugging tool.

Ideone is an Italian word for great ideas - because ideone.com is a place where your greatest ideas can spring to life.

ideone.com is designed mostly for programmers (but, of course, common plain text can also be uploaded). You can use it to:

  • Share your code (that's obvious - it is a pastebin, isn't it? :)) in a neat way,

  • Run your code on server side in more than 40 programming languages (number still growing)

  • Do it all with your own input data!

  •  ideone.com also provides free Ideone API which is availabe as a webservice. It's functionality allows you to build your own ideone-like service!

  • For logged in users Ideone offers possibility to manage their codes, publish multiple submissions at one go, and more.


All codes can be accessed through convenient hash links. Source code pages provide information about the code and its execution: memory usage, execution time, language and compiler version, code itself, input uploaded by the user, output generated by the program and error messages from compilers and interpreters.

Read More

Pypy 1.6 Released: Alternative Implementation of Python 2.7.1

Written By Unknown on Friday, 19 August 2011 | 09:09

Pypy-1.6
The Pypy team has just announced the release of PyPy 1.6. This release brings a lot of bugfixes and performance improvements over 1.5, and improves support for Windows 32bit and OS X 64bit. This version fully implements Python 2.7.1 and has beta level support for loading CPython C extensions.

What is PyPy?

PyPy is a fast, compliant Python interpreter, almost a drop-in replacement for CPython 2.7.1. It's fast (pypy 1.6 and cpython 2.6.2 performance comparison) due to its integrated tracing JIT compiler.

This release supports x86 machines running Linux 32/64 or Mac OS X. Windows 32 is beta (it roughly works but a lot of small issues have not been fixed so far). Windows 64 is not yet supported.

The main topics of this release are speed and stability: on average on our benchmark suite, PyPy 1.6 is between 20% and 30% faster than PyPy 1.5, which was already much faster than CPython on our set of benchmarks.

The speed improvements have been made possible by optimizing many of the layers which compose PyPy. In particular, we improved: the Garbage Collector, the JIT warmup time, the optimizations performed by the JIT, the quality of the generated machine code and the implementation of our Python interpreter.

Highlights
  • Numerous performance improvements, overall giving considerable speedups

  • JitViewer: this is the first official release which includes the JitViewer, a web-based tool which helps you to see which parts of your Python code have been compiled by the JIT, down until the assembler. The jitviewer 0.1 has already been release and works well with PyPy 1.6.

  • The CPython extension module API has been improved and now supports many more extensions. For information on which one are supported, please refer to our compatibility wiki.

  • Multibyte encoding support: this was of of the last areas in which we were still behind CPython, but now we fully support them.

  • Preliminary support for NumPy: this release includes a preview of a very fast NumPy module integrated with the PyPy JIT. Unfortunately, this does not mean that you can expect to take an existing NumPy program and run it on PyPy, because the module is still unfinished and supports only some of the numpy API. However, barring some details, what works should be blazingly fast :-)

  • Bugfixes: since the 1.5 release we fixed 53 bugs in our bug tracker, not counting the numerous bugs that were found and reported through other channels than the bug tracker.


Download and Install
(Note: windows binary are not available yet)

These binaries include a Just-in-Time compiler. They only work on x86 CPUs that have the SSE2 instruction set (most of them do, nowadays), or on x86-64 CPUs. (This is the official release 1.6; for the most up-to-date version see below.)

If your CPU is really old, it may not have SSE2. In this case, you need to translate yourself with the option --jit-backend=x86-without-sse2.

Notes:

  • It is recommended to use PyPy to do translations, instead of using CPython, because it is twice as fast. You should just start by downloading an official release of PyPy (with the JIT).

  • If RAM usage is a problem, then you can (for now) tweak some parameters via environment variables and command-line options. The following command takes a bit more time, but finishes with only using 3.0 GB of RAM (on Linux 64-bit; probably not much more than 1.5 GB on 32-bit). It should be noted that it is less than with CPython.


PYPY_GC_MAX_DELTA=200MB pypy --jit loop_longevity=300 ./translate.py -Ojit
  • Because of asmgcroot, compiling the generated C files containing the JIT is delicate. It requires using either MSVC or gcc with no particularly fancy options. It does not work e.g. with clang, or if you pass uncommon options with the CFLAGS environment variable. You can also try to compile PyPy with the shadow stack option.


Checksums

Here are the checksums for each of the downloads (md5 and sha1):

ee949986fc5ec5c4a11ecbd546b87fbb    pypy-1.6-linux.tar.bz2
a34e3113508449393e874f409dd888fc    pypy-1.6-linux64.tar.bz2
78bbf70f55e9fec20d7ac22531a997fc    pypy-1.6-osx64.tar.bz2
1bdef4c7adc023033552754258fd02bb63612632    pypy-1.6-linux.tar.bz2
4a42625139351f9a1c2f8d7ec13ff636cfc9d8ac    pypy-1.6-linux64.tar.bz2
d703aa34fe1a45682ce4a09470ee9b1fa873d9be    pypy-1.6-osx64.tar.bz2
Or read more here.

The New C++: Lay down your knives, guns and clubs

Written By Unknown on Thursday, 4 August 2011 | 07:28

"The world is built on C++," said Herb Sutter. Considering he's one of the language's chief stewards, we question his impartiality. But he does have a point.

After more than 30 years – depending on whose numbers you swallow (these or these) – C++ remains one of computing's most popular programming languages, favored for its speed if not its simplicity.

Apple's Mac OS X, Adobe Illustrator, Facebook, Google's Chrome browser, the Apache MapReduce clustered data-processing architecture, Microsoft Windows 7 and Internet Explorer, Firefox, and MySQL – to name just a handful – are written in part or in their entirety with C++.

And while new languages have since been born, C++ has endured. Java is the only one to have outpaced it in popularity, according to the TIOBE Index. PHP, Ruby, and JavaScript? Sure, some might claim that they are the future, but C++ is the past, the present, and the future.

According to Sutter, C++ is on the verge of its biggest change in the 13 years since it became an official ISO standard, a change that will make it relevant for the next two decades.

The recently finished C++ ISO standard, with the working name of C++0x, is due to be published this summer, following the finishing touches to the ISO spec language and standards wonks agreed upon in March.

Sutter didn't create C++, but he is chair of the ISO's C++ committee in addition to being a noted C++ programmer, author, and chief native-languages architect at Microsoft.

herb_sutter.jpg

Sutter said: "This is the first major rev of the standard with new features since 1998." when the ISO ratified the first C++ standard.

The new C++ features many changes, but when asked to name the biggest, Sutter highlights those that address some of C++'s biggest bugbears: productivity and efficiency.

The complexity of working in C++ is one thing that Sun Microsystems' James Gosling tried to tackle when making a language that was more programmer-friendly; he cooked up Java, reputedly calling it C++ "without the guns, knives, and clubs." C++'s complexity might also be responsible for making C++ jockeys more prone to swearing than other coders.

Sutter lists auto keywords, lambda functions, and initializer lists as reasons you'll type – and swear – less. Some of the C++ clutter has also been stripped out.

"It really feels like you get the familiar power and way of talking about your code, but [it] feels like a fresh language that doesn't get in your way ... and [you] can write in much more expressive language," Sutter tells us.

Arguably the most significant changes will help C++ catch up to Java in popularity, now that C++ software can be built and run with fewer headaches in the rapidly dawning world of multi-core CPUs.

C++0x introduces a standardized memory model, something that Sun introduced in Java Standard Edition (Java SE) 5.0 in 2005.

Without a memory model, devs have either been building or picking their own libraries to achieve concurrency. Concurrency goes hand in hand with multi-core, as it means that chips with more than one core can run different threads in an application across their cores – or even on different servers. It helps handle the way the threads talk to the chip's memory.

The need for a consistent memory model is growing as more multi-core chips from Intel, AMD, and others become standard in mainstream computers from the PC on your desk to servers at Facebook to the smartphone in your hand.

Single-core eaten up

Sutter firmly believes that C++ must go concurrent, as the free lunch of single-core is over.

Sutter says that now is the time to establish concurrency in the standard, to make sure C++ runs efficiently and consistently everywhere. "You can [do], and people have done, just about anything in C++. The question in the standard is: 'What are you able to do that's portable?'" he says.

"The question is how have [data center and web] environments become standardized and formalized that it's time to standardize one common way of speaking to them and express those programs. Have things quieted down enough that now is the time to say: 'Here is the way'?"
The memory model means that C++ code now has a standardized library to call regardless of who made the compiler and on what platform it's running. There's a standard way to control how different threads talk to the processor's memory.

"When you are talking about splitting [code] across different cores that's in the standard, we are talking about the memory model. We are going to optimize it without breaking the following assumptions people are going to make in the code," Sutter said.
It's a small world, and more of it

Those assumptions? "It's a contact between the programmer and the optimizer of the system, to run across cores and different memories as long as we make the following assumptions the programmer makes," he says, "and on the programmer side, as long as he uses features in the right places, he's guaranteed not to tell the difference that the optimization has not changed the meaning of the program. That's what you need to have a usable programming language and still be fast and optimize."

Multi-core comes in chips, big and small, and is starting to make inroads into smartphones and tablets for the mainstream consumer. The iPad 2 in March was the first iOS device to use a multi-core processor – the dual-core 1GHz Apple A5. For systems built on Android – the fastest growing smartphone operating system, according to analysts – Texas Instruments, Qualcomm, and Motorola have gone dual-core, as well.

One factor that's helped C++ is its performance: as a native language, C++ talks to the CPU without going through an interpreter, unlike Java or even Microsoft's .NET, so it's generally considered fast – and performance is vital on devices such as tablets and smartphones.

According to Google, C++ is the fastest runtime language when compared to Java, Scala, and Go, although it does require more extensive tuning and more expertise to achieve such results.

james_gosling.jpg
No guns, knives, or clubs: Gosling's take on C++ versus Java

The rise in mobile devices means new opportunities for the new C++. For example, Google introduced the Android Native Development Kit (NDK) for use with the SDK to build "performance-critical portions of your apps in native code" – meaning C and C++.

An NDK update introduced in March 2010 supports OpenGL ES 2.0 and 3D elements, meaning Google threw open graphics for things like games to native C++. Apple's iOS for the iPhone and iPad, meanwhile, runs Objective C in addition to C++ and C.

According to Sutter, the combination of multi-core and native code like C++ will let devs squeeze the most out of the next generation of hand-held devices. "Managed languages like Java and .Net are still great, but the performance you give up when you use them is more important," he says. "Look at smartphones – almost every first release says 'managed only', but version two says 'native is important'. We want to wring the performance out of them."

The language may be fast, but the discussions that created the new C++ haven't been. Work on C++0x began in 2003, and took eight years to complete. You might ask how the standard can be relevant for both web-scale operations such as Facebook and palm-sized multi-function computing such as the iPhone, seeing as how work began on C++0x a year before the first Facebook page and four years before Jobs & Co. birthed the first iPhone.

Sutter answers that doubt by saying that the changes in C++0x are timeless, and part of an evolution affecting all languages, not just C++. "A lot of these [changes] are related to things that aren't moving targets," he says. "The 2003 proposals have been, and will be, useful for another 20 years."

He also reckons that the new C++ is ahead of the game because today's generation of C++ compilers lack the features needed to thoroughly milk what's in the new spec. In many ways this is a repeat of what happened when the standard was set in 1998. "We did nothing in the language to let compliers catch up, because [C++ in 1998] was ahead of where most compilers were. In 2003 we started again. Eight years later, we have a standard that most compliers don't support yet, but it's much closer," he says.

That said, Sutter believes that the version of the spec that will come after the one published this summer will be delivered more quickly. There won't be a quiet period of several years, he promises, saying that those attending the final C++0x meeting in March have begun pushing to start work on the next version.

"It'll be sooner rather than later," he says a little enigmatically.

Quicker, cleaner, Java-ier

And there could be more features from the world of Java added. Sutter expects garbage collection to be proposed – it was dropped from C++0x due to a lack of time. The Java Virtual Machine has had garbage collection for years. C++ fans can be touchy on this subject, saying there are lots of different ways to do garbage collection – but that's the problem.

In Sutter's world, the time has come to update the official standard to make sure that C++ software runs as efficiently as possible and in the same way on different platforms and chips. With a fresh proliferation of smartphones and tablets running a new wave of operating systems and chips on different form factors, that focus would seem to be right.

Interestingly, C++ was ratified as an ISO standard just as Java failed to get ISO pick-up after a campaign by Sun. Sun came up with the Java Community Process (JCP), to police compatibility as a step towards realizing the dream of "write once, run anywhere".

"C++ has for 13 years been an ISO and ANSI standard language – that defined the portable part," Sutter says. "Now it's time to extend that. ... You wouldn't add to the standard to extend it further if the language isn't used. That's the only reason you wouldn't want to make it stronger."

But as we know, C++ is far from unused. The world is programmed on it.

Learning JavaScript From Beginner to Advanced Level

Written By Unknown on Friday, 22 July 2011 | 12:58

Javascript
JavaScript (JS for short) is the programming language that enables web pages to respond to user interaction beyond the basic level provided by HTML links and forms and it is used in billions of Web pages to add functionality, validate forms, communicate with the server, and much more.

The links on this page lead to a variety of JavaScript tutorials and JavaScript training materials. Whether you are just starting out, wanting to learn JS basics, or are an old hand, wanting to sharpen your skills, you can find helpful resources here for JS best practices.

JavaScript is easy to learn and am sure you will enjoy it.

INTRODUCTION LEVEL

Getting Started with JavaScript
MDN
What is JavaScript and how can it help you?

An Introduction to Programming with JavaScript
Wikiversity
Learn the basics of programming with JavaScript


Programming – The Real Basics
Dev.Opera Web
Basic fundamentals of programming. Following articles introduce what you can do with JavaScript, best practices for using it, and more.

JavaScript From the Ground Up
Google Code University
Video tutorial on making pages interactive with JavaScript

JavaScript Guide
MDN
A comprehensive, regularly updated guide to JavaScript for all levels of learning from beginner to advanced.

JavaScript Best Practices
Dev.Opera
Learn about some of the obvious and (not so) obvious best practices when writing JavaScript.

INTERMEDIATE LEVEL

A Re-introduction to JavaScript
MDN
A recap of the JavaScript programming language aimed at intermediate-level developers.

Eloquent JavaScript
A comprehensive guide to intermediate and advanced JavaScript methodologies.

Essential JavaScript Design Patterns
Addy Osmani
An introduction to essential JavaScript design patterns.

The JavaScript Programming Language
YUI Blog
Douglas Crockford explores the language as it is today, and how it came to be.

Introduction to Object-oriented JavaScript
MDN
Learn about the JavaScript object model.

ADVANCED LEVEL

Learning Advanced JavaScript
John Resig
John Resig's guide to advanced JavaScript.

Introducing the JavaScript DOM
Elated
What is the Document Object Model, and why is it useful? This article gives you a gentle introduction to this powerful JavaScript feature.

An Inconvenient API: The Theory of the DOM
YUI Blog
Douglas Crockford explains the Document Object Model.

Advanced JavaScript
YUI Blog
Douglas Crockford looks closely at code patterns from which JavaScript programmers can choose in authoring their applications.

JavaScript Garden
Documentation of the most quirky parts of JavaScript.

Which JavaScript Framework?
StackOverflow
Advice on choosing a JavaScript framework.

Non-blocking JavaScript Downloads
YUI Blog
Tips on improving the download performance of pages containing JavaScript.

These resources are created by web developers who have embraced open standards and best practices for web development. If you think we've omitted a great resource, please tell us using the comment box.

Startups: 15-year-old who just sold his tech startup

Written By Unknown on Wednesday, 22 June 2011 | 15:05

Daniil Kulchenko
Its no more news around the world now. We get to see kids with their extra ordinary abilities on computer programming. I was reading Geek Wire this evening and came across this interview. Daniil Kulchenko, a 15 years old Perl Programmer from Kenmore, north of Seattle. The interesting part is that this kid just sold his tech start-up which was to me mind blowing. The interview went as follows;

Our guest on the latest GeekWire Podcast was Daniil Kulchenko, the 15-year-old sophomore from Kenmore, north of Seattle, who last week announced the sale of his cloud-computing startup, Phenona, to Vancouver, B.C.-based ActiveState.

We had a great time talking with him and hearing his story — including how he got into Perl programming at the age of 7, why he built the business, the influence of his parents in his life, and what his friends at Inglemoor High School think about the fact that he just sold a company.

If you missed the show, or just prefer text, continue reading for written excerpts from the conversation.

Todd Bishop, GeekWire: How did you start a company, and how were you even aware of Perl programming, at the age of 13?

Daniil Kulchenko: Actually, my father started me on Perl programming right around the age of 7. He gave me a book on Perl, and I just kinda took it and went with it. So along the years, I just progressed more and more, and then I started doing jobs with Perl around 11 or 12, and right around that time, this idea just happened to me. This was basically a need that I needed to fill for myself. I came up with the idea, and I just wanted to make it for myself at first, and then it slowly grew and grew and grew until I realized, well, I can make this into a business. Right around the age of 13 or 14 is when I started developing it seriously to bring it to the public.

John Cook, GeekWire: But your programming skills go back even further. You were programming at the age of 6 with some help from your mom, right?

Daniil: Yeah, I got a book on making web pages and just started playing around with the examples and made a few web pages back then.

John: So what was the appeal, and what is the appeal for you?

Daniil: I don’t know, it’s just been something that fascinated me. I guess it’s a lot because of my parents’ great involvement with it, which fascinated me. But it’s just something that I found really exciting.

John: So how much influence did (your parents) have, or what role did they play in helping you get the company off the ground?

Daniil: It was mostly an independent endeavor. I asked my dad for advice along the way. He helped with a lot of legal things, and just clarifying what I need to do at certain steps, but mostly it was just myself working on the code, and progressing it upward from there.

Todd: In basic terms, the way I understand it is that in the olden days, back in the 80s, people who were programming did it on their local computers, they created an executable file, a .exe file, and they sent it around to people and they installed it on their computers. Now that’s happening in what we call the cloud — there are servers somewhere we don’t even know half the time, and you’re not only programming there, on those servers, but you’re actually storing the code there and serving it up to people from those servers.

Daniil: Correct.

Todd: So you came up with the idea of doing this for Perl. So what was your inspiration?

Daniil: I really liked the current options that were on the market for the other languages, and Perl is just a great language. I’ve always loved using it. It’s always been a favorite even after I’ve tried other languages. And I couldn’t find an option for this on the market for Perl applications, so I thought, why not develop one especially for myself, because I needed to deploy Perl applications to the cloud, as well. I put it up and people were really interested.

Todd: What’s so great about Perl?

Daniil: It’s just been one where everything just works, and I think one of my favorite parts about it is something called the CPAN, which is basically a giant archive of code that users of the language have contributed, and it’s really nice because anything you can think of, someone’s probably already written the code for, and put it up online. You can just reuse the code.

John: So Daniil, you actually had an exit this week, we call it in the business. You sold your company. How did the deal come about?

Daniil:
They contacted me a few months ago, and I immediately knew the company because they’re really active in the Perl market. I’d known about the company for many years.

John: Many years? … One report put it, the company was founded a year after you were born.

Daniil: Yeah, so I’d known about them for a while, and I really liked it, it was really flattering when they contacted me. It just progressed from there. They were really interested.

John:
Did they know your age?

Daniil: They did, yeah. The very first email they sent, they already knew my age.

John: Did that play at all into the discussions? Because now you’re going on as a part-time employee. How did your age factor in?

Daniil: It’s mostly legal aspects and the fact that I can’t work full-time because school, as well. Other than that, it was pretty much transparent to my age. I was working as if I was an adult.

Todd:
We know that the financial terms of the deal are undisclosed, so we’re not going to get you in trouble here. I just want to know, was it like a modest contribution to the college fund, or a Porche in the high school parking lot?

Daniil: You know, I really don’t know how much I’m supposed to say here

John: He doesn’t even have his driver’s license yet! He can’t be thinking about a Porche in the parking lot!

Todd: So what kinds of things are you going to do for ActiveState?

Daniil: They obviously have an evolving cloud business right now, they’re really getting into the field, and I’ll be working with them on cloud solutions, similar to what Phenona does.

Todd: So will they continue to develop your product? Was it more about getting you or about getting Phenona?

Daniil: Hard to say, but Phenona is going to be integrated in some ways into what they have, but yeah, future plans for their product line are going to be announced later, but it’s going to be part of the business.

John: Talk a little about your friends at high school — what do they think about your entrepreneurial pursuits?

Daniil: They’re all impressed, I guess. The thing with the business is that it’s really technical, so when they ask, oh, so what is it, it’s really hard to explain to other 15 year olds what it does. I generally use a simplified explanation, where if you make a website, you need to get a bunch of servers and put the website on the servers, get all that working and what these kinds of services do is take care of that for you.

John: So what was their reaction, when you told some of your buddies?

Daniil:
A lot of them were really fascinated by it, they wanted to ask me more questions. All of them wanted to know how much the deal was.

Todd: Did you tell them?

John: Don’t tell them, I mean, come on, a bunch of 15 year olds? Probably the worst crowd to tell.

Daniil: Yeah. But they all wanted to know more, they were fascinated by it.

Todd: I have one question that’s almost a litmus test for society. You’ve got these (teenage) basketball players and baseball players getting recruited by major league teams. I’m really curious — are the computer science departments around the country actively contacting you and lobbying you to try to get you to go to their programs?

Daniil: Well, not yet. It hasn’t been too much time since the deal happened, but I’ve definitely gotten a lot of interest from individuals who want to talk to me, and find out what I know. Maybe give them some advice, they have questions about something. But yeah, there’s been a lot of individuals interested in talking to me.

John: So what’s next for you? Do you want to go to college? Do you want to pursue a computer science degree?

Daniil: Yeah, I want to get a degree in computer science just as kind of a backup, because a lot of workplaces today won’t even look at you if you don’t have a degree, regardless of what field work you have. So I’d like to have that degree, just as safety, regardless of the selling of the company.

John: What else do you do outside of working with Perl, and building companies? Do you do the normal 15-year-old stuff?

Daniil: Yeah, sure. There’s Facebook, obviously there’s hanging out with friends. I bike a lot. Read books sometimes. But yeah, generally an average high schooler.

John: Do you have an idea for another company?

Not right now, no. I’m definitely interested in the future, after this is over, definitely interested in pursuing other things.

John: Because once you’ve had one success, the venture capitalists start lining up to come and throw money at you. So get ready they’re going to probably come knocking on your door.

Todd: But do you see yourself continuing to be an entrepreneur?

Daniil: Oh, definitely, I have the spirit in me. It’s definitely something I want to do in the future.

Source: Geek Wire

CoffeeScript: The beautiful way to write JavaScript

Written By Unknown on Friday, 10 June 2011 | 09:20

coffee script javascriptI have coded a lot of years in JavaScript and I have produced a lot of JavaScript code. Yet even with all my experience I still struggle to make JavaScript beautiful. In this post I'll explore why writing beautiful JavaScript is hard and how to improve this with CoffeeScript - a minimalistic language that compiles to JavaScript.

What is beautiful code?


Given that beauty is subjective I want to state how I define beautiful code:
  • beautiful code uses the least amount of code to solve a given problem
  • beautiful code is readable and understandable
  • beautiful code is achieved not when there is nothing more to add, but when there is nothing left to take away (just like great designs)
  • the minimal length is a side-effect of beautiful code and not a goal or a measure
So for me beautiful code is a synergy between minimal code, functional code and readable code.

An example of beautiful JavaScript code

Let's take an example with the Fibonacci function as it's a function that most programmers should know.

Here is an implementation that I don't find beautiful, because the code has little structure and uses a lot more code than necessary:
function f(n) {
var s= 0;
if(n == 0) return(s);
if(n == 1) {
s += 1;
return(s);
}
else {
return(f(n - 1) + f(n - 2));
}
}
Here is another implementation that I find more elegant and beautiful, especially if you are familiar with the one line if else:
function fib(n) {
return n<2 ? n : fib(n-1) + fib(n-2)
}
I find this implementation beautiful as well, i.e. the number of lines don't matter that much:
function fib(n) {
if (n < 2)
return n
return fib(n-2) + fib(n-1)
}
The problems with JavaScript

I think one of the main problems with JavaScript is that it's a confusing hybrid between many different programming paradigms:
  • JavaScript is a functional language
  • JavaScript is an object oriented language, but it's prototype based
  • JavaScript is very dynamic and is a lot closer to Lisp than C/Java, but it has a C/Java syntax
  • Even JavaScript's name is confusing as JavaScript has very little to do with Java
In the end we have a language that has an identity crisis and we have programmers that try to force their paradigm onto JavaScript. And forcing a paradigm onto JavaScript isn't that good, because JavaScript isn't Java, it isn't Scheme and it isn't Python. JavaScript is JavaScript and it has some strengths and some weaknesses like all other programming languages.

JavaScript was also designed in a haste and some bad decisions reflect this - - like the dynamically scoping of this or the syntax used for inheritance. This is a big deal since fixing these problems is very hard due to backward compatibility issues. Here is a great quote from the creator of JavaScript that highlights the environment that JavaScript was born in:
JavaScript had to look like Java only less so, be Java’s dumb kid brother or boy-hostage sidekick. Plus, I had to be done in ten days or something worse than JavaScript would have happened.

— Brendan Eich

CoffeeScript: The new way to write better JavaScript

coffee scriptCoffeeScript is a minimal language that compiles to JavaScript. It aims to expose the good parts of JavaScript in a simple way. Before we look deeper into CoffeeScript I want to share my story of how I ended up with CoffeeScript.

I stumbled upon CoffeeScript a while ago and I tried to write a few scripts to get a feel of the language. I really loved coding in CoffeeScript, but the language itself was very immature when I tried it. Now fast forward to last week I had a serious issue with the JavaScript code I have written for Wedoist. I looked at it and said to myself this is garbage, there must be a better way to write this. I also looked at Wedoist's Python code and it seemed clean, minimal and readable. I then researched a lot on how to write better JavaScript code. My thoughts process was something along this line:

* Maybe I have missed some JavaScript idioms?
* Let me check how other open-source projects write their JavaScript, maybe they have figured a better way?
* Maybe I should try using backbone.js?
* Maybe I should read JavaScript: The Good Parts (again)?

I was blocked. As a way to explore options I took a small part of Wedoist's JavaScript code and tried to improve it. I tried my best to refactor and rewrite into some beautiful code I could be proud of... But no matter how hard I tried I could not make my JavaScript code as clean as my Python code. I was frustrated, especially since I code so much in JavaScript.

Here is where CoffeeScript enters the picture: I got the idea to rewrite to CoffeeScript, because maybe it's not my approach that's holding me back, but JavaScript itself. So after some hacking I rewrote the small part into CoffeeScript... and ... I was delighted! My CoffeeScript part looked so readable, so minimal and ultimately beautiful. I have found a way to write beautiful "JavaScript" by writing in another language that compiles to JavaScript.

CoffeeScript does not deprecate your JavaScript code

One of the things I love about CoffeeScript is that it compiles to JavaScript. This means I can reuse all of my current JavaScript code - I don't have to rewrite anything to CoffeeScript. This is a great deal, especially since Wedoist JavaScript codebase is quite large. It would suck to spend months rewriting to another language.

CoffeeScript also mimics JavaScript. It feels like a much improved version of JavaScript where the bad parts are removed or replaced. It also moves JavaScript away from the C/Java syntax and into the syntax of Ruby or Python (which is great, because JavaScript is a lot closer to Ruby or Python than it is to C or Java).

I have now a structure where I can just write new parts of my code in CoffeeScript and I plan to rewrite old parts into CoffeeScript as I move along. It's a great way to move a system forward as big rewrites are one of the single worst strategic mistake that any software company can make.

How CoffeeScript gets compiled to JavaScript

To clarify compilation let's take an example and see how it works.

CoffeeScript code:
square = (x) -> x * x
cube = (x) -> square(x) * x
"Compiled" JavaScript code:
var cube, square;
square = function(x) {
return x * x;
};
cube = function(x) {
return square(x) * x;
};
As you can see from the above example the mapping between CoffeeScript and JavaScript is pretty straightforward. On their website you can find a lot more examples of how CoffeeScript gets compiled to JavaScript.

CoffeeScript: Rewrite example

To give you a feeling of CoffeeScript here is a small JavaScript example I have rewritten to CoffeeScript:
get: function(offset, callback, limit) {
var self = this;

var data = {
project_id: Projects.getCurrent().id,
limit: limit || this.default_limit
}

if(offset)
data.offset = Calendar.jsonFormat(offset, true);

this.ajax.getArchived(data, function(data) {
if(!offset)
self.setCache(data);
callback(data);
});
},
The CoffeeScript code looks like this:
get: (offset, callback, limit) =>
data =
project_id: Projects.getCurrent().id
limit: limit or @default_limit

if offset
data.offset = Calendar.jsonFormat(offset, true)

@ajax.getArchived(data, (data) =>
if !offset
@setCache(data)
callback(data)
)
As you can see they look very similar, but in my opinion CoffeeScript looks a lot more crisp because all the unnecessary syntax is removed and we have only the essentials left.

Now let's take a look of some highlights of CoffeeScript.

CoffeeScript highlight: Inheritance made easy

JavaScript has a great inheritance system, but the syntax for it is horrific. CoffeeScript fixes this with an elegant inheritance system that mimics how classes and inheritance work in most other languages:
class Animal
constructor: (@name) ->

move: (meters) ->
alert @name + " moved " + meters + "m."

class Snake extends Animal
move: ->
alert "Slithering..."
super 5
CoffeeScript highlight: Arrays on steroids

I love List Comprehensions in Python and CoffeeScript has them!
list = [1, 2, 3, 4, 5]
cubes = (math.cube num for num in list)
With array slicing:
copy = list[0...list.length]
Array generators:
countdown = (num for num in [10..1])
CoffeScript highlight: Strings on steroids

CoffeeScript borrow's Ruby's syntax for string interpolation, which makes it easier to construct strings:
author = "Wittgenstein"
quote = "A picture is a fact. -- #{ author }"
Multi-line strings are allowed:
mobyDick = "Call me Ishmael. Some years ago - never mind how long precisely -- having little or no money in my purse, and nothing particular..."
CoffeeScript highlight: Binding this

this keyword in JavaScript is partially broken because it's dynamically scoped. CoffeeScript fixes this if you use => keyword (it will automatically bind this or @ for you):
Account = (customer, cart) ->
@customer = customer
@cart = cart

$('.shopping_cart').bind('click', (event) =>
@customer.purchase @cart
)
Explore CoffeeScript!

I have only scratched the surface of what CoffeeScript has to offer. Please check out their site for more details and their awesome annotated source code which is written in CoffeeScript (yes, CoffeeScript is written in itself!)

I am still exploring CoffeeScript and so far it's one of my favorite languages. A big kudos goes to Jeremy Ashkenas for writing it.

As always happy hacking, I hope you give CoffeeScript a try and don't forget to subscribe in order to receive more programming tips direct to your inbox.

Java: A Comprehensive Beginners Guide.

Written By Unknown on Saturday, 2 April 2011 | 17:29

This is a simple guide to give you a brief idea of Java and get you running simple programs as quickly as possible. As with anything you just have to keep at it! You might not understand everything at once but you will eventually. Java is a little tricky to understand at first but once you get the basic idea, its easy! The language itself is relatively easy to learn, the challenge comes in knowing how to logically apply the language to solve problems.

I recommend you download and install eclipse, available at:

http://www.eclipse.org/downloads/

Eclipse is an IDE, Integrated Development Environment and contains amongst other things an editor, compiler and the JVM (Java Virtual Machine). Eclipse IDE will save, compile, and run your code by simply clicking Run.

Java is made up of classes. These classes simply contain Java code to carry out tasks. The different tasks are called methods. The idea of Java is to piece together these classes and use their different methods to solve problems like the programming missions here at HTS.

Java is made up of hundreds of classes organized into packages. These packages of classes are stored in the Java Class Library. The following link shows the classes and methods of the JCL. These are known as the Java Docs.

http://download.oracle.com/javase/6/docs/api/

Lets Start

Install eclipse.
Open eclipse.
Select File | New | Java Project.
Type HTS as the project name and select Finish.
Using the File menu, create a new Class within that project. Name your Class MyFirstProgram, select finish. Note, Java is case sensitive, Classes begin with an upper-case letter, variables with a lower-case letter.

Type the following into your eclipse class and run it! No point moving forward until you see the displayed message in the console. Eclipse might have already typed the class name and inserted the braces.

CODE :
public class MyFirstProgram
{
public static void main(String[] args)
{
System.out.println("IT WORKS");
}
}
Everything inside the first set of braces belongs to your MyFirstProgram class. The next line is the main method. Every Java program must have a main method, we will not discuss the syntax of this line in this article, but you will always use it.

Everything inside the main method braces will be the main code we will focus on in this article to get us started.

System is a class in the JCL. The method println prints (“IT WORKS”) to the console.

If it works create a new class or delete the contents of the one your using and type or copy the following:

CODE :
public class MyFirstProgram
{
public static void main(String[] args)
{
int myAge = 23;
double myMoney = 234.23343;
String name = "fj";

System.out.println("My Name is " + name);
System.out.print("and my age is " + myAge + " and I have ");
System.out.println(myMoney + " pounds");
}
}
Explanation: myAge is a variable, its type is int. int is a Java primitive type, it is an integer. The variable is assigned to 23. The semicolon is the end of that line of code.

The next section of code will take user input from the console. This will give an introduction into Objects. Try the following code:

CODE :
import java.util.Scanner;

public class MyFirstProgram
{
public static void main(String[] args)
{
String name;
int myAge;

System.out.println("Type your name and age: "); // try HTS 10
// Try other inputs, can you get an error? Why?

Scanner myScan = new Scanner(System.in);

name = myScan.next();
myAge = myScan.nextInt();

System.out.println("My Name is " + name);
System.out.print("and my age is " + myAge);
}
}
Scanner is a class in the JCL. We create a new object of the Scanner class. The object myScan is an object/instance of the Scanner class. We can call or invoke the different methods of the Scanner class upon our newly created object. We find the methods that we can use by checking the Java docs (the link above).

We use the new operator to create an object. We use the import statement to import the Scanner class, located in the Java.Util package (but eclipse will do the imports for us)

The Scanner object myScan can be created in different ways using the parameters associated with the Scanner Class. In this case we are telling our new object that its input will be coming from System.in (the console). We could change System.in to take the input from other sources such as the internet. We could use our scanner object to read the source code of an internet site.

Try the following code:

CODE :
import java.net.URL;
import java.util.Scanner;

public class MyFirstProgram
{
public static void main(String[] args)
{
try
{
URL myURL = new URL("http://www.google.com/");
System.out.println(myURL.getDefaultPort());
Scanner myScan = new Scanner(myURL.openStream());
System.out.println(myScan.nextLine());
}

catch (Exception e)
{
System.out.println("There is no URL found, this is why we have the try, catch");
// We catch the error, so we do not crash!
e.printStackTrace();
}

}
}
Here we have an object/instance of the URL class. The URL class has different parameters, our myURL object/instance of the class sets the parameter as http://www.google.com/.

What methods can we invoke upon our newly created URL object? What are the methods of the URL class. The code above invokes the getDefaultPort method and openStream method. We create a new Scanner object, notice that we are using the openStream method instead of System.in as before.

Our code outputs the first line of source code from our website. Lets add a loop to capture all of the source code and then we are done for this article.

CODE :
import java.net.URL;
import java.util.Scanner;

public class MyFirstProgram
{
public static void main(String[] args)
{
try
{
URL myURL = new URL("http://www.hackthissite.org/");
Scanner myScan = new Scanner(myURL.openStream());

for (int i = 0; myScan.hasNext(); i++)
{
System.out.println(i + ": " + myScan.nextLine());
}
}

catch (Exception e)
{
System.out.println("There is no URL found, this is why we have the try, catch");
// We catch the error, so we do not crash!
e.printStackTrace();
}
}
}
As long as our myScan onject/instance of the Scanner class can read a line, then it prints it to the console with the index value. We do this by using the hasNext() method of our myScan instance/object of Scanner.

I hope this gives you a start with Java.

You Can't Be A Better Programmer in 21 Days

Written By Unknown on Saturday, 19 February 2011 | 08:39


People take a first programming course and they think they’re done - they’re programmers! Well not so fast. There is more to it than that just as there was more to learning and even reading when I finished the first grade. Others come to me and tell me they want to learn enough programming to create a specific application (rarely one that is that easy) or the next Halo 3 (never that easy) or something. There is this cram school mentality that seems to overtake so many people. Unfortunately, programming like so many things takes a while to really, deeply learn.

I ran across the article Teach Yourself Programming in Ten Years by Peter Norvig recently and it does a good job of addressing this very issue.

Why is everyone in such a rush?

Walk into any bookstore, and you'll see how to Teach Yourself Java in 7 Days alongside endless variations offering to teach Visual Basic, Windows, the Internet, and so on in a few days or hours. I did the following power search at Amazon.com:

     pubdate: after 1992 and title: days and
      (title: learn or title: teach yourself)

and got back 248 hits. The first 78 were computer books (number 79 was Learn Bengali in 30 days). I replaced "days" with "hours" and got remarkably similar results: 253 more books, with 77 computer books followed by Teach Yourself Grammar and Style in 24 Hours at number 78. Out of the top 200 total, 96% were computer books.

The conclusion is that either people are in a big rush to learn about computers, or that computers are somehow fabulously easier to learn than anything else. There are no books on how to learn Beethoven, or Quantum Physics, or even Dog Grooming in a few days. Felleisen et al. give a nod to this trend in their book How to Design Programs, when they say "Bad programming is easy. Idiots can learn it in 21 days, even if they are dummies.

Let's analyze what a title like Learn C++ in Three Days could mean:

  • Learn: In 3 days you won't have time to write several significant programs, and learn from your successes and failures with them. You won't have time to work with an experienced programmer and understand what it is like to live in a C++ environment. In short, you won't have time to learn much. So the book can only be talking about a superficial familiarity, not a deep understanding. As Alexander Pope said, a little learning is a dangerous thing.

  • C++: In 3 days you might be able to learn some of the syntax of C++ (if you already know another language), but you couldn't learn much about how to use the language. In short, if you were, say, a Basic programmer, you could learn to write programs in the style of Basic using C++ syntax, but you couldn't learn what C++ is actually good (and bad) for. So what's the point? Alan Perlis once said: "A language that doesn't affect the way you think about programming, is not worth knowing". One possible point is that you have to learn a tiny bit of C++ (or more likely, something like JavaScript or Flash's Flex) because you need to interface with an existing tool to accomplish a specific task. But then you're not learning how to program; you're learning to accomplish that task.

  • in Three Days: Unfortunately, this is not enough, as the next section shows.

Teach Yourself Programming in Ten Years

Researchers (Bloom (1985), Bryan & Harter (1899), Hayes (1989), Simmon & Chase (1973)) have shown it takes about ten years to develop expertise in any of a wide variety of areas, including chess playing, music composition, telegraph operation, painting, piano playing, swimming, tennis, and research in neuropsychology and topology. The key is deliberative practice: not just doing it again and again, but challenging yourself with a task that is just beyond your current ability, trying it, analyzing your performance while and after doing it, and correcting any mistakes. Then repeat. And repeat again.

There appear to be no real shortcuts: even Mozart, who was a musical prodigy at age 4, took 13 more years before he began to produce world-class music. In another genre, the Beatles seemed to burst onto the scene with a string of #1 hits and an appearance on the Ed Sullivan show in 1964. But they had been playing small clubs in Liverpool and Hamburg since 1957, and while they had mass appeal early on, their first great critical success, Sgt. Peppers, was released in 1967. Malcolm Gladwell reports that a study of students at the Berlin Academy of Music compared the top, middle, and bottom third of the class and asked them how much they had practiced:

Everyone, from all three groups, started playing at roughly the same time - around the age of five. In those first few years, everyone practised roughly the same amount - about two or three hours a week. But around the age of eight real differences started to emerge. The students who would end up as the best in their class began to practise more than everyone else: six hours a week by age nine, eight by age 12, 16 a week by age 14, and up and up, until by the age of 20 they were practising well over 30 hours a week. By the age of 20, the elite performers had all totalled 10,000 hours of practice over the course of their lives. The merely good students had totalled, by contrast, 8,000 hours, and the future music teachers just over 4,000 hours.

So it may be that 10,000 hours, not 10 years, is the magic number. Samuel Johnson (1709-1784) thought it took longer: "Excellence in any department can be attained only by the labor of a lifetime; it is not to be purchased at a lesser price." And Chaucer (1340-1400) complained "the lyf so short, the craft so long to lerne." Hippocrates (c. 400BC) is known for the excerpt "ars longa, vita brevis", which is part of the longer quotation "Ars longa, vita brevis, occasio praeceps, experimentum periculosum, iudicium difficile", which in English renders as "Life is short, [the] craft long, opportunity fleeting, experiment treacherous, judgment difficult." Although in Latin, ars can mean either art or craft, in the original Greek the word "techne" can only mean "skill", not "art".

Here's my recipe for programming success:
  • Get interested in programming, and do some because it is fun. Make sure that it keeps being enough fun so that you will be willing to put in ten years.
  • Talk to other programmers; read other programs. This is more important than any book or training course.
  • Program. The best kind of learning is learning by doing. To put it more technically, "the maximal level of performance for individuals in a given domain is not attained automatically as a function of extended experience, but the level of performance can be increased even by highly experienced individuals as a result of deliberate efforts to improve." (p. 366) and "the most effective learning requires a well-defined task with an appropriate difficulty level for the particular individual, informative feedback, and opportunities for repetition and corrections of errors." (p. 20-21) The book Cognition in Practice: Mind, Mathematics, and Culture in Everyday Life is an interesting reference for this viewpoint.
  • If you want, put in four years at a college (or more at a graduate school). This will give you access to some jobs that require credentials, and it will give you a deeper understanding of the field, but if you don't enjoy school, you can (with some dedication) get similar experience on the job. In any case, book learning alone won't be enough. "Computer science education cannot make anybody an expert programmer any more than studying brushes and pigment can make somebody an expert painter" says Eric Raymond, author of The New Hacker's Dictionary. One of the best programmers I ever hired had only a High School degree; he's produced a lot of great software, has his own news group, and made enough in stock options to buy his own nightclub.
  • Work on projects with other programmers. Be the best programmer on some projects; be the worst on some others. When you're the best, you get to test your abilities to lead a project, and to inspire others with your vision. When you're the worst, you learn what the masters do, and you learn what they don't like to do (because they make you do it for them).
  • Work on projects after other programmers. Be involved in understanding a program written by someone else. See what it takes to understand and fix it when the original programmers are not around. Think about how to design your programs to make it easier for those who will maintain it after you.
  • Learn at least a half dozen programming languages. Include one language that supports class abstractions (like Java or C++), one that supports functional abstraction (like Lisp or ML), one that supports syntactic abstraction (like Lisp), one that supports declarative specifications (like Prolog or C++ templates), one that supports coroutines (like Icon or Scheme), and one that supports parallelism (like Sisal).
  • Remember that there is a "computer" in "computer science". Know how long it takes your computer to execute an instruction, fetch a word from memory (with and without a cache miss), read consecutive words from disk, and seek to a new location on disk. (Answers here.)
  • Get involved in a language standardization effort. It could be the ANSI C++ committee, or it could be deciding if your local coding style will have 2 or 4 space indentation levels. Either way, you learn about what other people like in a language, how deeply they feel so, and perhaps even a little about why they feel so.
  • Have the good sense to get off the language standardization effort as quickly as possible.

With all that in mind, its questionable how far you can get just by book learning. Before my first child was born, I read all the How To books, and still felt like a clueless novice. 30 Months later, when my second child was due, did I go back to the books for a refresher? No. Instead, I relied on my personal experience, which turned out to be far more useful and reassuring to me than the thousands of pages written by experts.

Fred Brooks, in his essay No Silver Bullet identified a three-part plan for finding great software designers:

  1. Systematically identify top designers as early as possible.
  2. Assign a career mentor to be responsible for the development of the prospect and carefully keep a career file.
  3. Provide opportunities for growing designers to interact and stimulate each other.

This assumes that some people already have the qualities necessary for being a great designer; the job is to properly coax them along. Alan Perlis put it more succinctly: "Everyone can be taught to sculpt: Michelangelo would have had to be taught how not to. So it is with the great programmers".

So go ahead and buy that Java book; you'll probably get some use out of it. But you won't change your life, or your real overall expertise as a programmer in 24 hours, days, or even months.

References

Bloom, Benjamin (ed.) Developing Talent in Young People, Ballantine, 1985.

Brooks, Fred, No Silver Bullets, IEEE Computer, vol. 20, no. 4, 1987, p. 10-19.

Bryan, W.L. & Harter, N. "Studies on the telegraphic language: The acquisition of a hierarchy of habits. Psychology Review, 1899, 8, 345-375

Hayes, John R., The Complete Problem Solver, 2nd Edition Lawrence Erlbaum, 1989.

Chase, William G. & Simon, Herbert A. "Perception in Chess" Cognitive Psychology, 1973, 4, 55-81.

Lave, Jean, Cognition in Practice: Mind, Mathematics and Culture in Everyday Life, Cambridge University Press, 1988.

Answers

Approximate timing for various operations on a typical PC:

execute typical instruction1/1,000,000,000 sec = 1 nanosec
fetch from L1 cache memory0.5 nanosec
branch misprediction5 nanosec
fetch from L2 cache memory7 nanosec
Mutex lock/unlock25 nanosec
fetch from main memory100 nanosec
send 2K bytes over 1Gbps network20,000 nanosec
read 1MB sequentially from memory250,000 nanosec
fetch from new disk location (seek)8,000,000 nanosec
read 1MB sequentially from disk20,000,000 nanosec
send packet US to Europe and back150 milliseconds = 150,000,000 nanosec

Appendix: Language Choice

Several people have asked what programming language they should learn first. There is no one answer, but consider these points:

Use your friends. When asked "what operating system should I use, Windows, Unix, or Mac?", my answer is usually: "use whatever your friends use." The advantage you get from learning from your friends will offset any intrinsic difference between OS, or between programming languages. Also consider your future friends: the community of programmers that you will be a part of if you continue. Does your chosen language have a large growing community or a small dying one? Are there books, web sites, and online forums to get answers from? Do you like the people in those forums?

Keep it simple. Programming languages such as C++ and Java are designed for professional development by large teams of experienced programmers who are concerned about the run-time efficiency of their code. As a result, these languages have complicated parts designed for these circumstances. You're concerned with learning to program. You don't need that complication. You want a language that was designed to be easy to learn and remember by a single new programmer.

Play.
Which way would you rather learn to play the piano: the normal, interactive way, in which you hear each note as soon as you hit a key, or "batch" mode, in which you only hear the notes after you finish a whole song? Clearly, interactive mode makes learning easier for the piano, and also for programming. Insist on a language with an interactive mode and use it.

Given these criteria, my recommendations for a first programming language would be Python or Scheme. But your circumstances may vary, and there are other good choices. If your age is a single-digit, you might prefer Alice or Squeak (older learners might also enjoy these). The important thing is that you choose and get started.

Appendix: Books and Other Resources

Several people have asked what books and web pages they should learn from. I repeat that "book learning alone won't be enough" but I can recommend the following:

Scheme: Instructor's Manual t/a Structure and Interpretation of Computer Programs - 2nd Edition is probably the best introduction to computer science, and it does teach programming as a way of understanding the computer science. You can see online videos of lectures on this book, as well as the complete text online. The book is challenging and will weed out some people who perhaps could be successful with another approach.

Scheme: How to Design Programs is one of the best books on how to actually design programs in an elegant and functional way.

Python: Python Programming: An Introduction to Computer Science is a good introduction using Python.

Python: Several online tutorials are available at Python.org.

Oz: Concepts, Techniques, and Models of Computer Programming (Van Roy & Haridi) is seen by some as the modern-day successor to Abelson & Sussman. It is a tour through the big ideas of programming, covering a wider range than Abelson & Sussman while being perhaps easier to read and follow. It uses a language, Oz, that is not widely known but serves as a basis for learning other languages.

How to become a better Programmer

This will give you a few hints and some help to becoming a better programmer. So read on and enjoy! Programming can be a lot of fun.

Go for it!

1. Use a bigger font size.

This is ridiculously easy -- but it works.

Go to your favourite IDE, and crank the font-size up. I switched from 10pt to 14 pt. The difference is that a lot less code fits on the screen at once.

The effect is: you're forced to write shorter methods. And that's a Good Thing.

(Scott Hanselman recommends that one)

  1. Make hard-coded strings look ugly.I learnt this from Joe Cooney.
    Go to your favourite IDE, and set it so that literal strings stand right out -- for example a yellow background with a red font. Make 'em ugly. Damn ugly. This will encourage you to perform less hard coding, and to notice when you are embedding strings in your text.

  2. Pick an 'obscure' keyword and master itDo you fail to yield?. Is there a keyword you never use?
    Every keyword has a purpose. Learn to master those mystery keywords and your powers will become extraordinary.
    Here are lists for a few .net languages: C#, VB.net, F#.

  3. Increase code-coverage by 1%Don't kill yourself striving for 100% coverage of code with automated unit tests. But take a few minutes to increase your coverage by 1%.
    Most likely, that means going from 0% to 1%. And that's the biggest improvement of all.
    Find a particularly ghoulish regular expression. Or a critical piece of business logic. These things can't be trusted without tests.

  4. Read the code from an open source projectSometimes, when I'm looking at the code of a complete stranger, I get that same, weird feeling I get when I'm creeping through my neighbour's house. Picking up their stuff, looking through their fridge.
    Learn to overcome the creepy sensation, and bring on the learn.
    Maybe start with Hanselman's Weekly Source Code series.

  5. Run a static analysis tool against your codeUse fxcop, or StyleCop, clone detective, ndepend, the code metrics feature of VS 2008, or any other static analysis tool of your choice.
    Uncover your greatest weakness. Even a cursory glance at the output will leave you distraught at just how much room you've got for improvement.

  6. Pick an ugly method to refactorYou know the method. That method you're particularly ashamed of. That one that's long and ugly and horrible. And it's crucial to the whole application.
    You don't have to polish it from a turd to a diamond, but just neaten it up a little. Rename a variable. Hoist part of it out into a separate method. Start simple. The momentum will increase. Watch out.

  7. Stop reading, start writing.And don't just write. Write a compiler!
    This ol' msdn article is a good place to start. Joel Pobar will get you writing your own language compiler in but a handful of minutes.
That's all I've come up with for now. But what've you got?
What are some activities that helped you be a better programmer?
 
Support : Creating Website | Johny Template | Mas Template
Copyright © 2011. Turorial Grapich Design and Blog Design - All Rights Reserved
Template Created by Creating Website Published by Mas Template
Proudly powered by Blogger