PDC : The C# 4.0 and the future of the C# language

I had been watching the PDC session of C# 4.0 which is presented by Anders Hejlsberg. First of all , it was a great, even though there were some folks who came to just applause the guy:)

Starting from the release of 3.0 more functional programming stuff has integrated into C# and now it is time to dynamism!

dynamic my = SomethingFromSomeWhere();

after this line , you are gonna loose your intellisense , but you will get the dynamism. The check will be done in runtime.

The difference between var and dynamic , is basically , var is kinda trick that the language use , which is not repeating the type declaring twice. so at compile time, the left hand side will be converted into a type. But with dynamic , you will get the type of the object in runtime , so there won't be any compiler checks/errors , and if you screw something , you will know that at runtime!.

Even though Anders is pretty much a static guy , he simply explains , "the industry requests it , we see the need , and we are gonna put it there."

There are couple of new language enhancements also , but the most exciting thing was , the extension of the C# compiler . Anders declared , they already start to write the .NET compiler in managed code , so we will have a chance to extend the languages.

What he had pointed out was writing a simple app to dynamically execute C# code :) That was pretty cool.  If you want to see this action , directly start from the first hour of the video.

Well , let me get back to damn PHP:)

Hmmm , wait a minute , I also remember , they stole the optional parameter functionality from PHP ( or it might be already used at different languages also)

public void Test ( string parameter = "" , int myvalue = 0 , List<string> mylist ) {}

So what this line does . when you don't specify the parameters during this function call ;

Test(); 

The values that are declared in the function signature , will be treated as the real values.
What C# 4.0 also added , you can do this ;

Test( myvalue :12312 ) ;

Which means , you only specify the second variable , but specified with the parameter name.

But there is single rule ;  if you make a call like this ;

Test( "mystring" , mylist : null ) ;

you need the declare the normal parameter first , then the named parameter(s) afterwards.

Thats why I like C# , they stole some features from other programming languages , but also enhance them by somehow , present our lovely .NET community :)

The wisdow of the flying pig , Management and leadership thoughts from Jack Hayhow

I don't remember exactly how , but I found a great book about management and leader , which is full of great saying from all around the world. One of the nicest thing of the book , if you register yourself to the website , you can download the free copy of the keynot when you use the promotion code  L8N1B . This promotion code has been published by Leading Blog

Click here to go Jack Hayhow's web site and download the ebook.

 One of the things that I found amazing is the how the text placed in the book. It is easy to read , understand and think. The characters are also nice within the book.

Just started with pragmatism

Back in couple of years ago , I remember , somebody told me , you've got brain killed by programming when you've reached your thirties.I though that time, I should run out of programming as soon as possible. Well , I kinda run out already, but from my current point of view , the real programming starts at 30ies. It is not the programming that kills you ,it is the business that makes you got brain killed! It is a challenging job , but it also requires the good understanding of the processes and people rather than the tools. It is so important to understand your busines, if you want to be pragmatic and pragmatic

How to write your own operation system using Visual studio .NET and C# , meet Cosmos

Do not re-invent the wheel , is a commonly used saying to express not to repeat that has been already done , but I bet , writing an operation system in your favourite language ( if this is the case for you ) might be fun!

The whole idea is to make it as simple as possible ( hmm Vista is also simple , right , when you think about 50.000.000 Lines of production code , and you need to click Yes , agree , approve , deny 23423432 times / day ) 

Thus , take a look at the code project article Cosmos , and also the CodePlex website of the project.

Brute Force Debugging

  • Perform a full design and/or code review on the broken code
  •  Throw away the section of code and redesign/recode it from scratch
  •  Throw away the whole program and redesign/recode it from scratch
  •  Compile code with full debugging information
  •  Compile code at pickiest warning level and fix all the picky compiler warnings
  •  Strap on a unit test harness and test the new code in isolation
  •  Create an automated test suite and run it all night
  •  Step through a big loop in the debugger manually until you get to the error condition
  •  Instrument the code with print, display, or other logging statements
  •  Replicate the end-user’s full machine configuration
  •  Integrate new code in small pieces, fully testing each piece as its integrated
