November 2008 - Posts
I've recently been toying with the System.Net.Sockets namespace... and this is how easy it is to write your own web server:
using System;
using
System.Collections.Generic;
using
System.Text;
using
System.Net;
using System.IO;
using
System.Net.Sockets;
using
System.Threading;
namespace
MyFirstWebServer
{
class Program
{
static void Main(string[]
args)
{
TcpListener
listener = new TcpListener(IPAddress.Parse("127.0.0.1"),
8010);
listener.Start();
TcpClient
client = listener.AcceptTcpClient();
NetworkStream
networkStream = client.GetStream();
StreamReader
reader = new StreamReader(networkStream);
StreamWriter
writer = new StreamWriter(networkStream);
String
line = reader.ReadLine();
while
(line != null && line.Length > 0)
{
Console.WriteLine(line);
line = reader.ReadLine();
}
writer.WriteLine("<html><head><title>Hello
World!</title></head><body>Hello
World!</body></html>");
writer.Flush();
networkStream.Close();
reader.Close();
writer.Close();
while
(true)
{
Thread.Sleep(1000);
}
}
}
}
The TCPListener accepts a pending connection request, writes out the request header to the console and returns the HTML string containing the "hello world".
The header output from the browser request:

The HTML string sent back to the browser:
Easy peasy lemon squeezy.
1. John De Vos, David Hill & Ajoy Krishnamoorthy - P&P Looking ahead : These guys are the P&P architects and they wanted to know how we felt about the current set of Enterprise Library tools. They also did a bit of horn blowing by providing us with the general usage statistics for the Enterprise Library in the development community.
I made a point of standing up and stressing the importance of having StarterKits for the different Ent Lib tools. I also stressed the importance of the Astoria framework for developers that work on multi-tier applications. :-P They referred me to their "Reference Implementations". (I need to look into this.)
2. Keynote - Scott Guthrie : Scott Guthrie gave some insight into Microsoft's up and coming technologies and mentioned something that had been bothering me since toying with the ASP.NET MVC framework. ASP.NET servercontrols WILL be fully supported in ASP.NET MVC applications in ASP.NET 4.0. He did not specifically mention that "ASP.NET 4.0" but if you read between the lines, ASP.NET 4.0 will be a hybrid of the MVC framework and Webforms technologies. Naaaaiiiicccceeeee. :-)
3. Billy Hollis - Drowning in Complexity : Once again Billy's session rocked the house. He crystalized a lot of my thoughts with regards to the Agile software development methodology. I totally agree, that it's a methodology invented by "Code Addicts", and he also pointed out how we...(us developers) and the general users of Microsoft's technologies are partly to blame for the complexity issues we face today due to our "Feature Hungry Mentality". Apple has managed to avoid this trap by building simple and easy to use devices like the iPhone and iPod. The key to their success lies in their simple and intuitive design.
1. Keynote - David Treadwell: This talk focused on cloud computing and David gave a demonsration of the how a "mesh" application would work.
2. David Hill & Kyle Huntley - Composition and presentation patterns : What a brilliant talk! David and Kyle took us through a WPF/Silverlight applicaton where the only differentiation was the UI skin!!! He showed how by implementing this pattern a WPF application can be easily upgraded to a Silverlight application. The application leveraged the Unity framework.
3. Rocky Lhotka - Porting CSLA to Silverlight: Rocky gave an overview of the CSLA framework. I agree with Rocky's general outlook on software design, but I felt he was very vague on how CSLA can be implemented and used. Personally I think he was trying to avoid making his talk sound like a sales pitch.
4. Drew Miller - Distributed caching : This was a very good talk on Distributed caching in multi-tier and web farm scenarios. It's worth investigating Velocity by Microsoft and MemCache. There are some good webcasts on Velocity that can be found here.
5. Erwin Van Der Valk - Presentation Layer Anti-Patterns: Erwin gave a good talk about the challenges that face UI developers, and and some insight into his experiences during his career.
6. Ward Bell - Lessons in Data Driven Silverlight Applications : Ward demonstrated a Silverlight application that performed the basic CRUD and included security membership features. He also stressed that developing in Silverlight would mean that the developer would have to adopt the "Asynchronous" mindset.
1. Keynote - Pat Helland : Pat gave a brilliant speech on the energy consumption of data centers. He gave us insight into the setup of Microsofts data centers and the strategies Microsoft use to conserve energy and keep costs low. This was an unexpected subject, but Pat is somebody definitely worth keeping an eye on.
2. Data Access - Don Smith : Don gave us a talk and demonstration on the Entity framework. At the end of the session I had a chat with him and asked him what Microsoft is doing to facilitate the integration of the DAL into the middle-tier. He said I should take a look at the REST & ADO.NET Data Services.
3. Evolutionary Design - Jim Newkirk : Jim gave a talk about how to avoid complexity in appications, and the general message was LESS IS MORE a lot of the time when it gets to shipping features. Rather make sure the features you provide work properly than try to ship too many features prematurely.
4. ESB Guidance - Dimitri Ossipov : Dimitri demonstrated the new ESB tools in VS 2010. He created services and their contracts in a designer and built a basic ESB architecture.
5. Architecture, simple or hard - Rocky Lhotka : This is probably my favourite talk so far. Rocky gave a good overview of the complexities that arise in multi-tier architectures, and some of the pitfalls we fall into that cause our applications generate unecessary complexity.
6. Pumping Iron - Dynamic languages in .NET - Harry Pierson : Harry wrote a XML parser in Iron python and gave some insight into the streanghs of this dynamic language. It looks really cool!
7. Dynamic Rules Driven Architecture - Billy Hollis : As always Billy was on top form :-) He showed how by creating rules driven architectures in our applications we can allow the client to extend their systems, as new business requirements materialise. I had a chat with Billy afterwards and got a few good ideas for one of the systems I own. Silverlight is looking like an extremely viable technology nowadays. ;-)
Evening Dinner with the Microsoft Research Team
This was an incredible experience and a real eye opener in terms of how Microsoft judge the success of thier products and some of the new development features on the horizon.
Some of the tools:
PEX : This generates unit test for projects that test every permutation of argument for each method. Bluddy awesome.
CHESS: This is a tool that allows you to catch threading bugs and replay them i.e. replicate them. Also really amazing.
Both of the tools above are available for VS 2008. (Keep an eye on the licensing though)
An architect here at P&P who attended the PDC last week said I should take a look at http://www.microsoftpdc.com/ where are the seminars are available to view.
Enjoy.
1. Keynote - Kent Beck : - This guy is the father of XP programming. The talk he gave was about the philosopy behind problem solving, and a few key techniques we can use to tackle problems.
They were. a) Have the guts to make the LEAP sometimes. b) Somtimes its critical to SIMPLIFY c) Sometimes it's usefull to REWRITE the system in paralell to maintaining the system. d) It's always important to REFACTOR.
2. Architecture without big design - Peter Provost: This was an introduction into Architect Explorer which will be released with VS 2010. Download the VS 2010 CTP while you are at it and give it a whirl.
Also there is a C# application called RAWR for World of warcraft players thats worth investigating. This was the application Peter Provost used in his Architecture Explorer demo. I need to get a copy of World of Warcraft for myself when I return! :)
3. Distributed Agile - Ade Miller : This guy spoke about how the Patterns and Practices team manages distributed team members. The final conclusion is that its very difficult and should be avoided if possible. NOTE: My take on team members bieng allowed to "work from home" should only occur in extreme circumstances.
4. TFS at Microsoft - Stephanie Saad : This woman gave us insight as to how Microsoft uses TFS. It was good to see that Microsoft also go through some of the pain points that we do.
5. Agile Development - Gabe Brown : Two of the Agile evangelists at Micorosft gave insight into strategies which they use to bring out quality software. They ALWAYS keep the Enterprise Library in a shippable state, and force each feature through "Quality Gates". This is a brilliant strategy.
I'll be compiling an email about this strategy to my work colleagues when I get back.
6. Acceptance testing - Grigori Melnik : This was about strategies for testing software in an Agile environment. Powerfull strategies for any Software develoment house.
7. Building Manageable applications - Alex Homer: This is one of my favourite speakers and I stayed late to chat to him personally aftwards.
He spoke about Health Monitoring Instrumentation Strategies, and the tools out there. I managed to extract some usefull ideas here for monitoring service applications. Dependency injection is a key building block here in terms of making your health/performance monitoring functionality extensible.
Cheers for now.
1. Keynot Jeff Teper - This guy did an overview of sharepoint and the future of the product.
2. Functional programming - Erik Meijer : I've been looking forward to this talk for a while. Erik M. is one of the architects that works with Anders H.
Erik gave some brilliant insight into the evolution of programming languages and pointed us to a Language called Haskell which is a pure functional language and would be an ideal introduction into this sphere.
A book we were advised to read : Graham Hutton - Programming in Haskell
3. Application Architecture - JD Meier : This was a chat about the new application architecture book comming out by Microsoft. This book look very relevant to all developers.
http://www.codeplex.com/AppArch
4. Enterprise Library 4.1 - This was a talk on the performance improvements as well as how the Enterprise library has been made more extensible.
5. MVC & Dynamic Data : A chat and demo of the ASP.NET MVC framework and HTML Helpers.There seems to be a new way of depicting custom controls in ASP.NET.
6. MEF Framework - Glen Block: This is an extensibility framework which is extremely simple to implement using attributes. Applications can be extended at runtime just by dropping an extension library into a defined folder.
7. Agile Security - Bryan Sullivan: A view on how to ensure your applications are secure and the tools which Microsoft use to verify thier applications are secure.
The jet lag was pretty rough.... I still find myself waking up at wierd hours of the night and checking the time. I also have a lot on my mind at the moment, and am looking forward to the conference which kicks off in 1 hour.
This blog post is about yesterday though. I managed to watch the Seattle Seahawks play the Philidelphia Eagles, ... the "Battle of the Birds". American football has always made more sense than rugby to me.You can tackle whoever the hell you please and you can throw the ball in any direction.... although I feel the game doesn't flow as well as rugby.
Strange and way out experiences so far include:
- The guy next to me at the football game getting chucked out of the stadium for gyrating his hips at the local supporters and pissing off the woman behind him. The "sprinkler routine" he performed every time the eagles scored was classic.
- The guys I met yesterday were cool. I got to chat with them and taste some of the local beverages.
I will be attending the Patterns and Practices summit 2008, which starts next week.
A list of speakers
http://www.pnpsummit.com/west2008/west2008.aspx
General topics
http://www.pnpsummit.com/West2008/west2008sessions.aspx
I attended the 2005 patterns and practices summit(the year before I joined m35) and found this conference extremely informative with regards to:
1) Gaining insight into the .Net Framework, and design patterns.
2) Learning about the Enterprise Library.
3) Learning about the new Infragistics controls. (Infragistics do talks on their .Net framework controls because they are one of the sponsors).
4) Gain a stronger understanding of Design Architecture which is an art that is always evolving.
The talks I am looking forward to are:
Drowning in Complexity: What You Can Do About It - Billy HollisWhat's the biggest problem facing architects and developers today. Billy Hollis believes that it's the extreme and ever-increasing complexity of the technologies we use as platforms. In this session, Billy will look at the signs that complexity in software development is getting out of hand, and how existing practices are not up to the task of dealing with that challenge. He doesn't pull punches; some sacred cows come in for rather severe criticism. Then he'll venture some ideas on dealing with complexity today and what changes in the industry are needed long term to counter the problem.
Fundamentalist Functional Programming - Erik MeijerIn 1984, John Hughes wrote a seminal paper "Why Functional Programming Matters" in which he eloquently explained the value of pure and lazy functional programming. Due the increasing importance of the Web and the introduction of many-core machines, in the quarter century since the appearance of the paper the problems associated with effectful imperative languages have reached a point where we hit a brick wall. We argue that fundamentalist functional programming, that is radically eliminating all side-effects from our programming languages, including strict evaluation, is what it takes to conquer the concurrency and parallelism dragon. We must embrace pure lazy functional programming "all the way," with all effects apparent in the type system of the host language using monads. Only a radical paradigm shift can save us, but does that mean that we will lose all current programmers along the way? Fortunately not! By design, LINQ is based on monadic principles. The success of LINQ proves that the world does not fear the monads.
MVC & Dynamic Data - Brad WilsonThe ASP.NET MVC framework is an exciting alternative to ASP.NET WebForms. The strength of MVC is that it gives you a clear separation of concerns, with fine-grained control over the HTML and Javascript that makes writing Web 2.0 applications much more streamlined. The ASP.NET Dynamic Data framework enables you to quickly build applications that are driven by data and business logic. In this session, Brad will preview both the ASP.NET MVC framework and the Dynamic Data implementation that's currently being developed especially to run on top of ASP.NET MVC.
I will keep a daily blog detailing my experiences at the summit.
Jean