Learning programming languages *split*

Discussion in 'General Discussion' started by tuna, Nov 25, 2016.

  1. Rodéric

    Rodéric a.k.a. Ingenu
    Moderator Veteran

    Joined:
    Feb 6, 2002
    Messages:
    3,954
    Likes Received:
    811
    Location:
    Planet Earth.
    It is for the few algorithms I implemented (such as encryption & hashing), I could call C from C# but that'd be cheating.
     
  2. BRiT

    BRiT (╯°□°)╯
    Moderator Legend Alpha Subscriber

    Joined:
    Feb 7, 2002
    Messages:
    11,054
    Likes Received:
    6,733
    Location:
    Cleveland
    Did you use the built in items from the C# Cryptography Libs or roll your own?
     
  3. Cyan

    Cyan orange
    Legend Veteran

    Joined:
    Apr 24, 2007
    Messages:
    8,129
    Likes Received:
    1,942
    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.

    [​IMG]
    [​IMG]



    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.

    [​IMG]
    [​IMG]
    [​IMG]
    [​IMG]
     
  4. Cyan

    Cyan orange
    Legend Veteran

    Joined:
    Apr 24, 2007
    Messages:
    8,129
    Likes Received:
    1,942
    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.

     
  5. Arwin

    Arwin Now Officially a Top 10 Poster
    Moderator Legend

    Joined:
    May 17, 2006
    Messages:
    17,599
    Likes Received:
    1,148
    Location:
    Maastricht, The Netherlands
    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.
     
    Cyan likes this.
  6. Cyan

    Cyan orange
    Legend Veteran

    Joined:
    Apr 24, 2007
    Messages:
    8,129
    Likes Received:
    1,942
    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.
     
  7. Cyan

    Cyan orange
    Legend Veteran

    Joined:
    Apr 24, 2007
    Messages:
    8,129
    Likes Received:
    1,942
    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/
     
  8. Cyan

    Cyan orange
    Legend Veteran

    Joined:
    Apr 24, 2007
    Messages:
    8,129
    Likes Received:
    1,942
  9. Cyan

    Cyan orange
    Legend Veteran

    Joined:
    Apr 24, 2007
    Messages:
    8,129
    Likes Received:
    1,942
    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
     
    #169 Cyan, Nov 16, 2017
    Last edited: Nov 16, 2017
  10. Cyan

    Cyan orange
    Legend Veteran

    Joined:
    Apr 24, 2007
    Messages:
    8,129
    Likes Received:
    1,942
  11. MfA

    MfA
    Legend

    Joined:
    Feb 6, 2002
    Messages:
    6,469
    Likes Received:
    349
    Async doesn't help, it obfuscates the way code is executed. Execution being inherently synchronous ... also imperative.
     
  12. Arwin

    Arwin Now Officially a Top 10 Poster
    Moderator Legend

    Joined:
    May 17, 2006
    Messages:
    17,599
    Likes Received:
    1,148
    Location:
    Maastricht, The Netherlands
    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.
     
    BRiT likes this.
  13. MfA

    MfA
    Legend

    Joined:
    Feb 6, 2002
    Messages:
    6,469
    Likes Received:
    349
    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
     
    #173 MfA, Nov 18, 2017
    Last edited: Nov 18, 2017
  14. Cyan

    Cyan orange
    Legend Veteran

    Joined:
    Apr 24, 2007
    Messages:
    8,129
    Likes Received:
    1,942
    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
     
  15. Cyan

    Cyan orange
    Legend Veteran

    Joined:
    Apr 24, 2007
    Messages:
    8,129
    Likes Received:
    1,942
    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.
     
    #175 Cyan, Nov 19, 2017
    Last edited: Nov 19, 2017
  16. Cyan

    Cyan orange
    Legend Veteran

    Joined:
    Apr 24, 2007
    Messages:
    8,129
    Likes Received:
    1,942
  17. Cyan

    Cyan orange
    Legend Veteran

    Joined:
    Apr 24, 2007
    Messages:
    8,129
    Likes Received:
    1,942
  18. Orion

    Regular Newcomer

    Joined:
    Feb 18, 2013
    Messages:
    339
    Likes Received:
    47
    What about the IL2CPP does that help significantly with performance, at least as relates to unity?
     
  19. Cyan

    Cyan orange
    Legend Veteran

    Joined:
    Apr 24, 2007
    Messages:
    8,129
    Likes Received:
    1,942
  20. Scott_Arm

    Legend

    Joined:
    Jun 16, 2004
    Messages:
    13,021
    Likes Received:
    3,281
    Cyan likes this.
Loading...

Share This Page

  • About Us

    Beyond3D has been around for over a decade and prides itself on being the best place on the web for in-depth, technically-driven discussion and analysis of 3D graphics hardware. If you love pixels and transistors, you've come to the right place!

    Beyond3D is proudly published by GPU Tools Ltd.
Loading...