from book Codecomplete

Quotations about Computer Programming

Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more, and more expensive clerks even though they call them "operators" or "programmers."  ~Peter F. Drucker



Programmer - an organism that turns coffee into software.  ~Author Unknown


Programming is like sex.  One mistake and you have to support it for the rest of your life.  ~Michael Sinz


All programmers are playwrights and all computers are lousy actors.  ~Author Unknown


Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.  ~Martin Golding


Everyone knows that debugging is twice as hard as writing a program in the first place.  So if you are as clever as you can be when you write it, how will you ever debug it?  ~Brian Kernighan


Sometimes it pays to stay in bed in Monday, rather than spending the rest of the week debugging Monday's code.  ~Dan Salomon


[A]nd then it occurred to me that a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things.  They are, in short, a perfect match.  ~Bill Bryson


Another effective technique is to explain your code to someone else.  This will often cause you to explain the bug to yourself.  Sometimes it takes no more than a few sentences, followed by an embarrassed "Never mind, I see what's wrong.  Sorry to bother you."  This works remarkably well; you can even use non-programmers as listeners.  One university computer center kept a teddy bear near the help desk.  Students with mysterious bugs were required to explain them to the bear before they could speak to a human counselor.  ~Brian Kernighan and Rob Pike, about debugging


A good programmer is someone who always looks both ways before crossing a one-way street.  ~Doug Linder


All programmers are optimists.  Perhaps this modern sorcery especially attracts those who believe in happy endings and fairy godmothers.  Perhaps the hundreds of nitty frustrations drive away all but those who habitually focus on the end goal.  Perhaps it is merely that computers are young, programmers are younger, and the young are always optimists.  ~Frederick Brooks, Jr.


Any fool can write code that a computer can understand.  Good programmers write code that humans can understand.  ~Martin Fowler


Any sufficiently advanced bug is indistinguishable from a feature.  ~Rich Kulawiec


Beta.  Software undergoes beta testing shortly before it's released.  Beta is Latin for "still doesn't work."  ~Author Unknown


Controlling complexity is the essence of computer programming.  ~Brian Kernighan


Don't argue with people who write with digital ink and pay by the kilowatt-hour.  ~Don Rittner


From a programmer's point of view, the user is a peripheral that types when you issue a read request.  ~Peter Williams


At Group L, Stoffel oversees six first-rate programmers, a managerial challenge roughly equivalent to herding cats.  ~The Washington Post Magazine, 9 June 1985


It's not a bug - it's an undocumented feature.  ~Author Unknown


Version 1 of any software is full of bugs.  Version 2 fixes all the bugs and is great.  Version 3 adds all the things users ask for, but hides all the great stuff in Version 2.  ~Fred Blechman


Writing the first 90 percent of a computer program takes 90 percent of the time.  The remaining ten percent also takes 90 percent of the time and the final touches also take 90 percent of the time.  ~N.J. Rubenking


Good code is its own best documentation.  As you're about to add a comment, ask yourself, "How can I improve the code so that this comment isn't needed?"  ~Steve McConnell


Great software, likewise, requires a fanatical devotion to beauty.  If you look inside good software, you find that parts no one is ever supposed to see are beautiful too.  I'm not claiming I write great software, but I know that when it comes to code I behave in a way that would make me eligible for prescription drugs if I approached everyday life the same way.  It drives me crazy to see code that's badly indented, or that uses ugly variable names.  ~Paul Graham, "Hackers and Painters," 2003


I really hate this darn machine;
I wish that they would sell it.
It won't do what I want it to,
but only what I tell it.
~Author Unknown


He who hasn't hacked assembly language as a youth has no heart.  He who does so as an adult has no brain.  ~John Moore

 

If debugging is the process of removing bugs, then programming must be the process of putting them in.  ~Author Unknown


If you cannot grok the overall structure of a program while taking a shower, e.g., with no external memory aids, you are not ready to code it.  ~Richard Pattis


