Saturday, August 25, 2012

Startups for Dummies

The problem with Steve Blank’s How to Build a Web Startup (Lean Launchpad Edition) article ...

There’s little to no focus on the actual product being built.

Only 1 out of 50 points listed is actually about building a product: Its listed under step 7, which is: “Add the backend code to make the site work”.

The rest is mostly cruft and admin type work that an outsourced worker could do. No doubt its important, but 98% compared to 2%?

The article comes across as a guide to building an over-hyped marketing vehicle, solely to receive funding, rather than actually building something useful that people want to use. There’s no mention of innovation or of making people’s lives easier. This is Startups For Dummies.

Full respect to Steve Blank (a 34 year veteran of Silicon Valley) and his views, but in my view, this particular article has a glaring weakness.


Some further reading on the topic:

This Starting a Startup article by Paul Graham is simple but contains three great points he says you should focus on:
  • People/a good team
  • A product that customers want
  • Low overheads

This 12 Ways To Make Your Web Startup Investable article by StartupSmart, recommends:
  • People/a good team
  • A clear market gap (i.e. a product that customers want)
  • Timing is everything

Incidentally, Steve Blank has just announced he is giving a free online course over at Udacity - Entrepreneurship: The Lean Lanchpad (EP245). It starts on 14 September, 2012.


Follow @dodgy_coder

Subscribe to posts via RSS

Thursday, August 23, 2012

TCP/IP Sockets in .NET 4

TCP is one of the core protocols of the Internet and is a bi-directional, client/server protocol. In .NET you can use the TcpListener Class for the server component, which provides simple methods that listen for and accept incoming connection requests from clients. You can use the TcpClient Class for the client component, which provides client connections to TCP server components; it provides simple methods for connecting, sending, and receiving stream-based data over the network.

Here's a standalone C# 4.0 app that demonstrates how to setup a TCP/IP sockets based client and server in .NET. It uses a command line option to determine whether to run the client or server. There's no external files or libraries needed, just the standard ones you get with a C# 4.0 console project. I've tested it with Visual Studio 2010 in Windows, and it will also work unchanged with Mono.

To run the server, from the command prompt...
   SocketsTest -server

To run the client, from another command prompt ...
   SocketsTest -client

Below is the source code ...


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Threading.Tasks;

/// 
/// Standalone TCP/IP sockets example using C#.NET 4.0
/// 
/// 
/// Compile as a C#.NET console mode application
/// 
/// Command line usage:
///   SocketsTest -client   => run the client
///   SocketsTest -server   => run the server
/// 
class SocketsTest
{
    static TcpListener listener;

    // Sample high score table data
    static Dictionary<string, int> highScoreTable = new Dictionary<string, int>() { 
            { "john", 1001 }, 
            { "ann", 1350 }, 
            { "bob", 1200 }, 
            { "roxy", 1199 } 
    };

    static int Port = 4321;
    static IPAddress IP_ADDRESS = new IPAddress(new byte[] { 127, 0, 0, 1 });
    static string HOSTNAME = "127.0.0.1";
    static int MAX_CLIENTS = 5;

    public static void Main(string[] args)
    {
        if (args.Contains("-server"))
        {
            ServerMain();
        }
        else if (args.Contains("-client"))
        {
            ClientMain();
        }
        else
        {
            Console.WriteLine("Usage: SocketsTest -client   => run the client");
            Console.WriteLine("       SocketsTest -server   => run the server");
        }
    }

    /// 
    /// Server receives player name requests from the client and responds with the score.
    /// 
    private static void ServerMain()
    {
        listener = new TcpListener(IP_ADDRESS, Port);
        listener.Start();
        Console.WriteLine("Server running, listening to port " + Port + " at " + IP_ADDRESS);
        Console.WriteLine("Hit Ctrl-C to exit");
        var tasks = new List();
        for (int i = 0; i < MAX_CLIENTS; i++)
        {
            Task task = new Task(Service, TaskCreationOptions.LongRunning);
            task.Start();
            tasks.Add(task);
        }
        Task.WaitAll(tasks.ToArray());
        listener.Stop();
    }

    private static void Service()
    {
        while (true)
        {
            Socket socket = listener.AcceptSocket();

            Console.WriteLine("Connected: {0}", socket.RemoteEndPoint);
            try
            {
                // Open the stream
                Stream stream = new NetworkStream(socket);
                StreamReader sr = new StreamReader(stream);
                StreamWriter sw = new StreamWriter(stream);
                sw.AutoFlush = true;

                sw.WriteLine("{0} stats available", highScoreTable.Count);
                while (true)
                {
                    // Read name from client
                    string name = sr.ReadLine();
                    if (name == "" || name == null) break;

                    // Write score to client
                    if (highScoreTable.ContainsKey(name))
                        sw.WriteLine(highScoreTable[name]);
                    else
                        sw.WriteLine("Player '" + name + "' was not found.");

                }
                stream.Close();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }

            Console.WriteLine("Disconnected: {0}", socket.RemoteEndPoint);
            socket.Close();
        }
    }

