Presentation is loading. Please wait.

Presentation is loading. Please wait.

School of Computing and Mathematics, University of Huddersfield Computing Science: WEEK 17 Announcement: next few weeks… 9 nd Feb: Comparative Programming.

Similar presentations


Presentation on theme: "School of Computing and Mathematics, University of Huddersfield Computing Science: WEEK 17 Announcement: next few weeks… 9 nd Feb: Comparative Programming."— Presentation transcript:

1 School of Computing and Mathematics, University of Huddersfield Computing Science: WEEK 17 Announcement: next few weeks… 9 nd Feb: Comparative Programming Languages + Prolog - TLMc 16 th Feb: Prolog - TLMc 23 rd Feb: Prolog - TLMc

2 School of Computing and Mathematics, University of Huddersfield Computing Science: WEEK 17 LECTURE: Comparative Programming Languages + Prolog PRACTICALS: Follow notes on Blackboard OR on web – http://scom.hud.ac.uk/scomtlm/prolog/ - Use a web browser and follow instructions!

3 School of Computing and Mathematics, University of Huddersfield Languages for Computers n A great percentage of people in the world use computers nowadays – they run application tools and packages such as games, photo manipulation, email, spreadsheets, information retrieval, word processing, web browsers ….. n The language of interface has to be simple and specific to the application – usually clicking a mouse on a menu. n These tools and packages are specific and confined – its not possible to create OTHER tools and packages from them..

4 School of Computing and Mathematics, University of Huddersfield Languages for Computers n Computing scientists and engineers need to know how to design, implement, maintain, test. evaluate etc these applications n To do so you must to some extent ‘unlearn’ the pointing, clicking, dragging, dropping of the masses – you need to learn Programming, Design, Database, Specification, Web Languages and expert development environments and open operating systems such as Unix.

5 School of Computing and Mathematics, University of Huddersfield Algorithms Fundamental to being a computer expert is the knowledge of ‘Algorithms’. An Algorithm is a step by step (or systematic) method of solving a problem written in enough detail so that a computer can carry it out. You encode Algorithms using Programming Languages.

6 School of Computing and Mathematics, University of Huddersfield Programming Languages – Procedural There are literally thousands of Programming Languages. Most are PROCEDURAL (or STATE based) because they rely on storing data values (or objects) in VARIABLES. Steps in an algorithm update the values in the variables until a desired result. Example: Static int factorial(int n) { m = 1; while (n > 0) {m=n*m; n=n-1;} return m; } If n >= 0 this returns the factorial of n.

7 School of Computing and Mathematics, University of Huddersfield Programming Languages – Functional n Algorithms can be represented functionally. Functional languages use no assignment or loops. n Algorithm execution is carried out by function evaluation. Example: factorial(n) = if (n = 0) then 1 else n*factorial(n-1) If n >= 0 this returns the factorial of n.

8 School of Computing and Mathematics, University of Huddersfield Programming Languages – Logical n Algorithms can be represented as logic rules and facts. Logic languages use recursive rules to encode ‘loops’. n Algorithm execution is carried out by matching and logical inference. Example: factorial(0,1). factorial(1,1). factiorial(N,M) :- P is N-1, factorial(P,Q), M is N*Q. If N >= 0 this returns the factorial of N.

9 School of Computing and Mathematics, University of Huddersfield Programming Languages – PROLOG n Prolog is a logic language n It is used in research and development applications, in prototyping, and in areas such as language processing and artificial intelligence n It is an INTERPRETED language –you do not need to COMPILE code. You run the Prolog interpreter, load in your Prolog program, and run it. n Prolog programs are lists of facts and rules.

10 School of Computing and Mathematics, University of Huddersfield Summary - Algorithms are detailed, step by step methods for solving problems - We encode algorithms using programming languages - There are thousands of programming languages – most are PROCEDURAL (they include sequences of commands) - There are two other important ways to encode algorithms – functional and logical - Prolog is an important logical language which we will look at for the next few weeks


Download ppt "School of Computing and Mathematics, University of Huddersfield Computing Science: WEEK 17 Announcement: next few weeks… 9 nd Feb: Comparative Programming."

Similar presentations


Ads by Google