Phil Trelford's Array
POKE 36879, 255

Oops

October 7, 2014 14:27 by phil

Are you working in the enterprise?

Do you find yourself, day-in-day-out, up to the eyeballs in unmaintainable code?

Does the once beautiful architecture now more closely resemble a big ball of mud, that no amount of tooling will dig you out of?

What can you do?

1) Bury your head in the sand

head-in-the-sand

A very popular option, you just need to keep practising denial.

2) Turn to drink

gazza

Another popular option, although unfortunately this strategy is only likely to last as long as your liver.

3) Become a scrum master

scrum master

This is an easy way out, scrum certification is just a 2 day course away, but there’s probably no looking back.

4) Admit there’s a problem

AA

This is one of the hardest and least popular options, but possibly the most rewarding.

Start by saying out loud: “Object Oriented Programming is an expensive disaster which must end” and then take each new day as it comes.


Tags:
Categories: C# | C++ | Java
Actions: E-mail | Permalink | Comments (7) | Comment RSSRSS comment feed

C# 6 Cuts

October 2, 2014 00:21 by phil

In a recent thread on CodePlex Mads Torgeson, C# Language PM at Microsoft, announced 2 of the key features planned for C# 6 release have now been cut:

  • Primary constructors
  • Declaration expressions

According to Mads:

They are both characterized by having large amounts of downstream work still remaining.

primary constructors could grow up to become a full-blown record feature

Reading between the lines Mads seems to be saying the features weren’t finished and even if they were they seemed to conflict with a potential record feature currently being prototyped.

The full thread is here: Changes to the language feature set

Language Design

I think there’s two distinct options when adding new features to an existing language with a large user base:

  • upfront design
  • implement incrementally

Upfront design should mean that all cases are met but comes at a time-to-market cost, where as an incremental implementation means quick releases with the potential risk of either sub-optimal syntax or backward compatibility issues when applying more features.

It appeared at the high level that the C# team’s had initially opted for the incremental option. The feature cuts however suggest to me that there may have been a change in direction towards more upfront design.

Primary Constructors

The primary constructors feature was intended to reduce the verbosity of C#’s class declaration syntax. The new feature appeared to be inspired by F# ’s class syntax.

If you like the idea of a lighter syntax for class declarations then you may just want to try F# which already has a well thought out mature implementation, i.e.

type Person(name:string, age:int) =
    member this.Name = name
    member this.Age = age

Or for simple types use the even simpler record type:

type Person = { Name:string, Age:int }

Note: on top of lighter class syntax F# also packs a whole raft of cool features not available in C#, including powerful pattern matching and data access via Type Providers.

Declaration Expressions

Declaration expressions was again designed to reduce verbosity in C# providing a lighter syntax for handling out parameters. Out parameters are used in C# to allow a method to return multiple values:

int result;
bool success = Int32.TryParse("123", out result);

Again handling multiple return values is handled elegantly in F# which employs first-class tuples, i.e.

let success, value = Int32.TryParse("123")

As shown above, C# out parameters can be simply captured in F# as if the method were returning multiple values as a tuple.

Conclusion

The first time I saw Mads publicly announce the now cut primary constructor syntax and declaration expressions was nearly a year ago at NDC London. At the time the features were announced with a number of disclaimers that they may not actually ship. I think in future it may be better for everyone to take those disclaimers with more than just a pinch of salt.


Tags:
Categories: C# | F# | .Net
Actions: E-mail | Permalink | Comments (2) | Comment RSSRSS comment feed

One Week in F#

September 28, 2014 12:30 by phil

With Sergey Tihon on vacation this week, I’ve collated a one off alternative F# Weekly roundup, covering some of the highlights from another busy week in the F# community.

News in brief

FSharp Logo

Events

This week has seen meetups in Nashville, Raleigh, Portland, Washington DC, Stockholm and London:



Recordings

Upcoming meetups

Upcoming Conferences

Projects

Blogs

FsiBot



Have a great week!


Tags:
Categories: F# | .Net | Mono
Actions: E-mail | Permalink | Comments (0) | Comment RSSRSS comment feed