    /// 
    /// Client requests a player name's score from the server.
    /// 
    private static void ClientMain()
    {
        TcpClient client = new TcpClient(HOSTNAME, Port);
        try
        {
            // Open the stream
            Stream stream = client.GetStream();
            StreamReader sr = new StreamReader(stream);
            StreamWriter sw = new StreamWriter(stream);
            sw.AutoFlush = true;

            // Read and output the first line from the service, which
            // contains the number of players listed in the table.
            Console.WriteLine(sr.ReadLine());

            while (true)
            {
                // Input player name
                Console.Write("Enter player name: ");
                string name = Console.ReadLine();

                // Write name to server
                sw.WriteLine(name);
                if (name == "") break;

                // Read score from server
                Console.WriteLine(sr.ReadLine());
            }
            stream.Close();
        }
        finally
        {
            // Close the connection
            client.Close();
        }
    }
}




Follow @dodgy_coder

Subscribe to posts via RSS

Sunday, August 12, 2012

EMPORI: The original Amazon Locker from 12 years ago


Amazon Locker is a new delivery option offered by Amazon which provides secure, self-service pick-up stations located in a select number of cities in the US and UK. Once your package is delivered to the Amazon Locker, you receive an e-mail informing you that your package is available for pick-up.

This Amazon service came about 1 year after a Canadian startup called BufferBox started offering a similar secure dropbox service. BufferBox has lockers installed in two locations in Waterloo, one at the university and another a nearby corporate office. The company is nearing a launch in Toronto and plans to roll out lockers across Canadian and U.S. cities.

But back in 2000, another Canadian company launched a similar service. On July 24, 2000, Canadian property management company Oxford Properties Group launched a startup called EMPORI.COM. Customers could order products from affiliated online retailers via  Empori.com, which were then delivered on the same or next day to a secure depot containing lockers. The original depot was located in an office building in Toronto (Royal Bank Plaza) and over the course of a year this expanded to three more sites around Toronto. Oxford Properties Group saw this as a way for their commercial real estate customers to get additional value out of their prime inner city locations. The idea was that city workers would order products online and then, after receiving an email notification with the locker location and locker combination, would pick their order up at the end of the day, on their way home from work. A host of a products from 31 vendors were offered, from books to running shoes to groceries and even liquor.

The upmarket secure lockers offered by Empori
From the launch press release: "Empori.com is the one-of-a-kind retail solution to those barriers that discourage people from purchasing online. Our delivery system addresses the online shopping fulfillment problem."

Less than 1 year later, on July 17, 2001,  Empori.com closed after a $5 million loss. The blame was initially placed on the general business environment which included the bursting of the dot com bubble: "With recent changes in the dot-com environment, [Empori] was unable to find another strategic and financial partner to support further development of the business-to-consumer business,"

As the dust settled it looked like the single biggest factor in Empori’s failure was its inability to secure a critical mass of online retailers.  They tried to do too much - secure depots for pick-up was only one piece of their ambitious plan - they were also reselling goods via their website, which was the sole point of contact to access their secure depots. In effect they were trying to launch a new online retail site, coming off a base of zero customers, while in the general dot com gloom of 2000/01. Maybe what they should have done is to focus solely on their unique selling point - the secure depot - and offered it as a service, available to any online retailer, much as BufferBox is doing today.

The business burned $5 million in one year before closing
As of today, the Empori.com domain name is offered for outright sale for 3540 ($4351) by a European domain reseller. "Empori" is Italian for "Stores".




Saturday, July 21, 2012

Old school developers - achieving a lot with little


Ken Thompson

