• Welcome to Valhalla Legends Archive.
 

Creating a Word Guessing Game

Started by warz, June 05, 2003, 09:41 AM

Previous topic - Next topic

Eibro

Quote from: Camel on June 07, 2003, 04:50 PM
Quote from: K on June 07, 2003, 04:38 PM
Quote from: Camel on June 07, 2003, 04:25 PM
[edit] btw, i've never tested it because i dont use templates. templates are designed for lazy programmers: people who only want to change something in one place, not five. why bother when one could spend a tenth of the time just writing five classes? templates aren't bad in theory, but neither is communism.
I'm speechless.

When realize you have hard to find bugs or want to add features in your ten classes that are 99.9% the same, enjoy fixing each class in turn.  Oh, and don't use Find - Replace.  Find - Replace is for lazy programmers! Don't use an IDE like Anjunta or Visual Studio, those are for wusses.  In fact, structured programming languages are for lazy programmers.

It doesn't make you "lazy" to use a tool to simplify repetative tasks. It makes you "smart."

i said five! the flame was directed at aplib
and btw, you should use inheriance if your classes are 99.9% the same
Five, ten, what the hell is the difference? The future is uncertain and with that uncertainty comes unplanned modifications to your code. It makes it much harder to update code if it's spread across ten, twenty different source files all with the same implementation.

Inheritance vs. templates is not a question of "should", it depends on which one will work. It doesn't matter how similar a group of classes is, whether it's 99% or 1%, it depends on one fundamental question: Does the type T affect the behavior of the class? That is, can all types T be treated in a generic fashion?

Quotewhy bother when one could spend a tenth of the time just writing five classes?
Yes, why bother planning for the future... after all, what matters is now!
Eibro of Yeti Lovers.

Skywing

Quote from: Camel on June 07, 2003, 04:50 PM

i said five! the flame was directed at aplib
and btw, you should use inheriance if your classes are 99.9% the same

Umm... No.  These are two completely different things.  Have you ever used STL?  I'm guessing not, because it uses templates heavily - and, in the process, it can save you a whole lot of time.  I use STL in virtually all of my new programs - it saves me from having to write and test classes and functions to manage things like binary trees or linked lists, freeing me to instead write code specific to the program I'm working on, relying on heavily tested, optimized, standardized code using templates.

I don't see how inheritance has much application for something like this.  Maybe I'm missing something obvious, but I don't see how you can match the simplicity of being able to do: typedef list<myobj> objlist;
objlist thelist;
with inheritance rather than templates.

Camel

i think we have different definitions of inheritance

class everythingSharedAmongClasses
{ ... }

class someClassOne : everythingSharedAmongClasses
{ ... }

class someClassTwo : everythingSharedAmongClasses
{ ... }

Eibro

Quote from: Camel on June 08, 2003, 12:56 PM
i think we have different definitions of inheritance

class everythingSharedAmongClasses
{ ... }

class someClassOne : everythingSharedAmongClasses
{ ... }

class someClassTwo : everythingSharedAmongClasses
{ ... }

How could you have differing definitions of inheritance? The concept is pretty straightforward.
Well I think you just don't get it. Refer to my post about inheritance vs. templates, like Skywing said, they're completely different things used in completely different situations.
Eibro of Yeti Lovers.

Grok

Quote from: Eibro on June 08, 2003, 02:29 PMHow could you have differing definitions of inheritance? The concept is pretty straightforward.

Yes but for illustrative purposes:

Say iago gets some hottie pregnant.

Hottie has an extremely ugly baby.

Inheritance at work!