
The future of C# and Visual Basic [video] - nstart
http://channel9.msdn.com/Events/TechEd/Europe/2014/DEV-B345
======
untog
Much to the derision many of the developers I know, I still say that C# is the
best language I've ever worked in. But the .NET platform is one of the worst
I've ever worked in. So opening up C# to more platforms sounds very, very good
to my ears.

I only wish Xamarin's products didn't cost so much. With Swift on the scene I
really can't justify spending money to write my side projects in C# instead of
in the environment Apple provides. Or Java for Android, which let's face it,
is already similar to C# anyway.

~~~
V-2
I hope that Microsoft buys Xamarin (I know, I'm evil) and makes it free, or
very reasonably priced.

~~~
rl3
If by some miracle Visual Studio ever ran on non-Windows platforms, Microsoft
would then be free to kill off Xamarin Studio.

And as long as we're being evil, I wouldn't mind seeing Microsoft buy up Light
Table (if that's even possible) and build some of its features into Visual
Studio. Namely inline eval and live code modification.

~~~
rjbwork
Both of which it has have via Roslyn/Edit and Continue.

~~~
ijk
Interesting. I knew VS had been working toward features like that; I wasn't
aware they'd come as far as they have. Though from my poking around there
appear to be some limitations: no redefining lambdas in a live session, for
example. And I'm pretty sure that Instaparse is still out of reach, though
that's not really what was being referred to. But thank you for reminding me,
it's been a while since I've had an occasion to touch VS.

------
thescrewdriver
C# seems to look more like Scala with every release (a good thing), with talk
of primary constructors for C# and string interpolation etc.

EDIT: Interesting to see Neal Gafter is involved (See Roslyn mention here:
[http://www.gafter.com/~neal/](http://www.gafter.com/~neal/)), who is rather
fond of Scala from what I've read: [http://www.infoq.com/articles/neal-gafter-
on-java](http://www.infoq.com/articles/neal-gafter-on-java)

~~~
runT1ME
>C# seems to look more like Scala with every release

It does, but then that begs the question of "why use c# at all?". C# is still
missing (along with F#) scala's most powerful features, and I prefer the JVM
and openness of the ecosystem to .NET

The contact I'm on, we're having a lot of success porting away a _large_ C#
application to Scala.

~~~
jbergens
You also get a step-wise path to rewrite the applications. Going to Scala
would probably be a complete re-write which is risky and time consuming. I
don't think Scala usage will grow much more now that Java 8 is released. The
benefits of rewriting a Java application to Scala is probably not that great
in comparison to the cost. And the C# to Scala re-write is probably even worse
from a cost/risk perspective.

~~~
frowaway001
Well, obviously other people did the math and went ahead with it.

> I don't think Scala usage will grow much more now that Java 8 is released.

I don't get that reasoning. As the GP mentioned, even C# projects migrate, so
why would Java's more concise anonymous inner classes be a show-stopper?

------
cowabunga
I wish there was a tl;dr version as its quite hard to find the time and
motivation to sit there and watch something like this for over an hour.

~~~
beobab
There are slides, which give you a quick synopsis (look under the video)

~~~
cowabunga
Thank you - completely missed them :)

------
sremani
TL;DR (slides)
[https://view.officeapps.live.com/op/view.aspx?src=http%3a%2f...](https://view.officeapps.live.com/op/view.aspx?src=http%3a%2f%2fvideo.ch9.ms%2fsessions%2fteched%2feu%2f2014%2fDEV-B345.pptx)

------
samirahmed
Although most of the language features have been discussed before. I am
excited for null propogation as well as string interpolation. These are will
improve the signal to noise ratio and allow for easier to read and write code.

From my experience with C# null checking before method calling or indexing is
such a pain and the coffeescript like null propagation is a much needed
feature.

------
Someone1234
They're releasing it under the Apache licence 2? Impressive. That definitely
seems like something the Mono project could just utilise directly without any
licence concerns.

~~~
tagrun
Xamarin is selling licenses to proprietary gamedevs for quite a while now.
That may put a dent in their business.

~~~
jmcqk6
The mono compiler (that Xamarin uses, and would presumably be replaced by the
Roslyn compiler), is released under GPL and MIT X11 licenses
([https://github.com/mono/mono/blob/master/LICENSE](https://github.com/mono/mono/blob/master/LICENSE))

I don't think this will have any effect on Xamarin licenses at all.

------
bithush
I don't see why Microsoft still put resources into Visual Basic.

C++/C#/F#/MSSQL/PowerShell is all they really need to concentrate on.

~~~
mcfunley
There are legions of VB programmers out there, you just don't hear from them.
The ones I worked with a decade ago were not the types to wind up on HN, to
read programming blogs, or to engage with the wider programming community.
They were only really interested in programming to the extent that they used
it to do a job (they were "Morts" [1]).

Mind you I don't think there's anything wrong with that as an attitude.
Anyway, Microsoft puts resources into it because they probably have zillions
of paying customers using it.

[1]
[https://web.archive.org/web/20080218051638/http://www.nikhil...](https://web.archive.org/web/20080218051638/http://www.nikhilk.net/Personas.aspx)

~~~
orionblastar
I am still a Classic Visual BASIC (VB 6.0) programmer.

Microsoft made it so VB 6.0 needed the Microsoft Java Runtime to install and
it works with Windows 95 to XP, but in Vista and above it has problems
installing. There are ways you can trick it to install but in the long run it
is not worth it as it causes OS instability.

I got an XP Pro Virtual Machine in Virtualbox that I develop VB 6.0 apps
inside of. GIT only works with XP and up, so Windows 2000 and under are out of
the question. (Something about IPV6 support in the Git app and the first
Windows to support that was XP so it fails in earlier Windows) So if you want
to do legacy Windows programming and use Git, XP is your best choice. Visual
Sourcesafe never seemed to work properly and I always had coworkers and
management get in and scramble the files by accessing them directly on the NT
Server or whatever and load them in MS-Word or MS-Frontpage that changed the
formatting and then they saved bypassing source control. At least in Visual
Sourcesafe 6 this was true, and I believe that Git is much better.

Since 1983 I have learned over 37 different programming languages on many
different platforms. I only did Visual BASIC programming from 1995-2002
because in my area the IT shops were Microsoft shops and management decided to
use Visual BASIC. While I knew Non-Microsoft languages, management never
wanted me to use them.

I ended up on disability in 2003, and by that time Visual BASIC evolved into
VB.Net influenced by Java and took a turn for the worse. Then Visual C# got
used because it is more like Java than VB.Net is, and the high schools and
colleges teach C# and Java so these new programmers learn it.

In high school I learned Pascal, in college I learned Pre-ANSI C, COBOL,
FORTRAN, Ada, X86 Assembly, and others.\

Around 1995 I was learning Java and JavaScript. Then later Python and a few
others. But on my spare time at home, because my managers didn't want me to
use them.

I just recently took a Ruby on Rails MOOC and passed it with 100% on each
programming assignment. I used to do VBScript ASP 3.0 programming. ASP.Net
changed all of that apparently.

So yes I am one of the legions of VB programmers out there, got forced into
disability, too old to work in my 40s (They only want young people), and read
Hacker News because my interests are scattered all over the place in learning
stuff.

The die hard Visual BASIC only programmers were the ones I had a coworkers who
I had to hand-hold and teach Visual BASIC to them. Most earned university
degrees but had no idea how to program. They secret handshaked their way to a
job, while I had to pass tests and show code. I super debugged their code, and
their code was sloppy and crashed systems and servers. They moved on without
me into the Dotnet era and Visual C# and stick to Microsoft websites for their
news using Bing as a search engine. They find me on social networks and ask me
to apply for my old job so I could help them, but I cannot go back, I can only
go forward. Work on my side-projects and do it as a hobby until I can get off
disability one day.

------
jgill
I second that that C# and the .NET platform are a joy to work with. If you've
never given them a shot, you may be pleasantly surprised.

------
math
This is all very nice, but what would make me truly excited is if they
released their runtime for linux ... yeah, it's just a dream. would be a lot
of work I expect and they wouldn't want to even if it was easy.

~~~
untog
Well, Mono exists. At this point porting to Linux would just be duplicating a
large amount of Mono.

~~~
math
Yes, I use it extensively and it's good. But the Microsoft runtime is awesome.
Much faster and very stable. I do a lot of number crunching (distributed on a
small cluster) and don't want to use Windows in this scenario for various
reasons. Mono is good enough that I choose to compromise, but MS runtime on
linux would be a dream come true.

------
tkinom
I had use VC and VB a long time (15+ years) ago and have since moved to Linux
+ gcc, python, golang, mobile etc.

After watching this video for 20 minutes of all the fancy GUI details, I have
couple of higher level questions:

    
    
       1) Do C#/VB still only build for Windows, Win Mobile? 
          Can they build targets for IOS, Android, Linux? 
          I heard the new CEO of MSFT suppose to be more supportive of cross platforms.   
    
    
       2) I began to like the concurrency model in golang a lot.   
         Does the C#, VB support that kind of concurrency in their language design?

~~~
Sir_Cmpwn
1 - Mono still works well and Rosyln compiles and runs in Mono.

2 - Not at a syntax level, but there is good concurrency support in the .NET
stack.

~~~
mariusmg
"Concurrency" at syntax level is kind of dumb anyway.

~~~
tkinom
The way golang works seems to be follow the model of Unix pipe (stdio pipe)
between process. They are simple channel between go-routines (kind of) light
weight threads.

The concept is built into the language itself.

Anything wrong with that?

~~~
mariusmg
Yeah. Goroutines not backed by real threads (afaik there's also gorountine ->
os thread), those "green" threads from Ruby and fibers are just ugly hacks.

Sorry but from my point of view, "real" concurrency is done at the OS level.
The OS schedules threads to the CPU depending on their priority and "other"
things. Having a single OS thread and runtime code that "yields" so another
piece of code can run in the same thread, that's not concurrency...that's a
toy.

Sorry for being so blunt.....but that's my opinion.

~~~
pritambaral
Switching goroutines is much lighter than switching OS threads. When this
"toy" and "hack" becomes as heavy or slow and thus no more useful than OS
threads, then you can make a point. As I see it, you aren't making a point
right now, just explaining what OS threads do and calling goroutines names. So
let me point in the direction of an explanation of what goroutines do:
[http://www.cs.columbia.edu/~aho/cs6998/reports/12-12-11_Desh...](http://www.cs.columbia.edu/~aho/cs6998/reports/12-12-11_DeshpandeSponslerWeiss_GO.pdf)

------
malkia
Here is a recent C#/.NET experience that I had: Some of my time is spent
profiling/sampling/optimizing the pipeline at work. I decided to take a stab
at a C#/.NET tool that is executed quite a lot throughout the day, only to
find out some unexpected things - all variables in a functions would be
initialized to defaults (used or not, covered or not)... So splitting large
functions into smaller would (actually) help in this case for sure:

[https://gist.github.com/malkia/ebf7f54063c5aec6d1b0](https://gist.github.com/malkia/ebf7f54063c5aec6d1b0)

Some answers from Eric Lippert about it (declaration spaces)
[http://blogs.msdn.com/b/ericlippert/archive/tags/declaration...](http://blogs.msdn.com/b/ericlippert/archive/tags/declaration+spaces/)

And this stackoverflow: [http://stackoverflow.com/questions/2976628/question-
on-c-sha...](http://stackoverflow.com/questions/2976628/question-on-c-sharp-
variable-scope-vs-other-languages)

It's not something I've seen in other languages/vm's. And seems like "ngen
install" with some attributes would help it:

    
    
      [MethodImpl(MethodImplOptions.AggressiveInlining)] 
      static int func1(int flag)
    

But I'm no longer able to think of C# as closer (not close) to the metal,
because of this exactly. It'll affect me how I look at it and code in it.

------
orionblastar
The main problem is the GUI Windows Forms that Visual Studio uses that they
won't allow for use on other operating systems other than Windows.

If they included libraries that could compile the Windows GUI Forms to other
operating systems like GNU/Linux, *BSD Unix, iOS, Android, Mac OSX ect it
would be used more for those platforms.

Instead you have an incompatibility and it prevents developers on Non-Windows
platforms to take it seriously. How can you claim it is cross platform when
the GUI parts won't even compile?

Visual BASIC 6.0 was the last version of Visual BASIC that didn't stink and
add in a bunch of Java features. I consider it Classic Visual BASIC for
version 6.0 and under.

This Visual BASIC is really VB.Net and not Classic Visual BASIC. I'd much
rather use the BASIC based Jabaco
[http://www.jabaco.org/](http://www.jabaco.org/) to make Java Bytecode JAR
files than use VB.Net to make binaries. At least the Java JAR files are cross
platform better than VB.Net and C#.

~~~
dragonbonheur
There is another BASIC that compiles to Java and is more actively developed
than Jabaco :B4J
[http://www.basic4ppc.com/android/b4j.html](http://www.basic4ppc.com/android/b4j.html)

Also for cross-platform development there are even dialects that compile to
HTML+JS:
[http://pewtersoftware.com/browserbasic/](http://pewtersoftware.com/browserbasic/)

And other platforms: [http://www.monkey-x.com](http://www.monkey-x.com)

~~~
orionblastar
Thank you I'll look into them.

Monkey-X looks like Blitz BASIC rather than Visual BASIC. But I like the fact
that it can go cross platform.

------
andrea_s
What's the use case for a getter-only auto property? I can't imagine how that
would work, does someone have any insight?

edit: is it "same as a public readonly field, but it's a property"?

~~~
brandonbloom
Yeah, it must be initialized in the constructor.

Similar to the JVM, the CLR can offer binary compatibility of libraries, which
is something Microsoft cares a great deal about. Changing a public readonly
field in to a public readonly property is source-compatible, but not binary-
compatible. That's why properties are generally preferred, even when you don't
strictly need one. The language was actively discouraging either immutability
or binary-compatibility by making it more verbose to get a trivial readonly
property.

~~~
andrea_s
Ah, that's the catch, it makes sense now.

------
bhouston
C# is neat and I used it as my primary language for a good 6 years from 1999
to 2005, and then a little bit since they -- maintaining legacy projects. But
a platform specific language it isn't the future in my opinion, it is just too
limiting. Python, JavaScript and other types of cross platform languages, even
if slower and sometimes more annoying to debug, is where the money and the
future is.

~~~
Someone1234
JavaScript, yes. Python? Python isn't particularly popular and there aren't
many Python jobs around. It also isn't a particularly popular language on any
platform but Linux (so while technically cross platform, if few use it on
other platforms is that relevant?).

If you've been ignoring other languages to concentrate on Python of all things
in the last few years then you have missed the gravy train. Object C, Java,
and C are the most popular, and both Java and C are cross-platform (and better
still actually used cross-platform unlike Python).

As an aside I see significantly more Java, PHP, and C# jobs than any other
language (mostly for web-apps). Then after those I see pure mobile development
(Java-Android, and Object C).

~~~
dagw
_Python isn 't particularly popular and there aren't many Python jobs around._

Where have you been looking? Maybe if you only focus on pure web-dev, but I
see Python and Python jobs everywhere. But I will concede that many of those
jobs are science, engineering or analysis jobs that primarily involved
programming python, rather than pure programming jobs.

 _It also isn 't a particularly popular language on any platform but Linux_

That is not my experience at all. Of all the cross platform scripting
languages (Perl/Ruby/PHP/Lua/Javascript etc) it is by far the most popular on
Windows, and certainly the best supported. I can probably also name a half
dozen big commercial Windows apps that use Python as its main scripting
language.

~~~
Someone1234
> Where have you been looking?

The normal places you'd find developer jobs. I didn't check the Python forums
or other Python specific job boards.

> Maybe if you only focus on pure web-dev, but I see Python and Python jobs
> everywhere.

That's strange. In what industries? Doing what?

I see C engineering jobs, tons of webapp jobs (PHP, C#, Ruby on Rails, etc),
Java for all the things, VB.net for business desktop applications, and so on.
I cannot think of the last time I ran across a Python job except they're
occasionally listed as a "useful skill" in a SysAdmin job advert.

> Of all the cross platform scripting languages (Perl/Ruby/PHP/Lua/Javascript
> etc) it is by far the most popular on Windows, and certainly the best
> supported.

I see a decent amount of PHP on Windows and it seems to be very well
supported. JavaScript I guess more so but that seems like an odd thing to list
in that context.

~~~
grandsham
> That's strange. In what industries? Doing what?

For one, Python is very big in the GIS space. Python is one of the main
scripting language for ArcGIS, which is the main software platform that GIS
folks use.

------
Too
These additions are all nice but most of them really aren't more than syntax
sugar. What c# really really needs is stricter reference handling of objects,
such as const * const in C. Now when you send an object into a library
function you don't have the slightest idea what the function will do to your
object. Take the simplest case of void Foo(List<string> bar). What will Foo do
with bar? 1. Iterate it once and calculate something based on the contents. 2.
Iterate it once and store references to all strings in the list. 3. Mutate the
list by adding or removing items. 4. Store a reference to the list itself and
modify it two days later from another thread causing a race condition because
you thought you held the only reference to that list.

Case 3 could be excluded by using ienumerable here but in many other cases its
not that simple.

I'm not asking for c++ and manual memory management here, just some kind of
constraints on what a function may do with its arguments. I've seen case 4
cause so many bugs its ridiculous, it doesn't even have to involve multi
threading before it gets nasty.

~~~
stinos
_Now when you send an object into a library function you don 't have the
slightest idea what the function will do to your object_

There are more languages then C# which tend to have these problems, and for
all of them these problems can be avoided in a number of ways merely by
applying the typical good practices and well known design patterns. For
instance just giving your functions proper names (examples 1. GetLongestString
2. StoreReferencesToAllStrings (still hacky, not sure if there are proper
usecases for that?) 3. RemoveDuplicates 4. InstallList or so) and making sure
functions do One Thing only will get you a long way in preventing problems.
Not saying it is easy, but I've been using C# for at least 5 years and don't
really recall problems with it. Did have problems with weak event handlers
disappearing due to gc but after learning it it didn't happen again.

------
orf
Letting NuGet packages inject domain specific tooltips and warnings sounds
awesome.

