Angband.oook.cz
Angband.oook.cz
AboutVariantsLadderForumCompetitionComicScreenshotsFunniesLinks

Go Back   Angband Forums > The real world > Idle chatter

Reply
 
Thread Tools Display Modes
Old April 14, 2013, 18:37   #11
AnonymousHero
Veteran
 
AnonymousHero's Avatar
 
Join Date: Jun 2007
Posts: 1,372
AnonymousHero is on a distinguished road
Quote:
Originally Posted by Derakon View Post
OOP has a great deal of value in being one of the most readily-intuitive approaches to designing software. Any given program tends to have a massive amount of state, but that state tends to be broken up into chunks such that only certain functions modify certain chunks. OOP simply formalizes that relationship. It allows the developer to avoid having to think about the irrelevant 95% of the program and focus on only the bits that matter.
I think what you're really talking about here is encapsulation (aka Abstract Data Types aka Information Hiding aka ...) rather than OOP per se.

For example, modules exporing ADTs + functions is a good alternative to OOP which accomplishes many of the same goals. This is what's usually done in the MLs and Haskells of the world. (Plus you avoid the dangers of implementation inheritance )
AnonymousHero is offline   Reply With Quote
Old April 14, 2013, 18:47   #12
AnonymousHero
Veteran
 
AnonymousHero's Avatar
 
Join Date: Jun 2007
Posts: 1,372
AnonymousHero is on a distinguished road
Quote:
Originally Posted by Therem Harth View Post
Likewise having a compiler that catches most of my mistakes (at least thus far).
(Talking about C++).

C++11 certainly made C++ a hugely more safe and pleasant experience, but unfortunately the above statement is overly optimistic. C++ is rife with undefined behavior that you only ever find out about when it's too late -- because something just happens to work on your particular version of your particular compiler. The so-called "static initialization fiasco" is my particular favorite.

C++ also basically has all the wrong "defaults" -- unsafe by default, using managed pointers (smart_ptr, etc.) requires huge amounts of syntax whereas the unmanaged ones require only a "*". A particular niggle of mine is also the fact that you can give reference arguments without any way to notice at the call site. For example:

Code:
void f(int &a) {
   a = 5;
}

void main() {
    int x = 1;
    f(x);
    printf("%d\n", x); // Prints 5.
}
You might argue that this is just bad practice, but it would be simple to require some indication at the call site that the "x" in "f(x);" is really being transferred as a reference.

Aaaaaanyway...

Last edited by AnonymousHero; April 14, 2013 at 21:18.
AnonymousHero is offline   Reply With Quote
Old April 14, 2013, 20:16   #13
Narvius
Knight
 
Narvius's Avatar
 
Join Date: Dec 2007
Location: Poland, Katowice
Age: 27
Posts: 589
Narvius is on a distinguished road
My personal opinion is that the main benefit (main - not only) of OOP is taking over some responsibility for the structure of a program from the programmer. I wouldn't go as to call it a crutch, since that is somewhat demeaning, and programming being as brain-breakingly hard as it is at times, we need all the help we can get, but I've felt liberated not having to utilize any object system in Lisp. There are some problem domains that are naturally best expressed via OOtion, but in the majority of the cases, it's simply a personal choice of what allows you to express your thoughts concisely, efficiently and (most importantly!) human-readably. And for me, that choice usually is not OOP.

And every language has some epic pitfalls. :P
__________________
If you can convincingly pretend you're crazy, you probably are.
Narvius is offline   Reply With Quote
Old April 14, 2013, 20:54   #14
Pete Mack
Prophet
 
Join Date: Apr 2007
Location: Seattle, WA
Posts: 5,600
Donated: $40
Pete Mack is on a distinguished road
Quote:
Originally Posted by Narvius View Post
My personal opinion is that the main benefit (main - not only) of OOP is taking over some responsibility for the structure of a program from the programmer.
Well if there is more than one programmer, any responsibility for taking over structure of a program is much to be desired. In fact the part of OO I use the most is "interfaces" not "inherited classes." But if there's some minor polymorphism I want to accomplish, classes are a fine solution.
Pete Mack is offline   Reply With Quote
Old April 14, 2013, 21:49   #15
Narvius
Knight
 
Narvius's Avatar
 