I was reading through bits of the excellent Coders at Work book by Peter Seibel and found it interesting that the (what I'd call respectfully) old school developers, such as Ken Thompson, Joe Armstrong and Jamie Zawinski use hardly any modern tools and techniques while developing software.

Ken Thompson was the designer of the B programming language (the precursor to C) and also the Go programming language (with Rob Pike). He also worked alongside Dennis Ritchie to develop the C programming language and the original Unix operating system while working at Bell Labs. After designing the UTF-8 method of character encoding on a placemat in a New Jersey diner, he worked overnight to implement full UTF-8 support in Bell Lab's Plan 9 operating system.
Regarding his programming style, he debugs only via printf statements, hardly ever uses unit tests, starts his projects by designing the data structures and then works bottom up, with throwaway test stubs.

Joe Armstrong
Joe Armstrong developed the Erlang programming language and the open source Open Telecom Platform (OTP) framework for Ericsson. When designing software he prefers to rigorously document as much as possible up front before starting to write code, especially for difficult projects such as those involving real-time networking protocols. He uses prototypes to solve the hard problems first, and for debugging, just uses print statements. He is a critic of Object Oriented Programming, and favours functional programming languages like Haskell. He never uses an IDE, preferring just Emacs and the command line (no mouse required).

Jamie Zawinski worked in MIT's AI lab with Lisp, then moved onto leading the development of Lucid Emacs, also in Lisp, which later became known as XEmacsAfter this he joined Netscape and worked on the front-end for the Unix version of Netscape Navigator, and later led the development of Netscape Mail (both projects were in C). He too prefers to just use print statements to debug his code. His process is either to write code top down or bottom up, let the code evolve naturally, then refactor it when necessary. During development he hardly ever uses unit tests, believing it slows things down - he thinks there's a lot to be said for getting the code right first time. In his view, its a matter of priorities, "do you want this to be good software or do you want it to be done next week - pick one because you can't have both".
Jamie Zawinski

So what tools and techniques do you actually need to be a great programmer? Are these modern techniques of TDD, BDD, Scrum, Agile, Design Patterns, XP etc. just window dressing or do they serve a higher purpose? Is it just a fact that a gifted programmer will always find a way to be a great programmer, no matter what tools he or she works with?

My own view is that some level of TDD and a reliance upon a decent set of unit tests is invaluable. Maybe then these modern techniques should just be seen as advances to make our job a little easier and more productive, especially for those who are not a genius-level developer, like these guys.

Follow @dodgy_coder

Subscribe to posts via RSS

Wednesday, June 27, 2012

Being a great tester


I just wanted to post a great little nugget of information from the end of Unit 1 of Software Testing: How to Make Software Fail (CS258) on Udacity, which is being taught by John Regehr and Sean Bennett.

  • The developer's attitude is "I want the code to succeed".
  • The tester's attitude is "I want the code to fail".
  • Although they seem contradictory, understand that you are both aiming to create more robust, higher quality software.
  • The developer aims to write quality code first time.
  • The tester aims to identify bugs which can then be fixed, thereby improving the robustness of the code.

Great testers ...

  • Test creatively - use their knowledge of the software under test to be creative in their test methods and test structure.
  • Don't ignore small glitches that are easy to overlook or ignore, but may hint at larger problems, which when followed up can often lead to major issues.

Watch the snippet on YouTube: Being a great tester (2 min, 33 sec)

Follow @dodgy_coder

Subscribe to posts via RSS

Sunday, June 3, 2012

Applying hardware testing concepts to software


I've recently been testing a desktop application I built with WPF and .NET 4 which collects data from the serial port and draws various charts on screen in real time. The volume of data isn't immense, one data frame of approx 200 bytes arriving every 200 milliseconds, but there is additional processing happening in the background. One of the steps being performed is regression analysis on various data points to construct curves of best fit.

In production this process will be run for likely not more than 30 minutes, but during testing I wanted to test the limits of the application by running the process for 2 hours, to be sure there was no memory leaks or performance issues. I was surprised when after just 1 hour the UI just became totally unresponsive, dramatically quickly.

I did find the issue and made the fix, but this got me thinking about where else this sort of issue could occur in software - because all I'd done was apply a simple form of software performance testing, known as endurance testing, which just involved running the software for significantly longer than normal. The endurance test has something in common with its hardware equivalent, soak testing.

The bathtub curve. The name derives from the cross-sectional shape of a bathtub. Image source: wikipedia
This leads to another hardware concept which I think can be partially applied to software - the bathtub curve, as shown above. The bathtub curve is used in reliability engineering to describe a particular form of the hazard function which comprises three parts.

Applied to hardware, the bathtub curve means:

  1. The first part is a decreasing failure rate, known as early failures. Burn in testing aims to detect (and discard) products which fail at this stage. If the burn-in period is made sufficiently long (and artificially stressful), the system can then be trusted to be mostly free of further early failures once the burn-in test is complete.
  2. The second part is a constant failure rate, known as random failures. These are like the "background" level of failures, which can usually never be totally eliminated from the production process. QC managers will often aim for a low level of failure here, via various quality control measures (such as TQM or Six Sigma).
  3. The third part is an increasing failure rate, known as wear-out failures. These can be detected via soak testing.  In electronics, soak testing involves testing a system up to or above its maximum ratings for a long period of time. Often, a soak test can continue for months, while also applying additional stresses like extreme temperatures and/or pressures, depending on the intended environment. 

Applied to software
, the bathtub curve might show bug count on the y-axis and total application run-time on the x-axis. Then, the three parts could mean:

  1. First part (early failures): In software, this could apply to bugs which break the software's functional requirements or specifications, and might be tested with various functional testing methods such as unit testing or integration testing. These are normally found early in the test cycle.
  2. Second part (random failures): Might apply to random bugs which are hard to detect, occur in specific conditions, and are outside the existing test coverage. An example might be a heisenbug
  3. Third part (wear-out failures): Bugs which appear due to memory leaks or performance degredation. These can be tested with endurance testing. During endurance tests, memory utilization is monitored to detect potential memory leaks, and throughput/response times are monitored to detect performance degradation.

Further Reading


Since writing the above I've found some other articles (listed below) about this concept which assume time on the bathtub curve to mean the software development life cycle's time, as opposed to my idea of being the individual run-time of a real-time application. I've listed them here for reference:

The bathtub curve for software reliability
Does the bathtub curve apply to modern software?
The Software Bathtub Curve
Improving Software Reliability using Software Engineering Approach - A Review



Follow @dodgy_coder

Subscribe to posts via RSS



+ - - - - - - - - - - - - - - - - - - - - - - - +
| Harris Walker Real Estate, Perth, WA, AUS     |
| Specialists in residential housing sales and  |
| property management in Perth, Australia.      |
+ - - - - - - - - - - - - - - - - - - - - - - - +



Sunday, May 6, 2012

Why was .NET called .NET?


Microsoft started development on the .NET Framework in the late 1990s, originally under the name of "Next Generation Windows Services" (NGWS).

So why did Microsoft choose the name .NET?

This is a bit of mystery, but the below answers are the best I've come across so far...

1) .NET enabled Microsoft's marketing people to emphasise the "Network"-ing aspect of its technologies, and was also a reaction to the marketing blitz by Sun Microsystems at the time, whose theme was "The network is the computer". The term "Dot Com" was synonymous with the Internet at the time, and "Dot Net" was a play on that term.
I don't think it is a bad name at all, the problem was that Microsoft initially named so many products with the ".NET" nomenclature like ".NET My Services" and ".NET Enterprise Servers", where the latter had nothing to do with the Internet. It caused so much confusion. Only later did Microsoft correct itself by limiting the .NET name to technologies related to the managed software framework.
- Stanley Siu
2) I was a dev at Microsoft at the time, and I have no idea whose ass the name .NET was pulled from. Anyone I talked to thought it was a lousy name for all the reasons already enumerated. At least it's pronounceable, unlike NGWS.
- George V. Reilly
3) The early marketing thrust of .NET was web services. .NET was supposed to make it easy both to write and consume web services. In particular, it was supposed to make it easier to call the web services that Microsoft was going to provide, and that everyone would then use: the ".NET My Services".
Of course, that fell apart very quickly, but the name remained. It was at least better than "COM++" or "ActiveXX".
- John Saunders

