News for hackers. Stuff that matters.
Re:Welcome to C# 9.0 by _-david-_ on Wednesday May 20, 2020 @04:07PM (#23251157)
My understanding is that the dotnet runtime and powershell are both decent codebases.

https://github.com/dotnet/runtime

https://github.com/PowerShell/PowerShell

Re:Welcome to C# 9.0 by jeffdavis on Wednesday May 20, 2020 @04:59PM (#23251729)
Looking at a random file in Powershell, the first thing I see is:

    private string _typeName;
    /// <summary>
    /// Add new type name to the specified object for TypeNameSet.
    /// </summary>
    [Parameter(Mandatory = true, ParameterSetName = "TypeNameSet")]
    [Parameter(ParameterSetName = "MemberSet")]
    [Parameter(ParameterSetName = NotePropertySingleMemberSet)]
    [Parameter(ParameterSetName = NotePropertyMultiMemberSet)]
    [ValidateNotNullOrEmpty]
    public string TypeName
    {
        set { _typeName = value; }
        get { return _typeName; }
    }
-- https://github.com/PowerShell/PowerShell/blob/15c2245af97486...

Honestly it seems like just a lot of code and very little meaning. I can't help but think that there's a better way of expressing the solution.

I could have picked the wrong file, but I was poking around in lots of directories before I found any significant C# code at all. It seems like there's a whole 'nother level of boilerplate in the directory structure.

Re:Welcome to C# 9.0 by joshschreuder on Wednesday May 20, 2020 @06:14PM (#23252592)
Looking at object getter/setters in any OOP is likely to be pretty uninspiring :)

There's no logic there, this is basically just boilerplate for some other code to set properties on an object. Something that actually has some business logic will be much more interesting to read, eg.

https://github.com/PowerShell/PowerShell/blob/15c2245af97486...

Re:Welcome to C# 9.0 by jeffdavis on Wednesday May 20, 2020 @07:59PM (#23253442)
Yeah, clearly there's some code somewhere that does something. I just don't understand why there are so many files and so much code that does nothing and means nothing.

I'm fine with verbosity. I'm fine with lots of data type declarations, annotations, things that make the compiler happy, etc.

But a file full of getters and setters? I can put up with it, but I don't understand why.

Re:Welcome to C# 9.0 by oaiey on Thursday May 21, 2020 @02:33AM (#23255458)
Powershell is itself a language, a kind of ide (consider completion/help/etc). It is not a representive code base. The .NET runtime either. Its pure scale is beyond beauty.
Re:Welcome to C# 9.0 by contextfree on Thursday May 21, 2020 @12:57AM (#23254927)
since c# 3 (2008) this would normally be expressed as

public string TypeName { get; set; }

not sure why it's not here, could just be older code. The [Parameter] etc stuff is all powershell-specific metadata that defines how to use it from the powershell language.

Re:Welcome to C# 9.0 by jeffdavis on Thursday May 21, 2020 @02:18AM (#23255381)
Thank you. That's why I asked for modern c#.

It would be nice to see if some other codebases managed to free themselves from some of this cruft and make something more approachable.

Re:Welcome to C# 9.0 by LandR on Wednesday May 20, 2020 @05:21PM (#23251942)
Most C# is boilerplate code!