Primitives, composition, abstraction, and patterns, Python Programming

Assignment Help:

 

Primitives, Composition, Abstraction, and Patterns

 

We will  start  by thinking about  how  the  PCAP  framework applies to computer programs, in general. We may do that by taking in table 3.1, exploring the PCAP concepts in data, functions, and objects.

 

Data

 

The primitive data  items in most programming languages are things  like integer variables, ?oating point values, and  strings. We can use those into data  structures  such as lists, dictionaries, arrays and records. Creating  a data  structure  allows  us,  at the  most  simple  level,  to think  of a type  of primitive data  elements as if it were  one thing,  freeing  us from information.   Sometimes, we just think  of a section  of data,  not  in type  of its relaying representation, but  in terms  of what  it shows.  So, we may think  of a set of functions, or a family  tree, without thinking whether it is an array or a list in its basic representation. Abstract data  types  gives a way  of abstracting away  from representational details  and allowing us to focus on what  the data  really means.

 

 

Procedures

 

The primitive procedures of a language are things  like built-in  numeric operations and  basic list application. We may combine these  using  the facilities of the language, such as if and  while, or by using  procedure composition (f(g(x))).  If we try  to abstract away  from  the details  of how a particular calculation is done,  we can describe  a new  function; de?ning a function allows  us to use it for computational programs without thinking about  the information  of how  those  computational jobs get completed.   You can think  of this  process  as essentially creating a new  primitive, which  we may then  use  while  ignoring the information  of how  it is created.  One  way  to save common patterns of abstraction in method is to abstract over functions themselves, with higher-order methods.

 

Objects

 

Object-oriented programming provides a number of methods of abstraction and  pattern capture in both  data  and  function. At the most  basic level, objects can be used  as files, combining with primitive data  component. More usually, they give strategies for jointly abstracting a data  representation and the procedures that work  on it. The features of polymorphism and inheritance are particularly important.

 

Procedures

Data

Primitives

Means of combination

Means of abstraction

Means of capturing patterns

+, *, ==

if, while, f(g(x))

def

higher-order procedures

numbers, strings

lists, dictionaries, objects

ADTS, classes

Generic functions, inheritance




 

 

 

 

 

 

Table 3.1          Primitives, combination, abstraction, patterns framework for computer programs

 


Related Discussions:- Primitives, composition, abstraction, and patterns

Common Vulnerabilities, 1 Low Level Exploits 1.1 Savegames Jimmy is becomi...

1 Low Level Exploits 1.1 Savegames Jimmy is becoming increasingly frustrated at the computer game hes playing. He has a save right before the levels boss but he needs either more

Python style, Python  Style Software  engineering courses  often  pro...

Python  Style Software  engineering courses  often  provide very  rigid  guidelines on the style of programming, generally the appropriate value of indentation, or what  to us

Re.sub, how to use re.sub to seperate distint words and phrases when transl...

how to use re.sub to seperate distint words and phrases when translating text from English to Spanish or vis versa in python programming

Structured data, Structured data We will often  want  to work  with  l...

Structured data We will often  want  to work  with  large  groups of data.   Rather  than  providing  each  number its own  value,  we need  to manage the data  into natural s

Procedures, In Python, the fundamental abstraction of a computation is as a...

In Python, the fundamental abstraction of a computation is as a procedure (other  books call them "functions" instead; we will end  up  using  both  values).   A function that  tak

Indentation and line breaks, Every programming language has to have  some m...

Every programming language has to have  some method for indicating grouping of operations. Here is how you execute an if-then-else structure in Java:   if (s == 1){ s = s

Particle Movement, Imagine a "particle" located on the centre square of a t...

Imagine a "particle" located on the centre square of a two-dimensional grid of dimensions 11 by 75. The particle can only move one square at a time, either up, down, left, or right

Lists, Python has  a built-in list data  structure that  is easy  to use  a...

Python has  a built-in list data  structure that  is easy  to use  and  incredibly convenient.  So, for that point, you can say >>> y = [1, 2, 3] >>> y[0] 1 >>> y[2]

Algorithm, given number is prime number or not

given number is prime number or not

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd