Beginner ?. Why does D suggest to learn java

via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Oct 18 01:30:14 PDT 2014


On Saturday, 18 October 2014 at 02:00:42 UTC, RBfromME wrote:
> but i don't find the basics any easier to  learn than D's.  The 
> biggest issue i personal find in getting deeper into  a 
> language is the docs and examples. The python examples, beyond 
> the basics usually get write into OO so you find your self 
> trying to figure out OO while trying to sift through the 
> examples.  Makes it a little harder to get going and figure out 
> the available libraries while trying to figure OO at the same 
> time.

If you find D more fun, then use D, but OO is little more than 
representing aspects of real physical objects in the computer:

If you want to write a program about cars you could group 
properties such as weight, top-speed and build-year and call that 
Vehicle, then add number of wheels and motorsize and call it Car 
or some other properties and call it Boat. Add a function print() 
to display all the info to each class Vehicle, Car and Boat. Then 
you can create a list of vehicles that store different properties 
for different types of vehicles while being able to treat all 
cars and boats the same when printing them.

That's basically it. Nothing magic.

The most important aspect of learning how to program is what 
universities tend to call "datastructures and algorithms".  The 
basics is probably just 2-4 weeks.

If you already know Python a little bit you could try to use 
educational resources for Python and translate it into D, e.g.:

http://interactivepython.org/courselib/static/pythonds/index.html

The nice thing about Python that it is very close to what is 
called "pseudo code", basically a shorthand used when sketching a 
program.

> Summing it up, I personally think the hardest part in learning 
> to use a specific language is the docs and and examples because 
> they all throw you write into OO and you spend more time trying 
> to figure out OO instead of how to use the standard lib or 
> third party lib to get a basic task done.

You don't need to learn more OO than I wrote above, and perhaps 
not even that. What you need to learn to be productive in any 
imperative language is:

1. What an aggregate (of values) is, they are often called 
"record", "struct" or "class" and how to create them.

2. Arrays and the provided operations on them (can be in language 
or libraries)

3. How to create links between aggregates (called "references" or 
"pointers")

Then pick up an online course or book on data structures and 
algorithms. Introductory books and courses teach roughly the same 
stuff, so pick anyone you like.

Understanding libraries and their documentation becomes much 
easier when you know the basic terminology about data structures 
and algorithms. One of the most entertaining and useful courses 
in computer science.


More information about the Digitalmars-d-learn mailing list