It should be noted that no ethically-trained software engineer would ever consent to write a DestroyBaghdad procedure.  Basic professional ethics would instead require him to write a DestroyCity procedure, to which Baghdad could be given as a parameter.  ~Nathaniel S. Borenstein


It's easy to cry "bug" when the truth is that you've got a complex system and sometimes it takes a while to get all the components to co-exist peacefully.  ~Doug Vargas


It's okay to figure out murder mysteries, but you shouldn't need to figure out code.  You should be able to read it.  ~Steve McConnell


It's the only job I can think of where I get to be both an engineer and an artist.  There's an incredible, rigorous, technical element to it, which I like because you have to do very precise thinking.  On the other hand, it has a wildly creative side where the boundaries of imagination are the only real limitation.  ~Andy Hertzfeld, about programming


We should forget about small efficiencies, say about 97% of the time:  premature optimization is the root of all evil.  ~C.A.R. Hoare, quoted by Donald Knuth


Programming is like sex.  One mistake and you have to support it for the rest of your life.  ~Michael Sinz


Programming is similar to a game of golf.  The point is not getting the ball in the hole but how many strokes it takes.  ~Harlan Mills


Programming languages should be designed not by piling feature on top of feature, but by removing the weaknesses and restrictions that make additional features appear necessary.  ~Author Unknown


Programming languages, like pizzas, come in only two sizes:  too big and too small.  ~Richard Pattis


Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots.  So far, the universe is winning.  ~Author Unknown


Programs for sale:  fast, reliable, cheap - choose two.  ~Author Unknown


Ready, fire, aim:  the fast approach to software development.  Ready, aim, aim, aim, aim:  the slow approach to software development.  ~Author Unknown


Reusing pieces of code is like picking off sentences from other people's stories and trying to make a magazine article.  ~Bob Frankston


Should array indices start at 0 or 1?  My compromise of 0.5 was rejected without, I thought, proper consideration.  ~Stan Kelly-Bootle


The best performance improvement is the transition from the nonworking state to the working state.  ~J. Osterhout


The magic of myth and legend has come true in our time.  One types the correct incantation on a keyboard, and a display screen comes to life, showing things that never were nor could be.... The computer resembles the magic of legend in this respect, too.  If one character, one pause, of the incantation is not strictly in proper form, the magic doesn't work.  Human beings are not accustomed to being perfect, and few areas of human activity demand it.  Adjusting to the requirement for perfection is, I think, the most difficult part of learning to program.  ~Frederick Brooks


The only way for errors to occur in a program is by being put there by the author.  No other mechanisms are known.  Programs can't acquire bugs by sitting around with other buggy programs.  ~Harlan Mills


There are two ways to write error-free programs; only the third one works.  ~Alan J. Perlis


One man's constant is another man's variable.  ~Alan J. Perlis


There does not now, nor will there ever exist, a programming language in which it is the least bit hard to write bad programs.  ~Lawrence Flon


We don't manage our time as well as we manage our space.  There's an overhead of starting and an overhead of stopping a project because you kind of lose your momentum.  And you've got to bracket and put aside all the things you're already doing.  So you need reasonably large blocks of uninterrupted time if you're going to be successful at doing some of these things.  That's why hackers tend to stay up late.  If you stay up late and you have another hour of work to do, you can just stay up another hour later without running into a wall and having to stop.  Whereas it might take three or four hours if you start over, you might finish if you just work that extra hour.  If you're a morning person, the day always intrudes a fixed amount of time in the future.  So it's much less efficient.  Which is why I think computer people tend to be night people - because a machine doesn't get sleepy.  ~Bill Joy


When a programming language is created that allows programmers to program in simple English, it will be discovered that programmers cannot speak English.  ~Author Unknown


When debugging, novices insert corrective code; experts remove defective code.  ~Richard Pattis


When you catch bugs early, you also get fewer compound bugs.  Compound bugs are two separate bugs that interact:  you trip going downstairs, and when you reach for the handrail it comes off in your hand.  ~Paul Graham, "The Other Road Ahead," 2001


