Computer Science

Programming Paradigms

Programming paradigms refer to the different approaches and styles for writing computer programs. They provide a set of principles and guidelines for structuring code and solving problems. Common paradigms include procedural, object-oriented, functional, and declarative programming, each with its own unique characteristics and best use cases. Understanding and applying these paradigms can help developers choose the most suitable approach for a given task.

Written by Perlego with AI-assistance

5 Key excerpts on "Programming Paradigms"

  • The JavaScript Workshop
    eBook - ePub

    The JavaScript Workshop

    A New, Interactive Approach to Learning JavaScript

    • Joseph Labrecque, Jahred Love, Daniel Rosenbaum, Nick Turner, Gaurav Mehla, Alonzo L. Hosford, Florian Sloot, Philip Kirkbride(Authors)
    • 2019(Publication Date)
    • Packt Publishing
      (Publisher)
    There will be teachers, clerks, students, heads of departments, and so on. One way of implementing this project is to write the logic for each of these entities separately, which is not a scalable option, and it will not be a flexible solution either. Another way is to use the OOP approach, in which we will create one Person model that will hold a person's designations as keys in the object. This way, we are separating people from their designations. We can easily implement changes in either Person or entities, that is, heads, teachers, students, and so on. All the changes to Person will automatically be implemented on entities because they belong to the Person class. There are a lot of other approaches that we can use to solve the same types of problems. We will go through some of them in this chapter. After that, you will learn what prototypes are and how to use them to achieve inheritance. There are a lot of other basics as well. Let's start. JavaScript Paradigms A programming paradigm is a way or method in which we write code to solve different types of problems. Since there are a lot of ways to code, there are a lot of Programming Paradigms that developers use to write code. JavaScript is a multi-paradigm scripting language, which means that it is very dynamic in nature and supports various types of programming styles, such as object-oriented, imperative, and functional programming. In this book, we will discuss the three main Programming Paradigms that are popular among developers. We can divide Programming Paradigms into two categories: Imperative, which includes Procedural Programming and OOP Declarative, which includes Functional Programming In this chapter, we will discuss procedural and object-oriented programming
  • Software Development in Practice
    Programming languages can be categorised in several different ways. A popular approach is to consider their paradigms – their style or way of doing something. Common paradigms include:
    • Procedural: solves problems in an algorithmic way, with the code typically broken down into procedures (e.g. functions).
    • Object-oriented: models the real world, creating encapsulated classes which interact with others to create solutions.
    • Declarative: defines what is needed but not how this is to be achieved.
    • Functional: solves problems using stateless functional components.
    • Event-driven: captures system or user events and writes suitable handlers to deal with them.
    This list is not exhaustive: many different variations and combinations exist. Broadly speaking, programming languages tend to get (rightly or wrongly) pigeonholed into a single paradigm, for example:
    • C is procedural.
    • C++ and Java are object-oriented.
    • Prolog is declarative.
    • Visual Basic .NET is event-driven.
    However, the distinction is not always clear-cut. For instance, Java also supports a user’s interaction with an object, such as clicking a button; this is a classic trait of an event-driven feature. Python, a very popular language at the time of writing, supports procedural, object-oriented and functional Programming Paradigms.
    Fortunately, many development tools (editors, compilers, debuggers, etc.) are freely downloadable, offering the fledgling programmer many opportunities to learn new skills and experience different approaches to problem-solving prior to gaining employment and working on commercial projects. The key question is: which programming languages should you focus on?
    The simple (if obvious) answer is: the ones that are in commercial demand. After all, you want to start a successful and financially rewarding career as a programmer, don’t you?
  • Learn C Programming from Scratch
    eBook - ePub

    Learn C Programming from Scratch

    A step-by-step methodology with problem solving approach (English Edition)

    The objective of this chapter is to provide a comprehensive understanding of programming methodology, emphasizing the use of computers as problem-solving tools. It explores the concepts of computers and computing, delves into the components and functioning of computer systems, and explores various programming styles. The chapter aims to develop a solid foundation in algorithms, their design, and implementation. Additionally, it covers the use of flowcharts as visual tools for algorithm representation and analysis. By the end of the chapter, readers will have gained a deep knowledge of programming principles, problem-solving techniques, and effective use of computers in solving real-world challenges.
    Programming methodology
    Programming methodology refers to the systematic approach and techniques used in software development. It provides a framework for software engineers to follow while designing, coding, testing, and maintaining software applications.
    A computer program is a set of related commands or instructions to solve a given computer problem. Programming is the process of conceptualizing and subsequently writing a computer program that is executed to produce the desired result. Programming involves conceptualizing and writing a program, compiling the program, executing the program, and debugging the program. A computer program aims to solve real-life problems ranging from simple to more complex ones. Programming methodology is the method to analyze real-life complex problems, provide software solutions, and control the associated activities of the software development process. Some popular programming methodologies include:
    • Waterfall methodology : This is a sequential software development model that follows a set of steps in a linear fashion, each step building upon the previous one.
    • Agile methodology : This iterative approach to software development emphasizes collaboration between developers and stakeholders, flexible planning, and adaptive delivery.
    • Scrum methodology
  • Object-Oriented Programming Languages and Event-Driven Programming
    In spite of its problems, a programmer with the right goals and attitudes can make very good use of a declarative language. Like the other paradigms we have discussed in this section, it will be a significant force in the programming language field for the foreseeable future, and a programmer having no familiarity with it may pass up the chance at finding elegant and useful solutions to some common problems. Moreover, a familiarity with this paradigm will educate the programmer to a way of thinking about relationships which will enrich the solution space no matter what programming tools are available.
    1.3  RELEVANT PROGRAMMING LANGUAGE CONCEPTS
     
    We review in this section some of the concepts to which the student should have been exposed in previous courses, but for which the instruction may not have been explicit or may have been specifically targeted for one language and/or environment. We will attempt to give a broader and more explicit introduction to these topics. We begin with the most fundamental, and perhaps the most important, term in this text.
    1.3.1  Abstraction
    Computer Science shares with Mathematics a preoccupation with the process of creating and defining the properties of abstractions. But abstraction is not solely the domain of those two fields of study; it lies at the core of all intellectual endeavors. At the most fundamental level, an abstraction is a scheme for substituting symbols (and sometimes also a set of artificially defined rules for manipulating those symbols) for objects or concepts. We say that the objects or concepts come from a semantic domain, a concrete or abstract domain from which a person selects the meaning of the abstraction.  
    To the person creating an abstraction, the denizens of the semantic domain are usually considered to exist in a way which is to some extent independent of that person's creative input, and may in fact be only partially understood by him. The intention in defining the abstraction is to rigidly specify the properties and rules for manipulating the abstraction in ways totally understood by the creator, properties and manipulations that are at least analogous to the properties and behaviors of the semantic counterpart. The hope is that by analyzing the properties or performing the manipulations, conclusions may be reached, or work may be accomplished, and that the conclusions will be relevant or the work will be of benefit to those who have an interest in the semantic domain.  
  • AI Factory
    eBook - ePub

    AI Factory

    Theories, Applications and Case Studies

    • Ramin Karim, Diego Galar, Uday Kumar(Authors)
    • 2023(Publication Date)
    • CRC Press
      (Publisher)
    With the evolution of the term “software engineering”, a number of software development paradigms came into existence. These traditional software engineering models can be categorised into three broad categories:
    • Classical lifecycle development paradigms,
    • Incremental development paradigms, and
    • Evolutionary development paradigms.
    Each of these paradigms has a finite set of development steps starting with requirement-gathering and progressing through to deployment. Traditional software engineering paradigms and their three categories are shown in Figure 8.3 and discussed below (Tiwari & Kumar, 2020 ).
    FIGURE 8.3 Traditional software engineering paradigms (Tiwari & Kumar, 2020).
    8.5.1.1 Classical Lifecycle Development Paradigms
    These very early software development paradigms came into existence in the 1960s. Their development phases are based on the development lifecycle of systems in general (Tiwari & Kumar, 2020 ). An example of a classical lifecycle paradigm is the basic waterfall paradigm.
    8.5.1.1.1 Basic Waterfall Development Paradigm
    Basic waterfall was one of the first paradigms showing development as a defined and disciplined process. In this linear development paradigm, the accomplishment of one phase is followed by the start of the next. It is an organised, step-by-step engineering software process, not considering changes in requirements, the possibility of enhancements, or feedback from customers.
    Basic waterfall’s orderly chronological approach starts with a requirements analysis and then moves through design, implementation, testing, deployment, and finally reaches maintenance. This process is shown in Figure 8.4 (Tiwari & Kumar, 2020 ).
    FIGURE 8.4 Basic waterfall development paradigm (Tiwari & Kumar, 2020 ).
    8.5.1.2 Incremental Development Paradigms
    Incremental development paradigms have some attributes of the basic waterfall paradigm in that the development phases are sequential. However, changes can occur throughout development (Tiwari & Kumar, 2020
Index pages curate the most relevant extracts from our library of academic textbooks. They’ve been created using an in-house natural language model (NLM), each adding context and meaning to key research topics.