Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!137.226.231.214.MISMATCH!newsfeed.fsmpi.rwth-aachen.de!eternal-september.org!feeder.eternal-september.org!mx05.eternal-september.org!.POSTED!not-for-mail From: =?UTF-8?B?Sm9zaHVhIENyYW5tZXIg8J+Qpw==?= Newsgroups: comp.lang.java.programmer Subject: Re: Final Fantasy 2 based game source code Date: Sat, 23 Mar 2013 23:01:06 -0500 Organization: A noiseless patient Spider Lines: 54 Message-ID: References: <171686ae-5239-4502-9ef3-65a68e8a1a1d@googlegroups.com> <514a53c7$0$32110$14726298@news.sunsite.dk> <_JGdndJSO5_5ENHMnZ2dnUVZ7tWdnZ2d@bt.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Sun, 24 Mar 2013 03:59:12 +0000 (UTC) Injection-Info: mx05.eternal-september.org; posting-host="d4f756ecbcafbdef0d455e61327651f3"; logging-data="21442"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19ro7FoRatLjciUr/wBloqFoDXF05ZoF94=" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:20.0) Gecko/20100101 Thunderbird/20.0 In-Reply-To: Cancel-Lock: sha1:B89fsWF8bp6ySWZlm6i0tQ4ixmE= Xref: csiph.com comp.lang.java.programmer:23100 On 3/22/2013 3:09 PM, lipska the kat wrote: > On 22/03/13 19:07, Joshua Cranmer 🐧 wrote: >> What I consider the core of OOP to be is the ability to specify an >> abstract interface. > > All interfaces are abstract in Java so in the context of a discussion in > a Java group I don't see the point. We're discussing an abstract programming concept so by the term "abstract interface" here I meant to refer to the theoretical concept rather than the Java specific term. Although it turns out that Java's interfaces map very nicely to abstract interfaces and vice versa. >> The C code does >> fit under that paradigm, > > I don't see it I'm afraid Per my definition, it boils down to three things: abstraction, polymorphism, and inheritance. Function pointers I hope we can both agree satisfy polymorphism. Inheritance of implementation comes about by having something like this: int SuperStack_pop(Stack *s) { int rv = Stack_pop(s); /* do something else */ return rv; } Not as elegant as Java, but it works. For the abstraction paradigm, note that it is possible to provide two different implementations of stack methods that use the same interface. You could use a sentinel stack, a circularly-linked list stack, or a regular no-sentinel stack. You could get even more creative if you abused the ability to type-pun in C and made the top node pointer do something else. If it were a plain void *pImpl member (as is more common in C OOP libraries) that the "class" could allocate at well, then there's no limit to how many different implementations. > This doesn't alter the fact that my C code is not Object Oriented I would say you're thinking about it in the wrong terms. Programming paradigms are nothing more than philosophies to structure code, so you could easily write declarative, imperative, functional, and object-oriented code all in the same language, and even the same code. This is why I dislike calling languages "functional", "object-oriented", etc.: it obscures the fact that these terms have really fuzzy boundaries when applied to real-world languages and that what you have at best is a spectrum that really refers to how easy it is to do something. -- Beware of bugs in the above code; I have only proved it correct, not tried it. -- Donald E. Knuth