You cannot teach beginners top-down programming, because they don't know which end is up.  ~C.A.R. Hoare


In programming, as in everything else, to be in error is to be reborn.  ~Alan J. Perlis


The New Testament offers the basis for modern computer coding theory, in the form of an affirmation of the binary number system.  "But let your communication be Yea, yea; nay, nay: for whatsoever is more than these cometh of evil."  Matthew 5:37  ~Author Unknown


What I mean is that if you really want to understand something, the best way is to try and explain it to someone else.  That forces you to sort it out in your own mind.  And the more slow and dim-witted your pupil, the more you have to break things down into more and more simple ideas.  And that's really the essence of programming.  By the time you've sorted out a complicated idea into little steps that even a stupid machine can deal with, you've certainly learned something about it yourself.  ~Douglas Adams

The Pragmatic Programmer , From Journeyman to Master ...(cont'd)

I am able to finish Chapter 6 - While you are coding and  Chapter 7 - Before the Project . These chapters triggered my understandings about the topics and made me reconsider everything I know about software development , requirement analysis , tools etc. . I would like to give a sneak preview what I have been reading so far.

On Chapter 6 ,Programming by coincidence is my current favorite. It explains why some piece of code might works or assume the code is working. I was shocked and confused when I first read the title, but whenever I went into the details of the topic, I got the idea behind it. An example coincident code from the book ;

paint(g); invalidate(); validate(); revalidate(); repaint(); paintImmediately(r); 

at the end of the day , the piece of code might output whatevet it is expected to do , but it is not logical to expect the desired outbut by  these cascading calls , because it is not intended to do.The topic also suggest rely on reliable things , and if you are making any assumptions , at least write them down.

Algorithm Speed explains about the performance considerations and mathematical way to define a algorithm complexity using Big "O" notation. ( I remembered senior year of Bachelor degree , iygghh!)

Refactoring topic explains , how , why and when. You might find quite a lot material about Refactoring. It is better to keep it short , "Refactor Early, Refactor Often"

Code That's Easy to Test  describes Unit Testing , Test Harness and writing code that is more suitable to test :)

Evil Wizards  highly suggest not the use the wizard code generators unless you understand them. Because it may cause more trouble that you expected to solve , if you dont get the idea.

 

On Chapter 7 , the topic goes aroung the pre stages of coding , talking about requirements , specifications , tools , methodologies. The idea is , don't stick to a single thing , embrace new things , and always look for a better way.

The topics are ; 

  • The Requirements Pit 
  • Solving Impossible Puzzles
  • Not Until You're Ready
  • The Specification Trap
  • Circles and Arrows

Well , the last chapter , Pragmatic Projects left behind.

if( Pragmatic Projects contains Pragmatic developers  ) Is this a best case senario ? :) Let's see what the next chapter will bring...

 

The Pragmatic Programmer: From Journeyman to Master

I have started to read The Pragmatic Programmer about a week ago , and still trying to finish. I am current at Chapter  5 , "Bend or Break". Since now , it has been quite a nice journey to read the chapters. Although the book has been written at 1999 , it is pretty much actual.

What this book gives us is the phylosophy behind the software development , ways to improve ourselves in daily basis , easify our job , solid tecniques to more flexiable , adaptable , configurable software development. Also includes a lot of suggestions to improve your career.

If you haven't read the book yet , I highly recommend you to read.

The Pragmatic Programmer , From Journeyman to Master

 

The Pragmatic Programmer: From Journeyman to Master

I have started to read The Pragmatic Programmer about a week ago , and still trying to finish. I am current at Chapter  5 , "Bend or Break". Since now , it has been quite a nice journey to read the chapters. Although the book has been written at 1999 , it is pretty much actual.

What this book gives us is the phylosophy behind the software development , ways to improve ourselves in daily basis , easify our job , solid tecniques to more flexiable , adaptable , configurable software development. Also includes a lot of suggestions to improve your career.

If you haven't read the book yet , I highly recommend you to read.

The Pragmatic Programmer , From Journeyman to Master

 

How to replace rows of a html table using javascript

Replace the rows