Paradigms questions. Very confused. (1 Viewer)

Scanorama

Member
Joined
Mar 26, 2004
Messages
920
Location
Australia
Gender
Male
HSC
2004
G'day all, Im revising this option topic at the moment. With all different kind of paradigms, I'm very confused. Although I have a variety of texts but still I cannot understand what they mean. All 3 paradigms namely are: Logic, functional and object-oriented. Does imperative include as well?

I am so confused with their characteristics, and the use of each of them. Can someone please explain them to me? Thank heaps! :D
 

dark`secrets

<insert title>
Joined
Dec 23, 2003
Messages
2,703
Gender
Undisclosed
HSC
N/A
OOP- encapsulation, inheritance, classes, methods and polymorphism
logic- based on facts and rules, inference engine and backward/forward chaining.
functional- im not all that clear abt it, but it deals with mathematical problems or something.

hmm (random suggestion) imperative is like the normal algorithms...isnt it? As it is sequential.

do you have the excel sdd book or the sdd one by samD (they are useful). one by sam D is lengthy as it is a textbook, while the excel one is a revision type.
 
Last edited:

sunny

meh.
Joined
Jul 7, 2002
Messages
5,350
Gender
Male
HSC
2002
Functional - program is made of functions and is based on recursion, values of variables do not change.
 

MedNez

:o>---<
Joined
Aug 21, 2004
Messages
3,004
Gender
Male
HSC
N/A
Gough Whitlam said:
Does imperative include as well?
Nah, you have your 3 paradigms (Logic, OOP, Functional) described above.

The two categories of languages are Imperative (Procedural) or Declarative.

Imperative:

# Use decisions (branching) & repetition
# Separate input, output, data, control and processing into distinct components
# Use programs that have a definite beginning and definite termination
# Are based on variables and control structures

(Control structures are your sequence, decision, repetition).

from Wikipedia:

Whereas imperative programming gives the computer a list of instructions to execute in a particular order, declarative programming describes to the computer a set of conditions and lets the computer figure out how to satisfy them.

Declarative programming includes both functional programming and logic programming.

--

Hope that's cleared some stuff up. Declarative & Imperative aren't paradigms as such, they are ways of computing, through the three paradigms.

~ Med
 

Scanorama

Member
Joined
Mar 26, 2004
Messages
920
Location
Australia
Gender
Male
HSC
2004
Thanks heaps for the replies, they are very helpful. One more quesiton, can you please tell me an example for each of the paradigms? Thanks in advance :)
 

sunny

meh.
Joined
Jul 7, 2002
Messages
5,350
Gender
Male
HSC
2002
Here is a short program written using a functional language - Haskell.

Code:
fibonacci :: Int -> Int
fibonacci x
  | x == 1 = 1
  | x == 2 = 1
  | (otherwise) = fibonacci (x-1) + fibonacci (x-2)
Notice 1) recursive nature, 2) variables never change their values in the same instance of the function. You can read this function just like normally how you would find fibonacci numbers - the x'th fibonacci number is the x-1'th fibonnacci number plus the x-2'nd fibonacci number. Eventually you'll get all the way back to 1 and 2, for which there are "base cases" in the program.
 

Scanorama

Member
Joined
Mar 26, 2004
Messages
920
Location
Australia
Gender
Male
HSC
2004
Thanks Sunny. I've read through the past papers and found in Question 24 (The Option question), it gives a scenario and asks which will be the most appropriate paradigms. I'm kinda understand all of the paradigms, but still not 100% able to answer questions like that. Can someone please tell me an example/charateristic/use of each of the paradigms? It will be very appreciated. :)
 

Wild Dan Hibiki

teh sex0r
Joined
Feb 28, 2004
Messages
649
Gender
Undisclosed
HSC
2004
im lost with this topic as well, i went over both the excel and davis booklets but when i tried to do some past q's i still dunno wat to do
LOL
 

sunny

meh.
Joined
Jul 7, 2002
Messages
5,350
Gender
Male
HSC
2002
There are a few general pointers I believe can get out most paradigm questions:

Functional
- problem is of a recursive nature
- eg, finding fibonacci numbers: its definition is recursive

Object Oriented
- Suited for real world problems
- When things in the problem can be represented by objects communicating with each other to solve the problem

Logic
- When AI is required
- Expert systems
- This paradigm is obvious when to use

Imperative
- Pretty much anything that doesn't fit into those categories
- The problem can be solved with a series of sequential steps
 

tubby2877

New Member
Joined
Sep 28, 2005
Messages
1
languages for the paradigms

hey, just in case

these are just some of the languages used for the 3 main paradigm. there are many more but these are usually the ones looked at cause they are free and can be taught pretty well.

Logic - Prolog (great for AI, just type in all the rules in a notepad and then the comp just figures it out, also creates expert systems which is one big database and the comp decides which is most correct from the inputs)

Functional - Lisp (works on lists and brackets, a whole lotta brackets, lots of specialised syntax such as nil and T. used a whole lot for math function, domain and range)

Object Oriented - VB.Net, C++ (use classes and objects to create instances and works on events rather then sequential)

Imperative - Pascal (uses more of a step by step version to figure out how to execute)

although they don't ask for any specifics in the exams it is always handy to know some of the language as you can then picture it and since these languages are pretty common for there own paradigms it's handy to know them.

see ya
 
Last edited:

chook 05

Sum Fulla
Joined
Feb 7, 2007
Messages
40
Gender
Male
HSC
2008
Scanorama said:
G'day all, Im revising this option topic at the moment. With all different kind of paradigms, I'm very confused. Although I have a variety of texts but still I cannot understand what they mean. All 3 paradigms namely are: Logic, functional and object-oriented. Does imperative include as well?

I am so confused with their characteristics, and the use of each of them. Can someone please explain them to me? Thank heaps! :D

dont forget imperative!!
 

Fly Kite

Member
Joined
Aug 1, 2008
Messages
82
Gender
Male
HSC
2010
yeh that was posted in ... 2004. and ppl already did state imperative... read the post
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top