Join Date: Dec 2007
Location: Poland, Katowice
Age: 27
Posts: 589
Narvius is on a distinguished road
Unified interfaces rule.
__________________
If you can convincingly pretend you're crazy, you probably are.
Narvius is offline   Reply With Quote
Old April 14, 2013, 22:53   #16
Nick
Vanilla maintainer
 
Nick's Avatar
 
Join Date: Apr 2007
Location: Canberra, Australia
Age: 54
Posts: 7,983
Donated: $60
Nick will become famous soon enough
Quote:
Originally Posted by Pete Mack View Post
Well if there is more than one programmer...
And this is precisely the point, and the cause of a lot of language arguments, IMHO. What software 'should' look like is very dependent on whether it is a team or an individual working on it, if it needs to be used over the short or long term, (can't be bothered listing more but there are more).
__________________
One for the Dark Lord on his dark throne
In the Land of Mordor where the Shadows lie.
Nick is offline   Reply With Quote
Old April 15, 2013, 04:26   #17
RogerN
Swordsman
 
RogerN's Avatar
 
Join Date: Jul 2008
Posts: 308
RogerN is on a distinguished road
For me one of the biggest benefits of OOP is better context-aware tab-completion in your IDE, and the ability to just type "object." to bring up an object's capabilities without having to refer to the documentation Seriously... that alone saves me SO much time.

OOP is also convenient when you need to quickly describe the architecture of a program to another developer. A picture is worth a thousand words they say, and an old-fashioned class diagram can be quite instructive. A good IDE can even auto-generate some diagrams for you. Sure, you can diagram function calls and stuff without OOP... but IMO it's not as easy to digest that way. I am, of course, biased.

Encapsulation should be done with or without OOP; OOP is just a nice way to abstract it.

You've got polymorphism, too - sometimes that's convenient, but sometimes not. It's just syntactic sugar for function pointers. You'll notice that most OOP language still provide a way to use function pointers even without polymorphism. Java has interfaces, C# has interfaces and delegates, etc...
RogerN is offline   Reply With Quote
Old June 7, 2013, 11:47   #18
Hajo
Adept
 
Hajo's Avatar
 
Join Date: Aug 2010
Posts: 142
Hajo is on a distinguished road
Debugging is time consuming and mentally demanding. Much more than the coding step.

I think an important factor of choosing a language is to choose one where it's less likely to make bugs. This depends on the programmer (different people think differently and make different sorts of mistakes) and the language (some languages just have more traps and pitfalls for the unwary than others).

C++ was and still is a language in which I make fairly many mistakes and also it is harder to debug than many other languages. If you choose C++, you should be aware that it is a very powerful tool, but a difficult one, and one where programming mistakes can be quite hard to track down and fix.
__________________
I have a project problem? I have no project problem. I start a project, I work on it, it fails. No problem
Hajo is offline   Reply With Quote
Old June 18, 2013, 10:30   #19
Zireael
Adept
 
Join Date: Jul 2011
Posts: 204
Zireael is on a distinguished road
I have had contact with C and Lua and I'm finding the latter much more preferable. However, I prefer games where the data is saved as txt/xml, which makes them easy to mod.

Now, how to use it in my ongoing Underdark band idea...
Zireael is offline   Reply With Quote
Old June 18, 2013, 16:38   #20
Derakon
Prophet
 
Derakon's Avatar
 
Join Date: Dec 2009
Posts: 9,005
Derakon is on a distinguished road
Realistically these days there's only two reasons to use custom binary file formats:

1) You want it to take an extra two hours for the hackers to figure out how to modify your savefiles / the idea of people being able to easily modify your game fills you with shame and horror.
2) You're writing a program for older mobile devices that don't have the storage/processing power to effectively make use of text formats.
Derakon is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Experiences with Frog-knows Timo Pietilš Vanilla 110 July 27, 2014 18:58
Programming Q&A Derakon Development 23 September 20, 2012 23:00
New to Angband programming BreathesFire Development 14 October 13, 2011 18:33
Windows Programming Question Kyle Development 5 July 29, 2009 04:52
Morgothian programming language zaimoni Idle chatter 2 April 22, 2009 10:26


All times are GMT +1. The time now is 10:10.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.