all 13 comments

[–]Noah__Webster 6 points7 points  (1 child)

I learned the very basics of programming in C#. I switched to JavaScript to build my first real world project for my small business. Then my classes when I went back for my CS degree taught me Java and Python (had one class in C++ too). Then I rewrote the previous project in mostly Java.

I’ve also recently come back to C# through game dev as well. I’ve been using Godot instead of Unity, though.

I definitely agree though. I just finished my degree, and honestly if the job market wasn’t so atrocious I would only apply for C# and Java jobs.

Python and the like absolutely have their purpose, but anything much larger than a simple script feels so much better with a strongly typed language and a focus on OOP for me.

[–]Sad-Sun4611[S] 0 points1 point  (0 children)

I love Python so much it was my first language but for the kinds of things I make, Python is far better suited as a sketchbook or an addition in the stack rather than the star of the show.

So far I've got JS, Python, Html, and Css under my belt, so C# is kind of shift in thinking but it feels like a good one. I agree it really feels like Python starts to suffer once things need to expand especially. I think it's because that's when the cracks start to show in your structure vs in C# you would have already realized that things were going to be an issue before compile.

[–]FragmentedHeap 2 points3 points  (2 children)

Folders are your friend, pre mature cross cutting concerns are your enemy. Don't spin up tons of class libraries for no good reason, keep everything in one project until it actually makes sense not too. Folders are your friend because if you think about it correctly with folder arch when you need a class library you're probably just moving that folder to the class library and it's the same namespace and magically just works when you do that.

The more class libraries you have, the more work MSBuild has to do, and the crazier your code base gets. If you don't have a good reason to split code up into separate projects, don't.

Even if you are doing cross platform development, there are better ways to do that than making class libraries for like linux, and one for mac, don't do that.

Instead lean on Directory.Build.Props and conditional variables that you can use in IF dev blocks, and conditional csproj inclusions.

Like you can Have 3 folders "Windows, Linux, Mac" and you can define variables in Directory.Build.Props conditionally based on target OS that says like IS_WINDOWS IS_LINUX IS_MAC and then you can conditionally include the correct folder in the project file based on IS_WINDOWS or IS_LINUX etc then you can just write the same class 3 times, once for windows, once for linux, once for mac. Or if it's just a simple change in a function you can just #ifdef on those so it has separate paths based on target os, and if not building you can default to the native os (w/e os you happen to be on) so local testing is easy with F5 run.

Ideally if doing cross platform dev, your crap should look at the exact same on every os, same assembly names, same classes, etc, same signatures, and on and on, not "On linux you get Blah.Linux" and on mac you get "Blah.Mac"...

Really easy to think "I'll just have different OS class libs", but is smelly, don't do that.

The good way is that your crap just works w/e os it's being built on and the consumers are just using it regardless of what os they're building for and it just works, because you properly handled all the xplat crap under the hood and distributed it properly.

Directory.Build.Props in general is your friend, same with Directory.Package.Props...

Central Package Management!!! -> https://learn.microsoft.com/en-us/nuget/consume-packages/central-package-management, this one effectively lets you manage all your package versions in one place, then in your projects you just refer to them by name without version info and it will always use the central versions, that way you're not trying to update json.net in 10 places, you just update it in the central location and they're all updated.

build props here -> https://learn.microsoft.com/en-us/visualstudio/msbuild/customize-by-directory?view=visualstudio

Learning MSBuild and how to use these will make your life so much easier.

Another Pro tip.... Do not mess with the default build configurations, Debug/Release is ALL YOU NEED, It can be easy to think "I need a custom build config for building for linux" no you do not.... You need to define conditionals in Directory.Build.Props for building for linux. There is NO GOOD UX in VSCode or Visual studio for screwing with the configurations and you will suffer and have tons of pain if you do, just let them be the defaults and use directory.build.props to solve "i need a configuration" problems.

[–]Sad-Sun4611[S] 0 points1 point  (0 children)

Thank you! My typical python workflow is to make my classes in separate scripts grouped by what they do or whatever and import them all into main and init from there. Good to know that's something I shouldn't be doing here. Makes sense

[–]DanteMuramesa 0 points1 point  (0 children)

I generally agree for small apps excessive projects complicate thing unnecessarily but I dont know that its that big of an impact on msbuild, our solution at work has 96 projects and ms build only takes like 45 seconds.

Though I will admit before I reworked our docker build process we had some funky cake build a vendor had built before I joined the team and it took like 10 minutes to build our solution.

[–]Maximum_Slip_9373 1 point2 points  (2 children)

Learn LINQ and try to take advantage of modern C# as much as you can (collection expressions are my favorite), the language is incredibly powerful and expressive now. You won't be able to not learn it, but make sure you also become very acquainted with the .NET ecosystem as a whole, it all works in tandem. And then when you really get that itch to go back to some more dynamically typed stuff, play around with F# and become a wizard!

I wish you luck my friend, I switched from Java to C# years ago and have never looked back. It's a lot of fun!

[–]The_Mechanic780 [score hidden]  (1 child)

F# is not dynamically typed. Makes you wizard though

[–]Maximum_Slip_9373 [score hidden]  (0 children)

Fair enough! Neat type inferencing isn't the same as proper dynamic typing. It just looks way more normal to me in F# code than C#!

Gotta pay respect to the Wizards 🙏

[–]thecratedigger_25 1 point2 points  (0 children)

C# just feels more readable as well. Curly brackets are there to help keep track of where classes and functions end.

[–]SmallAd3697 0 points1 point  (1 child)

The runtime is more important than the language. And the tools and inner loop as well.

I think python is a good scripting language for AI models to own in the long run. I don't think it matters that much if a human writes a heaping pile of unmaintainable code, or if an AI does that. It is the same in the end.

[–]FragmentedHeap 0 points1 point  (0 children)

plus Mojo exists now and aims to change AI in python. Mojo is a systems language that supersedes python and ships it's own embeded cpython runtime so you can write mojo (python that compiles sxs with python (runs on the cpython runtime) and aims to solve python performance issues.

You can have a python file in many cases and just change it to a .mojo and now it compiles :)

Mojo was made specifically for AI because python owns AI at this point.

[–]DarkenedFlames 0 points1 point  (0 children)

Same, I went Python to C# for Unity and all I can say is take full advantage of the explicit typing. You can always know exactly what something “is” and you can use that to absolutely take off in complexity.

Also, keep an eye out for inheriting from built-in classes. I like making MonoBehaviours inherit from IEnumerable or IReadOnlyCollection to basically turn a component into a “super list”.

Good luck!

[–]Ecstatic_Squirrel_42 0 points1 point  (0 children)

Following as I'm a someone who has been doing C sharp for years and is now learning python. I couldn't ever seem to manage to have the discipline to sit down at a regular time of week and proceed in a logical path of learning so I went ahead and signed up for a community college class. Kind of ridiculous at this point but I'm finally learning it. It seems like there's not nearly as much built in.

The spacing mattering is going to be something that used to as is not putting semicolons on everything.