4) I was Summer intern at Microsoft in 2001 and back then the interns went to Bill Gates's house for a bbq near the end of the Summer. One of the interns asked "what other names did you think of before coming up with .NET?"

To the best of my memory, Bill's answer was something like:
"I didn't actually like the name .NET.  It makes people wonder if we are finally just starting to learn about the Internet.  Sadly, the other proposed name was even worse. Our mission statement at the time was 'work Anywhere, Anytime, on Any device,' so the proposal was AAAWare."
- leelin


Related Anecdote - the naming of Microsoft's C# programming language

In January 1999, Anders Hejlsberg formed a team to build a new language at the time called Cool, which stood for "C-like Object Oriented Language". Microsoft had considered keeping the name "Cool" as the final name of the language, but chose not to do so for trademark reasons, and came up with C# instead. Source : http://en.wikipedia.org/wiki/C_Sharp_%28programming_language%29#History

So instead of being a C#.NET developer, you might have been known as a Cool AAAWare developer!

StackOverflow mods

Until this blog post was published, a Q&A on this topic was available here on StackOverflow, which is still the top Google result for: why was .net called .net.

The question was deemed to be offtopic for StackOverflow, and was recently deleted, even though it had been visible (as 'Closed') for about three years or so. Just before it was deleted, I had edited the accepted answer (by Stanley Siu) to make some grammatical corrections. Then, briefly after my edit was accepted by a moderator, the whole question was deleted. So I thought it would be worthy of this brief blog post here, in case someone else wants to find out the answer, as I did ;-).

UPDATE (7-May-2012): somehow (maybe due to a bit of attention from this post?), the original question on StackOverflow has been un-deleted and is once again available at its original location here. Thanks SO moderators!

Follow @dodgy_coder

Subscribe to posts via RSS