Tag: Learn to code

  • Procs, lambdas, and performance

    The author explores the performance of blocks, procs, and lambdas in Ruby through benchmarking. Initial tests showed blocks to be slower due to method call overhead. After refining the approach, benchmarks indicated that while blocks improved, procs and lambdas remained consistently faster, highlighting the importance of method usage in performance.

  • Classes in C#

    The content discusses creating a simple class “Person” in Ruby and C#. In Ruby, it utilizes attr_reader, initializing attributes and defining a method to display information. In C#, it requires defining public properties, using “get” and “set,” and employs Console.WriteLine for output. The implementation demonstrates language-specific differences succinctly.

  • Dynamic vs Static

    The author contrasts C# and Ruby, highlighting C# as a static, compiled language and Ruby as dynamic and interpreted. C# requires variable types to be declared at compile time, catching errors early, while Ruby allows runtime type changes, leading to potential runtime errors. Each language suits different needs: Ruby for speed in small tasks, C#…

  • C# and Ruby

    I’m thinking that the next few posts are going to focus on the similarities between C# and Ruby, as I work through my notes from being onboarded into a project using C# and .NET. One of the main differences is that C# is a ‘statically typed’ language. It requires explicit declarations, and everything is checked…