Is anyone else interested in earning the Reader badge?

C# follow the same philosophy as Java though the evolve in separate ways.

You had I think Option<T> or Optional<T> way before Nullable<T> was introduced in C#. I do not know if this is exactly the same but I remember Java 14 introduced switch statements the way I like with conditions before we had pattern matching. There is certainly stuff C# has Java has not but that’s not important. There are pros and cons to every product. I stopped following Java stuff when I got trained in C# by 2019/2020. Java is cool but I love C# more. I was pretty much confused with the conventions for quite some time when I started because I was used to camelCase and to date I still easier think JVM and byte code instead of CLR and CIL.

Yeah, I am pretty good at this point in my career at figuring out the main principles. Mosh also has a clean coding style that I really enjoy - I like seeing him refactor as he goes trying to make the code more readable.

2 Likes

It is getting so close I can taste it. :yum:

3 Likes

I am trying to remember, is it C#, C++ or both that allow multiple inheritance? That was one of the things I found really tricky looking into those languages since it was much harder to reason about.

1 Like

Agree:

  • He gives useful shortcuts for VSCode I didn’t know either (the f2 to replace variables in an efficient way, the alt or alt+shift to duplicate or move lines of code)
  • His code formatting follows certain coding rules and he follows them throughout the whole course, giving a line to follow to have clean code too

Both making the coding experience enjoyable and clear.

So true. Actually, I get a little disappointed when I see him using a different editor in some of the courses since I always use VSCode at this point.

I think everyone picks up a certain style over time and I do like Mosh’s. At my company, we follow the Google Style Guides to the letter so I am pretty used to seeing a particular style in the code I read and write.

One thing I have never seen Mosh mention is formatting tools because it is soo much easier to just trust a formatter rather than having to think about where to put line breaks, etc. For Java there’s a nice google-java-format one that VSCode has an extension for using. The most bizarre part to get used to is The Rectangle Rule, but I actually prefer it now that I have been using it for so long.

3 Likes

C /C++ allow multiple inheritance. It allows the infamous diamond of death problem which Java tried to solve.
C# just like Java allows one inheritance and as many implementation as desired.

public class MyClass extends MyBaseClass implements AnInterface, AnotherInterface

would become

public class MyClass : MyBaseClass, IAnInterface, IAnotherInterface in C#

C/C++ I do not remember. Last time I did that was like about 2008. =3

Sounds right to me. Thanks for verifying! I suppose one of these days I’ll take a shot at learning C#. Maybe using Mosh’s courses.

2 Likes

Yeah. C# is cool.
I love properties. I don’t know if Java introduced that since Java 9+. I love this syntactic sugar very much (basically a short way to create getters and setters).

In C# instead of

public int getField(){ return _field;}
public void setField(int newValue){ _field = newValue;}

you’d rather see

public int Field { get; set; }

Upon compile it creates the corresponding getters and setters for you.
You can of course implement those if needs be but if not needed the above suffice.

private int _field;
public int Field
{
	get => _field;
	
	set
	{
		if (value > 0 || value < 100) _field = value;
		else throw new ProvideMeWithValidInputYouMuppetException("Seriously?");
	}
}

In client code

// Java
int result = myInstance.getField();
myInstance.setField(anInt);

// C#
int result = myInstance.Field;
myInstance.Field = anInt;

I love object and string being possibly written in lower case and appearing in the same color as int or double. Something that annoyed me a bit (at least for String) in Java but I had to deal with.
I love curly brackets opening on a new line instead of on the same line like Java or JS (but I’m fine with that too).
I love extension methods, indexers, LINQ and all that fun stuff.
And having watched a part of dotNetConf this week.
I love the .NET ecosystem and the techs that are going to come. Should it be .NET MAUI, Blazor Hybrid, the novelties to come with C#11 showcased by Mads Kristensen and other presenters.

But both C# and Java and close and very much used.

10 to go from there!

It feels to me like either Java will decrease and Kotlin will increase or else Java will constantly be battling for feature parity with Kotlin.

I do not know of any syntactic sugar for Java getters and setters (at least as of Java 17).

9 to go…

2 Likes

Is it too exaggerated to just count down at this point?

8 to go…

2 Likes

7 to go and this is like 20 chars long.

I guess this is what happens when you are really setup to gamify things.

It is intriguing to see how gamification has become much more popular these days. Even workplaces are starting to see the value in gamification. Turns out people generally like playing games. Small victories help make onerous tasks feel less onerous.

6 to go…

2 Likes

True. It is helping much with depression.
5 to go…

To throw one more monkey wrench in for discussion, I am curious what others feel about exclusive badges. For example, there is a “new user of the month” badge on this forum. Two new users are selected each month to receive this badge. If you are a long-time user, it is impossible for you to achieve this badge. On the one hand, I always like possessing an exclusive badge. On the other hand, I have been frustrated by the impossibility of earning an exclusive badge I am locked out of.

Since it is all “just for fun” I think the exclusive badges are alright, even if they can feel bad sometimes.

2 Likes

I certainly hope your work life is not too depressing. If it is, at least there are forums like this where you can find some sense of community to commiserate and lift each other up.

3 to go…

2 Likes

The famous “baby steps” as Mosh would had told.
2 to go…

While the term “baby steps” can feel like it is putting down beginners, we all started out life as babies. It is just the way the circle of life rolls. If we did not take “baby steps” we would never walk or run in the future. So I am all in for “baby steps” when learning new things.

2 Likes

HAPPY NEW YEAR !

YAAAAAAAAY !

\ (^o^) /

2 Likes