From Programming Sequential Machines To Parallel Smart Mobile Devices Bringing Back The Imperative Paradigm To Todays Perspective
From Programming Sequential Machines To Parallel Smart Mobile Devices Bringing Back The Imperative Paradigm To Todays Perspective
Authorized licensed use limited to: Universidad Tecnica Federico Santa Maria. Downloaded on August 16,2023 at 21:40:48 UTC from IEEE Xplore. Restrictions apply.
2013 8th International Conference on Information Technology in Asia (CITA)
dedicated and current paper that will cover the ideas of the 67 (refer to Fig.2 for a chronology of various major PLs
imperative PP and discusses its impact to the development of evolution).The solid edges simply denote that the terms are
current and more advanced PPs, subsequently discussing the synonymous to each other.Although other terms can be
impact of programming approaches to various prior and connected, for simplicity, the given nodes will suffice.
current devices such as parallel smart mobile devices. It will
also discuss the limitations of the imperative PP and how this In a formal form and based on the graph depiction of the
has led to the development of other PPs that are being used definition of PP, (1.1) and (1.2) can give a simple
today. The other contribution of the paper is that it will help representation of the definition of PP.
the reader to link the imperative PP to today’s PPs, and the PP = S = (Ab M) C (1.1)
context of programming devices in general.
Although it is the intention of this paper to give some (i) (1.2)
historical background of the imperative PP, it would give a
more compress background on the matter in order to have a Equation (1.1) states that a PP is a style (S) and the style is
more concise and clear description of the imperative PP itself, created from the invented abstraction (Ab) or the model (M) or
as well as its influence to other PPs and other current devices. both, as well as the class of PLs that influenced it. Since there
If the reader is interested to have a very detail historical are various PLs (up to today) that can influence the
perspective of various other PLs with its PPs, [8] will be a development of various PPs, (1.2) represents this.
good read. As mentioned, an example of a PP is of course the
imperative; the imperative PP (derived from the Latin
II. THE INVENTION OF THE IMPERATIVE PROGRAMMING word,imperare which meansto command[11]), is derived from
PARADIGM AND ITS IMPACT TO OTHER PROGRAMMING the VN model, a model that is based on the stored computer
PARADIGMS concept i.e. an instruction processor or a single sequential
In order to have a good understanding of PP, the model or processor and a data store in memory [12]. The reader would
the abstraction that influences the PP should be understood need to bear in mind that the VN is the implementation of the
first. Once the model or the abstraction has been understood, Turing abstract machine thus the VN’s abstraction is based on
its influence to the PL and its style or way of approaching a the ideas of Turing. Although this model was introduced in the
programming problem can be understood. Since this paper 40s [13], it is still the essential model for today’s
would like to standardize the explanationsthat were given computers.The VN model essentially connects the processor
mostly by [9, 10], and explainthem as precisely as possible, a with the memory via the bus. These components can be used
graph was built to depict the definition of PP; Fig. 1 shows the by 4 basic operations [12] which are read, write, compute and
definition of PP in a graph form. Also, (1.1) and (1.2) show a branch. Each location in the memory can store only one value,
formal logical form, based on the graph depiction of the and this value can only be updated by overwriting it by a
definition of PP. destructive write.
Ab a
With the modelunderstood, the PP can be explained. When
Ab Abstraction
M Model b solving a programming problem using the imperative PP, 3
C Class (of PLs)
A
G C characteristics can be seen[13]:
G Group b
S
V
Style
View
W
M
1. State
T Technique b S 2. Sequential Order
W Way b 3. Assignment Statement
A Approach T
Synonymous V
Influence V
b The term,state, represents the content in each memory cell
V
b the definition of PP
that is available in memory. Since some operations will be
Fig. 1. A graph visualizing
performed on the states, the states will of course change based
on the operation that is being performed on them. Thus, under
Fig. 1. simply states that an abstraction (Ab) or a model the imperative, the states will not change unless the states are
(M) will influence a particular class (C) of PLs. There are being directly assigned. Since the VN originally has one
various PLs that could implement a similar abstraction or processor, the operation to change this state is in sequential
model; the PLs that share the same abstraction or model, which order (note though the concurrent PP can simply make it
subsequently lead to the development of the PLs’ style (S) of seemed that a single processor can run multiple processes;
approaching the problem, can be grouped into a C of PLs,e.g. thisabstraction is known as abstract parallelism[14]). If a
C++, Java and Objective C PLs use the OOstyle of processor wants something done on a particular state,
approaching the problem. Thus, in this case, they are a class of e.g.replacing the old state with a new state, it simply performs
PLs that use the OO style to approach the problem. The style the operation on the state, destroys the old state, and writes
of a particular PP can also influence other different class of back the memory cell with the new value. This operation can
PLs that has a different abstraction(s) or model(s), e.g. be simply represented by the assignment statements in various
procedural influencing OO, hence, why the dotted edges PLs. All of these operations will cause what is known as “side-
(denoting influence) are directless. A self-loop exists in the C effects” to the states, a contrast with the logic and functional
node since some of these PLs can also influence the PP; in the logic PP, once a logic variable is assigned, the
development of the PP e.g. procedural Algol with OO Simula
Authorized licensed use limited to: Universidad Tecnica Federico Santa Maria. Downloaded on August 16,2023 at 21:40:48 UTC from IEEE Xplore. Restrictions apply.
2013 8th International Conference on Information Technology in Asia (CITA)
stateis “unified” and the value cannot be changed, similar to models (or both) which influenced the PLs that implemented
the functional PP[8].Furthermore, with regards to sequence, it, thus, will influence the style of solving the programming
this is of course a striking contrast with the concurrent PP problem.
where multiple threads can run without sequence thus the
programmer would not be able to infer which sequence will go Although that has been said, the previous PPs such as
first unless specified by a special construct. structured, OB, OO, as well as others that are not mentioned
here,do share similarities with the imperative, as well as to
Assuming a simple computation of 1 + 1 is being each other. It is quite obvious without the imperative PP, there
performed by a sequential machine; this can be done will be no states, which is a part of all available PPs (even the
imperatively in assembly language: ones that are not mentioned here). Since the procedural PP is
the closest PP to the imperative, and without procedures, there
mov ax, 0; will be no OB and OO or other PPs that based their styles of
add ax, 1; solving the programming problem using functions e.g.
add ax, 1; functional, declarative, logic, agent, etc.These various other
PPs work simply by abstracting the imperative and use their
This is equivalently represented in a high level language own abstraction(s) and model(s) to create a new approach to
(HLL) based imperative such as C: solve a programming problem. But in the end, the ideas of the
imperative will ultimately operate on these abstractions and
int a = 0; compute the solution for the programmer.
a = 1 + 1;
In an OO PL, this can be represented as: III. DRAWBACKS OF THE IMPERATIVE PROGRAMMING
PARADIGM AND ITS IMPACT TO TODAY’S INCREASINGLY
objectA.set(0); PARALLEL AND MOBILE DEVICES
objectA.add(1, 1); As today’s programmers are focus on other current PP
abstractions, which may leave them unappreciative of the
As the reader is aware, the OO PL codes above will be various PP inventions that came from its forefathers [16, 18-
reverted back to the assembly codes shown once the compiler 20], this section will layout the various drawbacks and
converts it to an assembly and feed it to the assembler. The limitations of the imperative PP, and explain why some of the
style of the PPs does not change the fact that the PPs that are other PPs have been invented. This section will also elaborate
implemented on any HLL will still be converted into a basic the impact of the imperative and other PPs to today’s
low level imperative language.The compiler does not increasingly parallel and smart mobile devices.This section
necessarily concern itself with the notions and design of the will start with limited protection:
PPs unless they have connections with the syntax and A. Limited Protection
semantics of the PL. As stated by[15],“[t]the elementary
The fundamental imperative PP has the least protection
statements of conventional assembly languages areimperative; compared to other PPs. Unlike the OO PP, when solving a
they command that certain computations be performed, or that problem using the imperative PP, the PP does not impose any
data be moved, or that tests be made”. restriction to the manipulation of states or the operations that
The imperative PP does not mainly concern itself with the the programmers have defined.
structural properties of the programming solution that has been int tempNumber = 0129991110;
defined by the programmer or the PL. If the programmer wants
phoneNumber = tempNumber;
the solution to branch off from a middle point R, to a previous
point B, then to Z and then finally reverts back to R, it will still for(int i=0; i=<lengthToComputeEncrypt;i++)
be a part of the imperative PP. However, the removal of this {
very unstructured, “spaghetti-like” way of solving a problem is //some complicated operation to encrypt
known as the structured PP [16]. Furthermore, the imperative //phoneNumber.
does not concern itself with the groupingof states with the }
operations that are related to it, as well giving access only to
the structure that defines it. It also does not concern itself with The imperative codes above show how statesare not being
protected and are prone to accidental manipulation; in this
the generalization of the structure so that other structure(s) can
case, all operations of setting and encrypting the number are
reuse the more generalized structure. This particular way of
exposed.
grouping the states and operations together i.e. objects and
class; hiding the states away from other states and Phone objectA = new Phone();
operationsi.e. encapsulation; generalization of structure so objectA.setPhoneNumber(0129991110);
other structure can reuse it i.e. inheritance, are a part of a objectA.encryptPhoneNumber();
higher level programming style, famously known as the OO
PP.Some would consider the removal of inheritance as the The OO codes above show how a properly encapsulated
Object-Based PP (OB)[17]. These other ways of solving the object can protect a particular state by any accidental
problem is a part of their own respective abstractions or manipulation, as well as giving a cohesive object definition.
Authorized licensed use limited to: Universidad Tecnica Federico Santa Maria. Downloaded on August 16,2023 at 21:40:48 UTC from IEEE Xplore. Restrictions apply.
2013 8th International Conference on Information Technology in Asia (CITA)
Authorized licensed use limited to: Universidad Tecnica Federico Santa Maria. Downloaded on August 16,2023 at 21:40:48 UTC from IEEE Xplore. Restrictions apply.
2013 8th International Conference on Information Technology in Asia (CITA)
the structured PP was that by removing the go-to statement, intelligent programming e.g. agent PP via JADE. C and C++
expressive power is lost[22]. As indicated by Liskov, the go-to are also used in the high-performance community with its
statement alone can simulate various abstraction mechanisms ability to access low level PL constructs and to support parallel
e.g. case statements, exception handling, loop, etc.It is computations. However, these important PLs also share a
undeniable that the go-to statements are still usable (and common, yet interesting ancestry; they were derived from the
nonremovable), however, the price of using these statements is same PL which is the imperative Fortran PL[17]; this is
that programmers may end up getting errors and readability depicted in Fig. 2. Thus, it is not surprising that a (mobile)
issues whilst developing their programs as stated before. programmer that uses these PLs can simply remove PPs that
have been piled on top of the imperative and simply solve the
It may seem to this point that the imperative PP may have problem imperatively. The evolution of various PLs has been
too many limitations to even be (re)considered as an outlined by [17]; this is shown on Fig. 2.
implementation language for today’s increasingly parallel and
mobile development. Thus, the question of escaping this
particular PP from today’s mobile development would be a
good perspective to look into. The next section will discuss
whether the imperative is still important in today’s context.
Authorized licensed use limited to: Universidad Tecnica Federico Santa Maria. Downloaded on August 16,2023 at 21:40:48 UTC from IEEE Xplore. Restrictions apply.
2013 8th International Conference on Information Technology in Asia (CITA)
where the latterwas promotedunder the theme “write once run program. If the industries are unwilling to support these pure
everywhere” and the boom of web and GUI based applications, PLs, then it is very unlikely that the academia will teach their
the PP was finally visible to the development world. Although programming students these pure PLs. Reports of students’
originally was used for simulation purposes, the OO PP dissatisfaction of PL courses offered by the universities can be
promotes reusability from its class development, inheritance found on [24] where students wanted PLs that can get them a
and polymorphic mechanism and object creation.With these job. It seems that the students are uninterested to know the
properties, developers such as concurrent mobile developers underlying theory of the PLs which could have helped them
can (re)use codes with ease and reduced application learn other PLs more effectively.
development time. Putting focus on OO Java as a PL for
mobile development, Java provides the J2ME platform that is Proper software engineering procedures and doctrines have
rich with various classes for developing mobile applications, also imposed various standards to ensure that programmers
and considering J2ME supports the OO PP, reusability is follow the engineering process properly. From the analysis to
increased further compared to the imperative PP. However, the testing phase, each of these steps was (re)design to support
Java is a hybrid PL, thus imperative programmers can still the particular selected PP(s) during the development process. If
program imperatively using Java if they choose to do so. the programmer deviates from the selected PP(s), the
development process itself may start to collapse and this will
Concurrent PP exploits the ideal time of the (single) cost the developers and higher management not only the
processor and the OS clever ways of scheduling processes and increase cost of money, but also the increase cost of time,
threads that are waiting for IOs and blocking/unblocking effort, planning, etc.;this has been similarly discussed in
procedures. Thus, it is not necessarily that this particular PP [2].However, even though software engineering procedures
should be used in an actual parallel environment i.e. multi and doctrines have imposed itself with other various PPs, the
processors/cores. Although C, C++, C#, Objective-C and Java imperative is still needed in order to understand the basis of the
can use the concurrent PP with the imperative PP, the machine and how it performs basic operations.
combination could be fatal if the structured PP is not imposed.
One of the difficulties of concurrent PP is that the sequence of Although the need to understand the imperative PP has
thread executions can be difficult to trace, thus debugging is a been explained, the types of problems that would occur to the
massive overhead for concurrent/multithreaded applications, programmers, specifically during the transition from the
even by today’s standard. If the imperative is largely used in imperative to other PPs or vice versa, will be explored. The
concurrent/multithreaded application where jumps are allowed next section will explain this.
in any parts of the program statements, this will cause even
further debugging problems. As mentioned, the structured PP V. THE PROBLEMS OF THE SHIFT TO VARIOUS PROGRAMMING
will be a good choice if the concurrent mobile programmer is PARADIGMS
still insistent to use the go-to statement with the concurrent PP. The shift of PPs is simply defined as the switch to the next
Since processors are getting smaller and cheaper (as well as sequence of PP(s)[25]. From the cited work, one of the
hotter), cores were developed to exploit this[23]. With the problems of the shift of PPs occurs when the programmer is
invention of cores, parallel programming is being pushed to unable to understand the next sequence of PP(s) and is trapped
popularity. Since the cost of manufacturing these cores is in the dogma of the old PPs. If this is happening to industrial
decreasing, these parallel programs and devices are within programmers, then the PL that supports the intended PP cannot
reached of the current mass-consumers as well being exploited be used in its full potential and could impede the development
by the mass-manufactures e.g. dual-core smart mobile devices process, as has been discussed prior.
such as the iPhone, affordable netbooks with various cores, Since most programmers are being trained in the
affordable tablets, e-readers that support high-end graphics, institutions of higher learning, their ability to comprehend the
etc. This is of course pale in comparison during the early days various PPs and its PLs can be traced back to these institutions.
of smart mobile devices where a single processor alone will Unfortunately, it has been reported by several authors that
incur high cost to the devices. However, not all parts of the educators seemed to focus on the syntax and semantics of the
codes need to be parallelized. Selection of appropriate code PLs alone and abandoned the PPs[26]. If these future
sections e.g. loop, arrays, etc., is needed in order to exploit the programmers cannot use the PP(s) properly, then the software
ideas of parallel computation. Certain operations still need crisis might be in a self-loop and the problems of the
sequential operations e.g. thread A needs to complete its development world will never be solved. It is not helping as
operation before thread B, C and D execute, which can be well when the OO academic textbooks are a rewrite of an
implemented in Java’s join() procedure. States need to be earlier procedural approach[4, 5]. If the current programming
carefully protected or operated e.g. thread A needs to be aware students are unable to appreciate or even understand the
of the operation being performed in threads B and C, which various available or perhaps, established PPs, then this has
can be implemented using the synchronize and volatile defeated the purpose of having various PP courses which have
keywords in Java’s concurrent environment. Thus, the ideas of been offered by the institution of higher learning. As
imperative e.g. states and sequential ordering, are still within mentioned by the ACM/IEEE curriculum [27], it is necessary
the reached even in a parallel environment. that Computer Science students learn various PPs in order to
Although there are pure PLs that support a single PP, some approach the problem effectively.The PPs that are considered
of these PLs are not popular to the industries. Some industries the main PPs are imperative, functional, logic and OO [10, 13].
would prefer to use PLs that their programmers know how to
Authorized licensed use limited to: Universidad Tecnica Federico Santa Maria. Downloaded on August 16,2023 at 21:40:48 UTC from IEEE Xplore. Restrictions apply.
2013 8th International Conference on Information Technology in Asia (CITA)
Finally, as reported by [25], most of the surveyed [9] B. Hailpern, "Guest Editor's Introduction Multiparadigm Languages
experienced programmers agreed that PPs are important in and Environments," Software, IEEE, vol. 3, pp. 6-9, 1986.
[10] E. Bolshakova, "Programming Paradigms in Computer Science
order to work in the industry. If the future programmers are Education," International Journal Information Theories & Applications
unable to comprehend the PPs, then they will be lacking the vol. 12, pp. 285-290, 2005.
necessary skills needed by their future employers to solve [11] D. A. Watt, Programming language concepts and paradigms: Prentice
various programming problem, as well as having difficulties Hall, 1990.
adapting to new popular environments that require different [12] B. N. Freeman-Benson and A. Borning, "The design and
implementation of Kaleidoscope'90-A constraint imperative
paradigms to approach the problem. programming language," in Computer Languages, 1992., Proceedings
of the 1992 International Conference on, 1992, pp. 174-180.
VI. CONCLUSION [13] M. Vujosevic-Janicic and D. Tosic, "The Role of Programming
Paradigms in the First Programming Courses," The Teaching of
The imperative PP is one of the fundamental PPs that has Mathematics vol. XI, pp. 63, 2008.
been abstracted by various current popularPPs in the current [14] M. Ben, Principles of concurrent and distributed programming, second
development world. edition: Addison-Wesley, 2006.
[15] B. Raphael, "The structure of programming languages," Commun.
In order to appreciate devices such as parallel smart mobile ACM, vol. 9, pp. 67-71, 1966.
devices or large system software such as an OS, thisparticular [16] E. W. Dijkstra, "Letters to the editor: go to statement considered
fundamental PP is still important in order to appreciate the harmful," Commun. ACM, vol. 11, pp. 147-148, 1968.
power of abstractions and how it can lead to the development [17] L. F. Capretz, "A brief history of the object-oriented approach,"
SIGSOFT Softw. Eng. Notes, vol. 28, pp. 6, 2003.
or innovation of other PPs and program development in [18] B. Liskov and S. Zilles, "Programming with abstract data types,"
general. SIGPLAN Not., vol. 9, pp. 50-59, 1974.
[19] J. James H. Morris, "Protection in programming languages," Commun.
Although it is clear that the imperative PP has its ACM, vol. 16, pp. 15-21, 1973.
drawbacks, influential and popular imperatively extended PLs [20] O.-J. Dahl and C. A. R. Hoare, "Chapter III: Hierarchical program
such as C, C++, C#, Java and others that are using current structures," in Structured programming, O. J. Dahl, E. W. Dijkstra, and
established PPs such as the OO PP, are still used in the current C. A. R. Hoare, Eds., ed: Academic Press Ltd., 1972, pp. 175-220.
parallel and mobile development world. Thus, the need to [21] W. Wulf and M. Shaw, "Global variable considered harmful,"
SIGPLAN Not., vol. 8, pp. 28-34, 1973.
understand the immediate impact of the imperative PP to other [22] B. Liskov, "Grace Hopper Celebration of Women in Computing -
PPs and its PLs is important in order to understand how these Keynote Speech ", 2010.
various modern abstractions could support today’s increasingly [23] M. Mehrara, T. Jablin, D. Upton, D. August, K. Hazelwood, and S.
parallel and mobile devices. Mahlke, "Multicore compilation strategies and challenges," Signal
Processing Magazine, IEEE, vol. 26, pp. 55-63, 2009.
Lastly, since the VN model is still used today, the [24] S. Reges, "Marketing the programming languages course," SIGPLAN
imperative PP still has its influenced to other PLs and PPs that Not., vol. 43, pp. 104-107, 2008.
have evolved from the VN model. [25] D. A. Z. Zuhud, N. Abdul Rahman, and M. Ismail, "A preliminary
analysis on the shift of programming paradigms," in Information and
Communication Technology for the Muslim World (ICT4M), 2013 5th
ACKNOWLEDGEMENT International Conference on, 2013, pp. 1-5.
[26] Y. Stolin and O. Hazzan, "Students' understanding of computer science
This research has been supported by Universiti Teknologi soft ideas: the case of programming paradigm," SIGCSE Bull., vol. 39,
MARA and the Malaysian Government. pp. 65-69, 2007.
[27] ACM/IEEE-CS, "Computer Science Curriculum 2008: An Interim
REFERENCES Revision of CS 2001. Report from the Interim Review Task Force
includes update of the CS2001 body of knowledge plus commentary. ,"
[1] Unconventional Programming Paradigms. Revised Selected and Invited 2008.
Papers of the International Workshop UPP 2004, Le Mont-Saint-
Michel, France: Springer-Verlag, LNCS, vol. 3566, 2005.
[2] S. J. Nielson and C. D. Nutson, "OO++: Exploring the Multiparadigm
Shift.," in Proceedings of the Workshop on Multiparadigm
Programming with Object-Oriented Languages (MPOOL 2004), 2004.
[3] J. Philip R. Ventura, "On the origins of programmers: identifying
predictors of success for an objects first cs1," Ph.D. Dissertation, State
University of New York at Buffalo, 2004.
[4] R. Duke, E. Salzman, J. Burmeister, J. Poon, and L. Murray, "Teaching
programming to beginners-choosing the language is just the first step,"
in Proceedings of the Australasian conference on Computing education,
2000, pp. 79-86.
[5] W. Campbell and E. Bolker, "Teaching programming by immersion,
reading and writing," in Frontiers in Education, 2002. FIE 2002. 32nd
Annual, 2002, pp. T4G-23-T4G-28, vol.1.
[6] P. J. Burton and R. E. Bruhn, "Teaching programming in the OOP era,"
SIGCSE Bull., vol. 35, pp. 111-114, 2003.
[7] S. Reges, "Back to basics in CS1 and CS2," presented at the
Proceedings of the 37th SIGCSE technical symposium on Computer
science education, Houston, Texas, USA, 2006.
[8] A. Lovrenčić, M. Konecki, and T. Orehovački, "1957-2007: 50 Years
of Higher Order Programming Languages," Journal of Information and
Organizational Sciences, vol. 33, pp. 79-150, 2009-06-06 2009.
Authorized licensed use limited to: Universidad Tecnica Federico Santa Maria. Downloaded on August 16,2023 at 21:40:48 UTC from IEEE Xplore. Restrictions apply.