This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes OO, Patterns, UML and Refactoring and the fly likes Maths behind Programming Languages Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Bookmark "Maths behind Programming Languages" Watch "Maths behind Programming Languages" New topic
Author

Maths behind Programming Languages

Padmarag Lokhande
Ranch Hand

Joined: May 29, 2008
Posts: 93
Hi all,
I have tried googling but could not find an answer to this question.

Relational Databases are based on Relational Algebra.
Do programming languages have any such Mathematical concepts behind them? I know about the formal languages but besides that-
e.g.,Does OOP have any mathematical basis?
[ July 09, 2008: Message edited by: Padmarag Lokhande ]

- Padmarag Lokhande
SCJP5 - http://blog.padmarag.com
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
As far as I know, there is no such basis for OOP.


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

Perhaps you could stretch a bit and say that set theory is relevant, especially in a language with multiple inheritance.


[Jess in Action][AskingGoodQuestions]
K. Tsang
Bartender

Joined: Sep 13, 2007
Posts: 2563
    
    9

This is like asking why does Computer Science undergraduates "must" study discrete math and maybe calculus to balance things out?

Set theory stuff is indeed part of discrete math, along with graph theory, logic etc. Even the a for loop require math especially outputting complex stuff with collections say, which sometime does make me loose count of the index.


K. Tsang JavaRanch SCJP5 SCJD/OCM-JD OCPJP7 OCPWCD5 OCPBCD5
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
I think the point is that there is no mathematical model for how OO languages work in principle - that is, there is no mathematical model behind the principles of inheritance, polymorphism etc. As a consequence, you can't really apply mathematical theorems to reason about the correctness of your OO code.

This is quite different for other programming languages such as Prolog and many functional programming languages, which have a very strong mathematical foundation.
Eric Nielsen
Ranch Hand

Joined: Dec 14, 2004
Posts: 194
Well most of the formal studies of type systems (which form the basis for inheritance systems) do get to the level of formal proofs. The LSP for instance came out of this kind of analysis...
Jimmy Clark
Ranch Hand

Joined: Apr 16, 2008
Posts: 2187
Does OOP have any mathematical basis?


OOP = object-oriented programming.

"object-oriented" is an adjective that is used to describe the "style" of the programming. It is a design concept. There can be good designs, bad designs, and very bad designs. There are no mathematical principles that can verify if a design is good or better or worse.

Is red a "better" color than orange?
Rakesh Chaudhary
Ranch Hand

Joined: Feb 19, 2008
Posts: 120
I think it does ...

Because if you try to design oops examples using UML than it brings on the mathematical concept of flow charting....

Tell me if I am right...
thanks


Acquire the unexpected.......
Preparing for SCJP 6
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42371
    
  64
To me, flow charts are a device to visualize something. I don't know that it's got much to do with maths, or that there is a theory behind them.


Ping & DNS - my free Android networking tools app
K. Tsang
Bartender

Joined: Sep 13, 2007
Posts: 2563
    
    9

UML or flow charts don't have any math involved. But it does require logic of how the intended program should work (or flow), which is common sense for the person who designs the program.
 
Consider Paul's rocket mass heater.
 
subject: Maths behind Programming Languages