<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Tom Dalling - Latest Comments</title><link>http://tomdalling.disqus.com/</link><description></description><atom:link href="https://tomdalling.disqus.com/comments.rss" rel="self"></atom:link><language>en</language><lastBuildDate>Mon, 12 Aug 2024 03:34:53 -0000</lastBuildDate><item><title>Re: SOLID Class Design: The Liskov Substitution Principle</title><link>http://tomdalling.com/blog/software-design/solid-class-design-the-liskov-substitution-principle/#comment-6525750817</link><description>&lt;p&gt;Some ducks can fly&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Bliii</dc:creator><pubDate>Mon, 12 Aug 2024 03:34:53 -0000</pubDate></item><item><title>Re: Explaining Homogenous Coordinates &amp;amp; Projective Geometry</title><link>http://tomdalling.com/blog/modern-opengl/explaining-homogenous-coordinates-and-projective-geometry/#comment-6483232489</link><description>&lt;p&gt;This explanation is so good and so clear, thank you so much Tom.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">salah</dc:creator><pubDate>Tue, 18 Jun 2024 06:19:16 -0000</pubDate></item><item><title>Re: Modern OpenGL 04 &amp;#8211; Cameras, Vectors &amp;amp; Input</title><link>http://tomdalling.com/blog/modern-opengl/04-cameras-vectors-and-input/#comment-6217044252</link><description>&lt;p&gt;Horizontal rotation (left/right) is around the Y axis, and vertical rotation (up/down) is around the X axis. You can visualise it as sticking a skewer through the object along the axis, then twisting the skewer. So if you want to spin the box left or right, you would have to skewer it along the Y axis.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Tom Dalling</dc:creator><pubDate>Mon, 26 Jun 2023 07:45:50 -0000</pubDate></item><item><title>Re: Modern OpenGL 04 &amp;#8211; Cameras, Vectors &amp;amp; Input</title><link>http://tomdalling.com/blog/modern-opengl/04-cameras-vectors-and-input/#comment-6216441162</link><description>&lt;p&gt;Tom I have a question about the orientation. In the orientation method rotate the _verticalAngle with the X component and the _horizontalAngle withe the Y component. Shouldn't be the opposite? M'I missing something?&lt;/p&gt;&lt;p&gt;glm::mat4 Camera::orientation() const {&lt;br&gt;    glm::mat4 orientation;&lt;br&gt;    orientation = glm::rotate(orientation, glm::radians(_verticalAngle), glm::vec3(1,0,0));&lt;br&gt;    orientation = glm::rotate(orientation, glm::radians(_horizontalAngle), glm::vec3(0,1,0));&lt;br&gt;    return orientation;&lt;br&gt;}&lt;/p&gt;&lt;p&gt;Thanks for this tutorials&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">ginko</dc:creator><pubDate>Sun, 25 Jun 2023 10:54:04 -0000</pubDate></item><item><title>Re: Explaining Homogenous Coordinates &amp;amp; Projective Geometry</title><link>http://tomdalling.com/blog/modern-opengl/explaining-homogenous-coordinates-and-projective-geometry/#comment-6045307788</link><description>&lt;p&gt;Thank you for the kind words!&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Tom Dalling</dc:creator><pubDate>Sat, 19 Nov 2022 22:35:01 -0000</pubDate></item><item><title>Re: Explaining Homogenous Coordinates &amp;amp; Projective Geometry</title><link>http://tomdalling.com/blog/modern-opengl/explaining-homogenous-coordinates-and-projective-geometry/#comment-6042035908</link><description>&lt;p&gt;This explanation is so good and so clear, thank you so much Tom! You just explained something so clearly, that my professor couldn't explain in an hour.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Wenxin Liu</dc:creator><pubDate>Wed, 16 Nov 2022 08:39:14 -0000</pubDate></item><item><title>Re: Coding Tip: Have A Single Exit Point</title><link>http://tomdalling.com/blog/coding-tips/coding-tip-have-a-single-exit-point/#comment-6021408922</link><description>&lt;p&gt;Since it appears you are using C++ — vs Java or Javascript; did I intuit that correctly? — you can use a &lt;code&gt;goto&lt;/code&gt; to really clean it up and get the best of both worlds.&lt;/p&gt;&lt;p&gt;Here is your example with &lt;code&gt;goto&lt;/code&gt; and w/o the &lt;em&gt;"yuck"&lt;/em&gt;:&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;pre&gt;&lt;code&gt;int MyArray::indexOfElement(int elementToFind){&lt;br&gt;  FooBar* fb = new FooBar;&lt;br&gt;  fb-&amp;gt;openSomeFile();&lt;br&gt;  fb-&amp;gt;startSomeWorkerThread();&lt;br&gt;  for(int i = 0; i &amp;lt; m_numberOfElements; ++i){&lt;br&gt;    if(this-&amp;gt;elementAtIndex(i) != elementToFind){&lt;br&gt;      continue;&lt;br&gt;    }&lt;br&gt;    goto end;&lt;br&gt;  }&lt;br&gt;  i = ELEMENT_NOT_FOUND;&lt;br&gt;end:&lt;br&gt;  fb-&amp;gt;closeSomeFile();&lt;br&gt;  fb-&amp;gt;waitForWorkerThreadToFinish();&lt;br&gt;  delete fb;&lt;br&gt;  return i;&lt;br&gt;}&lt;/code&gt;&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">MikeSchinkel</dc:creator><pubDate>Mon, 24 Oct 2022 16:27:21 -0000</pubDate></item><item><title>Re: FizzBuzz In Too Much Detail</title><link>http://www.tomdalling.com/blog/software-design/fizzbuzz-in-too-much-detail/#comment-5771932584</link><description>&lt;p&gt;Great Article&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">gasmasq</dc:creator><pubDate>Sun, 27 Feb 2022 18:56:23 -0000</pubDate></item><item><title>Re: Model View Controller Explained</title><link>http://tomdalling.com/blog/software-design/model-view-controller-explained/#comment-5724553362</link><description>&lt;p&gt;explanations too good.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">kalam ahmed</dc:creator><pubDate>Sun, 06 Feb 2022 22:16:33 -0000</pubDate></item><item><title>Re: FizzBuzz In Too Much Detail</title><link>http://www.tomdalling.com/blog/software-design/fizzbuzz-in-too-much-detail/#comment-5254231261</link><description>&lt;p&gt;Exactly.. "Meanwhile in the real world" really applies here.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">ziplock9000</dc:creator><pubDate>Thu, 04 Feb 2021 11:57:16 -0000</pubDate></item><item><title>Re: SOLID Class Design: The Open Closed Principle</title><link>http://tomdalling.com/blog/software-design/solid-class-design-the-open-closed-principle/#comment-5066126658</link><description>&lt;p&gt;Thank you! Kathy Sierra is a great teacher, so I am flattered.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Tom Dalling</dc:creator><pubDate>Fri, 11 Sep 2020 02:59:28 -0000</pubDate></item><item><title>Re: SOLID Class Design: The Open Closed Principle</title><link>http://tomdalling.com/blog/software-design/solid-class-design-the-open-closed-principle/#comment-5063348829</link><description>&lt;p&gt;I think you should be the co-author of Head First book series. You explain in very interesting way. I generally smile while reading your posts.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Moksh M</dc:creator><pubDate>Wed, 09 Sep 2020 01:15:07 -0000</pubDate></item><item><title>Re: FizzBuzz In Too Much Detail</title><link>http://www.tomdalling.com/blog/software-design/fizzbuzz-in-too-much-detail/#comment-5033674804</link><description>&lt;p&gt;For Python just do&lt;br&gt;import fizzbuzz&lt;br&gt;fizzbuzz.generate(100)&lt;/p&gt;&lt;p&gt;ez lol /s&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Ultimate Dude</dc:creator><pubDate>Mon, 17 Aug 2020 07:47:10 -0000</pubDate></item><item><title>Re: FizzBuzz In Too Much Detail</title><link>http://www.tomdalling.com/blog/software-design/fizzbuzz-in-too-much-detail/#comment-4860275140</link><description>&lt;p&gt;get output like this in c language:&lt;br&gt;1 2 3 4 bus 6 7 8 9 Bus 11 12 13 14 bUs 16 17 18 19 bus 21 22 23 24 Bus 26 27 28 29 bUs....&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">shwetha kumar</dc:creator><pubDate>Fri, 03 Apr 2020 23:56:42 -0000</pubDate></item><item><title>Re: Explaining Homogenous Coordinates &amp;amp; Projective Geometry</title><link>http://tomdalling.com/blog/modern-opengl/explaining-homogenous-coordinates-and-projective-geometry/#comment-4691108980</link><description>&lt;p&gt;excellent post, thank you for sharing!&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Srishti Mukherjee</dc:creator><pubDate>Fri, 15 Nov 2019 19:23:25 -0000</pubDate></item><item><title>Re: Resource Acquisition is Initialisation (RAII) Explained</title><link>http://tomdalling.com/blog/software-design/resource-acquisition-is-initialisation-raii-explained/#comment-4667355918</link><description>&lt;p&gt;Great explanation. Thank you Tom!&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">angelos.p</dc:creator><pubDate>Sun, 27 Oct 2019 06:27:54 -0000</pubDate></item><item><title>Re: FizzBuzz In Too Much Detail</title><link>http://www.tomdalling.com/blog/software-design/fizzbuzz-in-too-much-detail/#comment-4661350959</link><description>&lt;p&gt;Not to spec, it never prints "FizzBuzz".&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Sylvester Hesp</dc:creator><pubDate>Tue, 22 Oct 2019 06:50:18 -0000</pubDate></item><item><title>Re: FizzBuzz In Too Much Detail</title><link>http://www.tomdalling.com/blog/software-design/fizzbuzz-in-too-much-detail/#comment-4653790495</link><description>&lt;p&gt;for(int x = 1; x &amp;lt; 101; x++) { Console.WriteLine((x % 3 == 0) ? "Fizz" : (x % 5 == 0) ? "Buzz" : x.ToString()); }&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">David Shields</dc:creator><pubDate>Tue, 15 Oct 2019 19:12:41 -0000</pubDate></item><item><title>Re: SOLID Class Design: The Liskov Substitution Principle</title><link>http://tomdalling.com/blog/software-design/solid-class-design-the-liskov-substitution-principle/#comment-4647785972</link><description>&lt;p&gt;Great article, thought I'd add my take from a video game coder's perspective. I usually find the below solution easy to read and respects SRP. Often objects are expected to do silly things, but this also keeps things logical.&lt;/p&gt;&lt;p&gt;When an object belonging to a family requires a unique implementation of a behavior, this could possibly be a good opportunity to use the &lt;b&gt;Strategy Design Pattern.&lt;/b&gt;&lt;/p&gt;&lt;p&gt;By using an abstract Base of "FlyType", one can then create concretions of: LowAltitude, HighAltitude, Ground, Underwater, and etc. This would offer more or less control over how the altitude effects the client.&lt;/p&gt;&lt;p&gt;I say 'more or less', because at this point you can set the altitude to zero, turn it negative(since penguins can dive underwater), or just rationalize that altitude for hopping penguins, since employing a null pattern here would still violate LSP I guess.&lt;/p&gt;&lt;p&gt;&lt;b&gt;Implementation: &lt;/b&gt;&lt;br&gt;In the Bird base, make sure the concretions define their Fly/Altitude implementations:&lt;br&gt;&lt;i&gt;public virtual void SetAltitude(double altitude) =&amp;gt; Ground( ).Fly( altitude ) &lt;br&gt;protected abstract FlyType( ) =&amp;gt; new Ground( );&lt;/i&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">K Serra</dc:creator><pubDate>Thu, 10 Oct 2019 17:28:13 -0000</pubDate></item><item><title>Re: Resource Acquisition is Initialisation (RAII) Explained</title><link>http://tomdalling.com/blog/software-design/resource-acquisition-is-initialisation-raii-explained/#comment-4609635586</link><description>&lt;p&gt;Let's say there are multiple &lt;code&gt;std::shared_ptr&lt;/code&gt; objects that all contain the same pointer. When those objects get created/destroyed, it doesn't create/destroy the pointer, which is why I say that the pointer is not the "resource". Creating an object creates a lease (or a guarantee, or something like that), and destroying the object relinquishes the lease. So the resource being acquired/released is the lease, not the pointer.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Tom Dalling</dc:creator><pubDate>Mon, 09 Sep 2019 09:02:43 -0000</pubDate></item><item><title>Re: Resource Acquisition is Initialisation (RAII) Explained</title><link>http://tomdalling.com/blog/software-design/resource-acquisition-is-initialisation-raii-explained/#comment-4602184886</link><description>&lt;p&gt;This article is awesome!  But would you mind explaining the statement "std::shared_ptr is interesting, in that the "resource" is not the pointer itself — that's what std::unique_ptr does" a bit better?  I'm not sure I follow your point... :(&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Skrell</dc:creator><pubDate>Tue, 03 Sep 2019 09:16:09 -0000</pubDate></item><item><title>Re: FizzBuzz In Too Much Detail</title><link>http://www.tomdalling.com/blog/software-design/fizzbuzz-in-too-much-detail/#comment-4593177189</link><description>&lt;p&gt;I could reply to you, or I could just direct you to read the rest of the article before commenting. Congrats on making a fool of yourself.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Tom Dalling</dc:creator><pubDate>Tue, 27 Aug 2019 03:01:55 -0000</pubDate></item><item><title>Re: FizzBuzz In Too Much Detail</title><link>http://www.tomdalling.com/blog/software-design/fizzbuzz-in-too-much-detail/#comment-4592927521</link><description>&lt;p&gt;Congrats. You turned a concise function into unreadable garbage.  You actually "got it" when you thought to ask why you would replace % with a function call, but you did it anyway with essentially zero justification other some vague reference to flexibility.  Do you honestly NOT use binary operators (e.g., 2 + 2) because you want more flexibility in how to numbers are added? For sure you'd get an F had I been grading your result.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Rick O'Shea</dc:creator><pubDate>Mon, 26 Aug 2019 20:28:41 -0000</pubDate></item><item><title>Re: SOLID Class Design: The Liskov Substitution Principle</title><link>http://tomdalling.com/blog/software-design/solid-class-design-the-liskov-substitution-principle/#comment-4582492420</link><description>&lt;p&gt;Using birds that can't fly is an easy way to demonstrate the LSP, but it's not very representative of real-world code or good design, unfortunately. Probably the worst design sin committed here is mapping a "real world taxonomy" to a class hierarchy, which is a very common mistake. So yes, the abstraction isn't great, but it's also difficult to say what would be better, considering that it's a hypothetical application.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Tom Dalling</dc:creator><pubDate>Sun, 18 Aug 2019 02:52:34 -0000</pubDate></item><item><title>Re: SOLID Class Design: The Liskov Substitution Principle</title><link>http://tomdalling.com/blog/software-design/solid-class-design-the-liskov-substitution-principle/#comment-4575824106</link><description>&lt;p&gt;...but Penguins do have an altitude.  Everything has an altitude.  Penguins can also change their altitude, they do so by walking (like, up a hill) or diving into the water.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Scott L. Bain</dc:creator><pubDate>Mon, 12 Aug 2019 15:07:58 -0000</pubDate></item></channel></rss>