![]() |
#11 | |
Veteran
Join Date: Jun 2007
Posts: 1,372
![]() |
Quote:
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 ![]() |
|
![]() |
![]() |
![]() |
#12 | |
Veteran
Join Date: Jun 2007
Posts: 1,372
![]() |
Quote:
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. } Aaaaaanyway... Last edited by AnonymousHero; April 14, 2013 at 21:18. |
|
![]() |
![]() |
![]() |
#13 |
Knight
Join Date: Dec 2007
Location: Poland, Katowice
Age: 28
Posts: 589
![]() |
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. |
![]() |
![]() |
![]() |
#14 |
Prophet
Join Date: Apr 2007
Location: Seattle, WA
Posts: 5,999
Donated: $40
![]() |
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.
|
![]() |
![]() |
![]() |
#15 |
Knight
Join Date: Dec 2007
Location: Poland, Katowice
Age: 28
Posts: 589
![]() |
Unified interfaces rule.
__________________
If you can convincingly pretend you're crazy, you probably are. |
![]() |
![]() |
![]() |
#16 |
Vanilla maintainer
Join Date: Apr 2007
Location: Canberra, Australia
Age: 55
Posts: 8,671
Donated: $60
![]() |
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. |
![]() |
![]() |
![]() |
#17 |
Swordsman
Join Date: Jul 2008
Posts: 308
![]() |
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
![]() 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... |
![]() |
![]() |
![]() |
#18 |
Adept
Join Date: Aug 2010
Posts: 142
![]() |
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 ![]() |
![]() |
![]() |
![]() |
#19 |
Adept
Join Date: Jul 2011
Posts: 204
![]() |
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... ![]() |
![]() |
![]() |
![]() |
#20 |
Prophet
Join Date: Dec 2009
Posts: 9,024
![]() |
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. |
![]() |
![]() |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
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 |