Learning programming languages *split*

Sure C# is slower but surely not 10x slower, one thing I'ld like done with C# is ability to disable GC and ability to call it only when I want it called. Still C# is my fav language
It is for the few algorithms I implemented (such as encryption & hashing), I could call C from C# but that'd be cheating.
 
I learnt a LOT from the video below and it's almost perfect for beginners! :smile2: As odd as it might sound, actually one of my favourite things about F# is that you can add comments mid-code, and that's great for a newbie. :D A couple of examples in my own code that I wrote from the guy's speech in the video, about how good is that --i.e. the GPA example.





This is all the code I wrote myself from the video while the guy talked. Took me some extra time, a few hours more, compared to the actual video but I studied typewriting during my 5 years studying administrative so I kinda keep up the pace to an extent.




 
So I got from apress the Beginning F# 4.0 book, and I started studying just now! :) I am listening at this incredible song by one of my fav artists in the world (have a video dedicated to her in my YouTube account) while I start reading the introductory chapers.

Not going to listen to music when getting to the meat of it, but this song, voice and music is so precious, amazing and incredible and inspiring that I can't stop listening to it while reading the easiest, initial parts of the book. Wish me luck.

 
So I got from apress the Beginning F# 4.0 book, and I started studying just now! :) I am listening at this incredible song by one of my fav artists in the world (have a video dedicated to her in my YouTube account) while I start reading the introductory chapers.

Not going to listen to music when getting to the meat of it, but this song, voice and music is so precious, amazing and incredible and inspiring that I can't stop listening to it while reading the easiest, initial parts of the book. Wish me luck.


I like to play and sing that song. I like this version, always a sucker for acoustic and harmonies ...

I’m down with a pneumonia but really looking forward to getting back into coding. Am close to getting a blog ready on design and testing with Moq and Builders in C#, and will maybe try an F# version later.
 
I like to play and sing that song. I like this version, always a sucker for acoustic and harmonies ...

I’m down with a pneumonia but really looking forward to getting back into coding. Am close to getting a blog ready on design and testing with Moq and Builders in C#, and will maybe try an F# version later.
Pneumonia? Wow, take care of yourself and stay safe. You only cure once as they say so take the time you need to fully recover.

Moq and Builders? I had never heard of that. I am practicing OO too, along with functional programming. I completed the C# RPG game like a month ago -nice stuff, however, refactoring the code was a chore, 'cos you could end up with a 20 lines method but I didn't see much gains in terms of summing things up-. I have to learn it so I'll end up learning it and maybe one day I'll start to like it more.

Got his F# book. https://www.amazon.com/Friendly-Fun-game-programming-Book-ebook/dp/B005HHYIWC

The book is cheap but from the little I read, it has not much to show in terms of edition. It is very flat and I am finding it expensive tbh.
 
I've been also working with those platform games. But downloaded the code so I could see if they work... They are from previous versions of F#. So the IDE shows an exception when you try to run them. The solution I found is using the NuGet console and running this command.

install-package FSharp.Core

Additionally, there are other issues with the Monogame version. I had to use the Monogame version 3.4 or 3.2 -can't remember exactly- so SD2.DLL could work. Monogame is on the 3.6 version.

Finally, one of the authors of the Friendly F#, was registered here when promoting the book back in 2011! I found out while searching for the book on the net. Her only and one thread:

https://forum.beyond3d.com/threads/friendly-f-fun-with-game-programming-and-xna.51672/
 
also got these books yesterday with their 2x1 offer:

C# 7 and .NET Core: Modern Cross-Platform Development - Second Edition (launched march 2017)

https://www.packtpub.com/applicatio...ern-cross-platform-development-second-edition

C# 7.1 and .NET Core 2.0 – Modern Cross-Platform Development - Third Edition (still not released, about to be launched this month, more or less the same book but totally updated)

https://www.packtpub.com/applicatio...dern-cross-platform-development-third-edition

And today I got:

Mastering Unity 2017 Game Development with C# - Second Edition

https://www.packtpub.com/web-development/mastering-unity-2017-game-development-c-second-edition

Unity 2017 Game Optimization - Second Edition (book description sounds good, not out yet, to be released this month too)

https://www.packtpub.com/game-development/unity-2017-game-optimization-second-edition

maybe I'll have more programming books tomorrow, as birthday gifts, because it's my birthday, due tomorrow
 
Last edited:
That’s really not true though? A rather obvious example is one that is in Continuous (a really cool IDE on iOS that supports C# and F#), which makes async calls to Bing, Google and Yahoo and shows which one responds when by waiting for results. That’s a clear cut case because it involves several different servers outside your own machine. But your own machine, having multiple cores and threads, can do async processing too, and then there are parts like local file IO, your many core GPU, etc. that are all also async on the hardware level. In all these cases, async can actually release a thread to the thread-pool while waiting for a response, so in that alone it is more efficient. Whereas a synchronous loop waiting for, say, a disk activity to return can (and I’ve seen it happen in practice) take up 100% CPU of the core it is running on if not done with some care.

Async can indeed make code harder to read though, and the C# pattern of async await can be confusing - I’ve seen many people not understand what really happens in that pattern (which is basically create a task for the method with a defined result and basic exception handling, and START that task immediately), causing them unable to call an async method from a non-async method (which really only requires setting up a task manually).

But helpfully, Unit Tests can easily do async too, so I’ve made tests for instance for giving out unique IDs that would start 8 tasks in parallel each requesting new ids for a second and showing that it both happens async and that the end result does not contain new ids, etc.
 
Every non blocking call is a blocking call which automagically resizes queues as needed to unblock itself, that's what I meant with execution being inherently synchronous. Asynchronous messaging hides the queuing necessary to make it work, up to the point it either blows up period or becomes too slow because not thinking about it prevented you from choosing the correct implementation.

Bound checked vs. non bound checked, dynamic typing vs. static typing, GC vs. free, non imperative programming vs imperative, asynchronous messaging vs synchronous, each take you a little farther away from the reality of the execution. Sometimes this is justified, but except for GC and bounds checking I think these should be exception, not rule ... not the default in a general purpose programming language (always room for domain languages of course).

Bounds checking should be the default even in a system programming language. Only something like a properly sandboxed computer game is really suitable for unsafe by default languages like C/C++ ... languages for toys :p
 
Last edited:
Garbage collected languages are crap for games because they are very inefficient when it comes to memory access patterns (which is what usually takes most times in games and HPC-type programs) and are very indeterministic (the GC might run in one frame but not the other). Rust and modern C++ are better for games.
yup, but now that you mention it you can circumvent that, it seems. Does it have anything to do with the unsafe feature of the language? I am not sure but maybe..

I got this book the other day, which is going to be launched sometime this month https://www.packtpub.com/game-development/unity-2017-game-optimization-second-edition

and it looks like there is a way, but I'm not entirely sure how.

Unveil the Mono Framework and the C# Language to implement low-level enhancements that maximize memory usage and avoid garbage collection
 
in addition to that, this software engineer of the language mentions that C# 7.2 is going to include some new features for safe, low level code --after the 8:50 minutes mark.


edit: btw, nice tip about the IDE at the 15 minutes mark.
 
Last edited:
Back
Top