Category: Ruby
-
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.
-
99 bottles – go and ruby
For whatever reason, I thought of a practice problem that we did at Turing today of writing something that will print the song “99 Bottles of Beer”. I think it was a reference someone made to redoing flashcards? I don’t know, it’s not important. Anyway, I went looking for it on my computer because I…
-
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…
-
Linked List
I have pretty much covered the linked list, at least for now. I know there is more stuff to add. This was interesting to revisit, and I started at the beginning of mod3 and am finishing it in mod4. Going through this, there are some things I would definitely change, but this is an interesting…
-
Includes & Find
These are the last two methods I’ll probably write about in this linked list series. You know the drill by now, so here are the tests (I’m giving you all of them at once, apologies for the big code block) Alright, so there are quite a few edge cases for find, so we will start…
-
insert into linked list
The post outlines the implementation of an insert method for a Linked List. It emphasizes writing tests to ensure functionality and error handling when inserting elements. The method includes a prepend option for inserting at the start and ensures valid locations by raising errors when necessary. The process culminates in successfully adding new nodes.
-
Prepend – LinkedList
The post discusses implementing a “prepend” method for a linked list, allowing items to be added at the beginning. It begins with tests for appending items and then fails to recognize “prepend” as a method. The author details the implementation and confirms that the tests pass successfully after defining the method.