Closed gulshan closed 4 years ago
This repository is specifically about changes to the language specification. Most of your "proposals" don't involve language changes and the others I feel are already covered by other proposals so I don't think that your meta-proposal is particularly necessary.
I think Microsoft can (and should) bundle [.net sdk] with Windows
Which version of the SDK and runtime? A Windows installation can live for many years, but an important feature of the .Net Core SDK is that various versions of it can live side-by-side (and are not interchangeable). So what policy should Windows use to decide which version of the SDK and runtime to install and upgrade?
I think Microsoft can (and should) […] talk to Linux distributions to bundle it
I think one reason why this hasn't happened yet is that .Net Core SDK wasn't buildable from source (it required some binary assets). But fixing that is underway at dotnet/source-build, so I hope .Net Core SDK will start showing up in official repositories of Linux distributions in the near future.
But the process [of running in browser] should more readily available, adopted and highlighted in various ways where appropriate like documentation and tutorials (both first party and third party).
The official docs gained the ability to run code in the browser fairly recently. I expect more and more documentation will be converted to use that approach over time (and you can help by submitting PRs).
When someone is just starting to learn programming, creating a "project", whether visually or through command line
dotnet new
is a hurdle s/he has to overcome. So, it will be helpful for beginners if a single file can be run with a single command. Something likedotnet run file.cs
will be useful.
I think running a single .cs file doesn't make much sense, but running a .csx (C# script) file is a great idea. According to https://github.com/dotnet/cli/issues/2336#issuecomment-259597011, scripting is not going to be part of .Net Core SDK itself.
But .Net Core 2.1 will have better support for tools like filipw/dotnet-script. With that, you should be able to do this:
dotnet install tool -g dotnet-script
dotnet script file.csx
I think that's good enough.
Focus on scripts
I mostly agree, see above.
Programming languages resembling more to human language(English to be specific) is easier to begin with.
I don't think this is a good idea. Even if it made learning the language slightly easier, I think it would still make the language worse overall.
list and dictionary syntax
There are proposals for that: https://github.com/dotnet/csharplang/issues/1238 or https://github.com/dotnet/csharplang/issues/1399.
So, local immutables with
let
will make the life easier for beginners IMO.
Isn't learning two different syntaxes (var
and let
) actually harder? Whether you like it or not, mutable variables are and will be an important part of programming in C#. I think beginners should learn about them, even if good support for immutable variables existed in C#.
@HaloFour
This repository is specifically about changes to the language specification. Most of your "proposals" don't involve language changes and the others I feel are already covered by other proposals so I don't think that your meta-proposal is particularly necessary.
Do you know of a good place where such overarching discussions can take place?
While ensuring that discussion stays on-topic is to some degree necessary (especially when it comes to details about issues that belong to some other repo), I think being too strict about isolating discussions into their respective repos can be harmful to the community.
@svick
Do you know of a good place where such overarching discussions can take place?
Out of the dotnet repos I honestly don't know. They all seem to direct unrelated conversations to the other repos to keep their Issues section on topic. Some direction from MS might be a good idea here.
That said, in this case I don't necessarily think there is an overarching theme. Each of the proposals above are disparate and orthogonal and only loosely bound by the subjective notion that they would make C# easier to learn.
Running in browser: https://try.dot.net/ https://github.com/dotnet/try list and dictionary syntax: https://github.com/dotnet/csharplang/issues/414 https://github.com/dotnet/csharplang/issues/1238
The interesting thing about beginners is they never stay that way for long. One of the following will happen:
It's important to keep the second in mind while trying to avoid the first¹. Features aimed at beginners should only be implemented if they continue to be useful features of non-beginners. Otherwise the whole situation becomes a bait-and-switch, making it much harder to move on from being a beginner.
¹ It's fine to lose interest if programming isn't what you want to do in life, but we want strong retention for programmers interested in solving problems for which C# is a good fit among one or more available options.
Features aimed at beginners should only be implemented if they continue to be useful features of non-beginners.
Agreed. But usefulness is subjective IMO.
@gulshan Here's my initial comments on the original post:
let
. Overall, this is a very big and very important topic. Start here: http://joeduffyblog.com/2016/11/30/15-years-of-concurrency/I agree that C# can be easier for beginners.
Some of the language changes you propose are already available in VB. Why not encourage beginners there?
I have watched several beginners struggle with x = x + 1. However, I think this moment of rethinking is a really important first step. I'd like to make the language around it easier to find (maybe Try.dot.net), but I think it's a speed bump folks need to address.
I wonder if for many programmers the "basic graphics" isn't really "something I can see." Do you think Unity may play a role here? Or just simple WinForms programs that are much simpler than a website?
@KathleenDollard
I have watched several beginners struggle with x = x + 1. However, I think this moment of rethinking is a really important first step. I'd like to make the language around it easier to find (maybe Try.dot.net), but I think it's a speed bump folks need to address.
This reminds me of SharpLab's recently added Explain mode. It takes a piece of C# code, explains all the features used in it and links to their documentation. I think it could be useful for beginners looking at unfamiliar piece of code.
Currently, it doesn't explain the basics like =
, but that's something that could be added.
I have watched several beginners struggle with x = x + 1
Then don't teach them it. Mutating variables in that fashion is counter-intuitive to beginners and hard for even experienced developers to follow in their heads when the code gets more complex. So encourage immutability of variables:
var x2 = x + 1; // problem solved
It depends on what is going on.
You're right that it's sensible to learn assignment (the hard part, that was an equality operator since Kindergarten) separate from mutability.
When the underlying thing is changed, it should mutate. Reusing a variable other than to indicate the inherit mutability of the thing (a loop counter, for example) is not helpful.
I suspect we agree, but lack context due to x's, which is probably a more important thing for beginners - work with something they know or can see - moving things around on screen (Winforms, Unity, etc) is my go to.
@KathleenDollard,
I suspect we agree...
I suspect we do, too. But I tell you what, I'll add your functional C# talk at SDD in a couple of weeks to my list of talks to attend and will let you know afterwards 😀
I look forward to meeting you at SDD! Be sure to track me down.
That talk is definitely not a beginner's talk :)
It's already extremely beginner friendly. The most beginner friendly compared to everything else in my opinion.
agree, need do until
As great as the language C# is, currently I don't see it is being used for introduction to programming that much. Beginning programming with some language increses it's mindshare and markertshare in my opinion. So, I would like to raise some points which I think will make C# more "beginner friendly". Many of these are found from comparison with Python (which is kind of first choice for beginners nowadays'). And while some of them are language issues, some others are about tooling or library. But I'm keeping all of them together here.
Acquisition The first thing one has to do to get start with C# is to install C#/.net sdk. And the easiest acquisition is no acquisition at all. Some languages like python comes bundled with various OSes. It will be most convenient for a beginner if the dotnet sdk comes bundled with various OSes. I think Microsoft can (and should) bundle it with Windows and talk to Linux distributions to bundle it. And then, .net sdk should be officially available from apt, brew, chocolatey and likes for easier distribution/acquisition/update.
Running in browser Another way to get started is running in browser. This is an important option as this also does not require any installation and run on devices with limited development support like iOS/Android devices. Currently there are various third party services and even 1st-party solutions from Microsoft. But the process should more readily available, adopted and highlighted in various ways where appropriate like documentation and tutorials (both first party and third party).
Run single file When someone is just starting to learn programming, creating a "project", whether visually or through command line
dotnet new
is a hurdle s/he has to overcome. So, it will be helpful for beginners if a single file can be run with a single command. Something likedotnet run file.cs
will be useful.Focus on scripts Even more convenient for a beginner to start with scripts instead of code files. In hello world is a one liner and what it does is quite obvious from the code itself. While in a source file, a beginner have to use
using
,class
,static
and other constructs without knowing what they mean just to start. Also with scripts(and convenient configuration), the file itself is executable, which will be easier for a beginner to run. Current scripting support in .net sdk is almost invisible.More textual constructs Programming languages resembling more to human language(English to be specific) is easier to begin with. So,
if not(...)
andwhile not(...)
will be much more easier to understand thanif(!(...))
andwhile(!(...))
. Then again there can be anuntil
loop in place ofwhile not
. Then there can bedo until
likedo while
. There can be aloop{...}
forever loop. And some textual alternative to conditional?:
operator will also be easier to catch. even there can betry when
in the place oftry catch
etc. We can look for some other such constructs.list and dictionary syntax In the beginner level, before learning custom and complex data types, programmers usually learn and use lists and dictionaries. These are the two most fundamental collections types. But in C# using these two types are not very ergonomic for the beginners IMHO. One has to use
new
and generic angle brackets<>
for using lists and dictionaries without much or any idea. So, I would suggest to improvise list dictionary syntax, much like what was done for tuples. Currently(1, "a")
is a tuple and the type is(int, string)
. So simple matching between declaration and type. Same should be done for lists and dictionary-[1, 2, 3]
should be a list of type[int]
and[1:"a", 2:"b"]
is a dictionary of type[int:string]
. Or, curly braces can be used in the place of square brackets-{1, 2, 3}
is a list of type{int}
and so on.Immutability How something like
x = x + 1
is a valid statement is one of the most common questions beginners ask. Immutability make things easier to make sense of. Clear distinction between mutable and immutable variables in syntax helps a lot. So, local immutables withlet
will make the life easier for beginners IMO.Basic graphics and chart/graph library It's very common to use graphics for making programming more interesting for the beginners. So, availability of a cross platform easy to use basic (2D) graphic library in .net/C# will be awesome. So will be a readily available chart/graph library.
Most of these are already proposed. I am just posing them together with a focus on simplicity for the beginners.