15.04.2018 Views

programming-for-dummies

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

70<br />

Artificial Intelligence Languages<br />

If you want to write programs that can run on different computers, use Java:<br />

✦ Java <strong>for</strong>ces you to know object-oriented <strong>programming</strong> right from the start<br />

(like C#), so knowing Java means you can figure out object-oriented <strong>programming</strong><br />

at the same time. Because Java isn’t as confusing as C or C++,<br />

understanding Java first is likely much easier than understanding C or C++.<br />

✦ If you’re using only a Windows computer, consider trying C#.<br />

The C# language is quickly becoming the standard language <strong>for</strong> writing<br />

Windows programs, so if that’s what you want to do, figuring out C# is your<br />

best bet. As long as you know at least one curly bracket language, you know<br />

one of the most popular <strong>programming</strong> languages in the world.<br />

Artificial Intelligence Languages<br />

Programming languages, such as C and BASIC, are often considered procedural<br />

or functional languages because they divide a large program into separate<br />

procedures or functions that tell the computer how to solve a problem<br />

step by step.<br />

Although telling the computer what to do step by step might seem like the<br />

most logical way to program a computer, another way to program a computer<br />

is by using a declarative language. Instead of describing how to solve a<br />

problem, declarative <strong>programming</strong> languages describe<br />

✦ Facts: In<strong>for</strong>mation about the problem<br />

✦ Rules: Relationships between this in<strong>for</strong>mation<br />

By using facts and rules, programs written in declarative languages can literally<br />

figure out an answer on their own without being told explicitly how to<br />

do it.<br />

Ultimately, every program, including those written in declarative languages,<br />

must get translated into machine language. That means every program must<br />

eventually tell the computer how to solve a problem step by step.<br />

Declarative languages simply free you from having to describe these steps to<br />

the computer.<br />

The most popular declarative <strong>programming</strong> language is Prolog (short <strong>for</strong><br />

Programming in Logic). A typical Prolog fact might look like this:<br />

father(“Sally”, “Jesse”).

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!