Angband.oook.cz
Angband.oook.cz
AboutVariantsLadderForumCompetitionComicScreenshotsFunniesLinks

Go Back   Angband Forums > The real world > Idle chatter

Reply
 
Thread Tools Display Modes
Old April 13, 2013, 22:37   #1
Therem Harth
Knight
 
Therem Harth's Avatar
 
Join Date: Jan 2008
Location: New England winter
Posts: 923
Therem Harth is on a distinguished road
Programming experiences

For a while I've been bouncing between different programming languages - trying to learn how to design programs in one or the other, and pretty much failing. Couldn't seem to get comfortable with any of them, and quickly lost focus. ("What's with this syntax? How can I use the data structures I want? Why is my program giving me obscure runtime errors?")

But at the moment I'm working my way through Practical C++ Programming, and the language just seems to be clicking with me. I haven't gotten into the heavily OOP parts yet, but I think it's pretty nice even as just "C with iostreams"; having halfway sane string and I/O handling makes it much easier to translate what I'm thinking into what the computer should do. Likewise having a compiler that catches most of my mistakes (at least thus far).

Now I'm kind of idly curious about other people's experiences programming, or learning to program. Is it common to find that a lot of languages just "don't click" in the beginning?
Therem Harth is offline   Reply With Quote
Old April 13, 2013, 22:42   #2
Derakon
Prophet
 
Derakon's Avatar
 
Join Date: Dec 2009
Posts: 8,946
Derakon is on a distinguished road
Yes, it is. For example, you should expect it to take at least two tries (and often more!) before pointers make any kind of sense. Programming requires a way of thinking that is fundamentally different from the way most people act. Our brains are used to coming up with all kinds of shortcuts and then forgetting all the steps involved in the normal process. For example, you may "just know" that 56/8 = 7, without having to actually do the math in your head. But computers don't do shortcuts; everything has to be spelled out for them, and to do that spelling out, you can't let your brain take any shortcuts either. It's not easy!
Derakon is online now   Reply With Quote
Old April 14, 2013, 00:32   #3
Therem Harth
Knight
 
Therem Harth's Avatar
 
Join Date: Jan 2008
Location: New England winter
Posts: 923
Therem Harth is on a distinguished road
Good point (so to speak). I've gotten the basics of pointers by now, but yeah, that was hard to figure out at first.
Therem Harth is offline   Reply With Quote
Old April 14, 2013, 10:06   #4
Narvius
Knight
 
Narvius's Avatar
 
Join Date: Dec 2007
Location: Poland, Katowice
Age: 27
Posts: 589
Narvius is on a distinguished road
I may be influenced by Torvalds, there (or the fact that one of my college introductory progamming courses mostly consisted of memorizing the more cryptic parts of C++ inheritance rules - a truly boring topic, moreso if you have eight or nine years of programming behind your ears and better things to do), but I do think that streams are the only worthwhile thing that C++ has introduced over C. And maybe reference arguments, I guess.
__________________
If you can convincingly pretend you're crazy, you probably are.
Narvius is offline   Reply With Quote
Old April 14, 2013, 10:16   #5
Pete Mack
Prophet
 
Join Date: Apr 2007
Location: Seattle, WA
Posts: 5,422
Donated: $40
Pete Mack is on a distinguished road
IO Streams are plain evil. There are much better ways to do this, including static analysis of printf-stype formatting, or C# format statements.

The advantage of C++ over C is object-oriented programming, Period.
Pete Mack is online now   Reply With Quote
Old April 14, 2013, 10:21   #6
Narvius
Knight
 
Narvius's Avatar
 
Join Date: Dec 2007
Location: Poland, Katowice
Age: 27
Posts: 589
Narvius is on a distinguished road
Except OOP is only very rarely useful. :3

Well, I don't think I really get a voice, either way, because I'm an avid Lisper and just don't care about C/C++s features.

[Edit]
Also, the more important aspect of "streams" is handling input and output over a unified interface, not necessarily the left bitshifting implementation present in C++.
__________________
If you can convincingly pretend you're crazy, you probably are.

Last edited by Narvius; April 14, 2013 at 10:45.
Narvius is offline   Reply With Quote
Old April 14, 2013, 11:17   #7
Mikko Lehtinen
Veteran
 
Join Date: Sep 2010
Posts: 1,246
Mikko Lehtinen is on a distinguished road
Quote:
Originally Posted by Narvius View Post
Except OOP is only very rarely useful. :3
I've read that OOP is most useful with mouse-driven graphical interfaces. If you don't have to deal with that, it may well be that OOP isn't worth the effort, of course depending on what you're trying to do.

I'm a novice Python programmer and still trying to understand OOP myself. Python's "everything is an object" was actually very useful to me in a text-processing project. It allowed me to create a function that generated other functions based on data on common errors and how to correct them in a text file. Very useful! I'm not sure whether you could call that OOP programming or not, but I couldn't have done it if functions were not treated as objects.

I find it tedious to learn programming from books that start gradually explaining the basics. It gets boring fast, because you only rarely get to do anything cool. Dive Into Python 3 started with a complete, useful programs, and then explained how they worked. Starting from the big picture helped me to grasp how to use the programming language in real life.
Mikko Lehtinen is offline   Reply With Quote
Old April 14, 2013, 16:03   #8
debo
Veteran
 
debo's Avatar
 
Join Date: Oct 2011
Location: Toronto, Canada
Posts: 2,367
debo is on a distinguished road
The best introductions / motivations for OOP came to me from the Structure and Interpretation of Computer Programs (the wizard book), and Object-Oriented Software Construction (from Bertrand Meyer -- first edition! The second ed is really bloated.)

READ THOSE! (SICP also taught me how to structure functional programs as well. Such an awesome book.)
debo is offline   Reply With Quote
Old April 14, 2013, 16:04   #9
debo
Veteran
 
debo's Avatar
 
Join Date: Oct 2011
Location: Toronto, Canada
Posts: 2,367
debo is on a distinguished road
Also, if C++ is "clicking with you", you just might be a psychopath. Or at the very least, a masochist
debo is offline   Reply With Quote
Old April 14, 2013, 18:10   #10
Derakon
Prophet
 
Derakon's Avatar
 
Join Date: Dec 2009
Posts: 8,946
Derakon is on a distinguished road
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.

Is OOP the only useful design approach? Certainly not. Is it the best design approach? Well, that depends on how you define "best". As I said, it's comparatively intuitive for most programmers; it also tends to be able to be applied to most problems to get you at least some benefit. Those are both significant positive qualities. It's not going to be the best option for every problem, though, but neither is any other approach.
Derakon is online now   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 15:08.


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