By the end of this chapter, you will be able to:
These skills will help you create software that truly fits what users want, making you a valuable programmer in the real world!
Object Oriented Programming (OOP) forms a cornerstone of modern software development, enabling programmers to create modular, reusable, and maintainable code. In the Kenyan software industry, where diverse applications from banking systems to mobile platforms are rapidly evolving, mastering OOP principles is essential for delivering robust solutions. This chapter focuses on applying programming skills by exploring programming language types, criteria for language selection, and practical exercises involving class creation and collaborative development. These competencies prepare software developers to work effectively both individually and in teams, reflecting real-world software engineering practices.
Programming languages provide the tools through which developers translate human logic into instructions a computer can execute. Different languages serve varied purposes, influenced by their design paradigms, syntax, and runtime environments. Understanding language categories equips Kenyan software developers to choose appropriate tools for projects ranging from mobile apps for fintech startups to enterprise resource planning systems for county governments.
Programming languages can be broadly classified into several categories, each with distinct characteristics and typical applications. This classification helps developers understand the strengths and limitations of languages within different domains.
Procedural languages focus on a sequence of instructions or procedures to perform computations. They emphasize a step-by-step approach where the program state changes through variable manipulations and function calls. Examples include C and Pascal. In Kenya, procedural languages are often used in embedded systems and legacy applications within sectors like manufacturing and telecommunications.
Object-oriented languages organize code around objects representing real-world entities, encapsulating data and behaviors. Concepts such as inheritance, polymorphism, and encapsulation promote code reuse and modularity. Java, C++, and C# are prominent examples. Kenyan software firms developing scalable web applications and mobile platforms frequently adopt these languages to manage complexity.
Functional languages treat computation as the evaluation of mathematical functions without mutable state or side effects. This paradigm facilitates easier reasoning and parallel execution, enhancing reliability. Examples include Haskell and Erlang. In Kenya, functional languages find niche use in telecom backend systems and data-intensive applications requiring concurrency.
Scripting languages are interpreted rather than compiled, enabling rapid development and automation of tasks. They are often dynamically typed and used for web development, system administration, and prototyping. Popular scripting languages include Python, JavaScript, and PHP. Many Kenyan startups and SMEs leverage these languages for building websites, APIs, and data analysis tools.
Though not programming languages per se, markup (e.g., HTML, XML) and query languages (e.g., SQL) play critical roles in structuring and accessing data. Software developers must understand these to integrate front-end interfaces and databases effectively.
Choosing the right programming language depends on multiple factors related to project goals, team skills, performance needs, and deployment environments. Kenyan software developers must evaluate these criteria carefully to optimize resource use and deliver quality solutions.
For large-scale enterprise systems, object-oriented languages like Java or C# provide robust frameworks and libraries facilitating modular design. Conversely, simple automation scripts may be better served by Python or Bash scripting due to their concise syntax.
Applications demanding high performance and low latency, such as real-time trading platforms or embedded systems, often require compiled languages like C or C++. For web applications where rapid development is prioritized, interpreted languages like JavaScript are preferred despite slower execution.
A development team’s familiarity with a language directly impacts productivity and code quality. For example, a Kenyan software firm with a team experienced in Python may choose it for a new project to leverage existing skills and minimize training costs.
Target deployment environments influence language choice. Mobile apps for Android typically use Java or Kotlin, while iOS apps require Swift or Objective-C. Cross-platform frameworks may use JavaScript or Dart. Understanding client infrastructure helps developers select compatible languages.
Languages with active communities offer extensive libraries, frameworks, and tools that accelerate development and troubleshooting. For instance, Python’s rich ecosystem supports data science and machine learning projects, which are increasingly relevant in Kenyan tech sectors.
Object-oriented programming revolves around defining classes as blueprints for objects, encapsulating attributes and methods. Writing a simple class and creating its instances illustrate fundamental OOP concepts crucial for Kenyan software developers working on applications such as customer management systems or inventory controls.
A class definition includes properties (attributes) describing the object's state and methods defining its behavior. For example, a Customer class in a banking application might include attributes like customerID, name, and accountBalance, alongside methods for deposit and withdrawal.
public class Customer {
private String customerID;
private String name;
private double accountBalance;
public Customer(String customerID, String name, double accountBalance) {
this.customerID = customerID;
this.name = name;
this.accountBalance = accountBalance;
}
public void deposit(double amount) {
accountBalance += amount;
}
public void withdraw(double amount) {
if (amount <= accountBalance) {
accountBalance -= amount;
} else {
System.out.println("Insufficient balance");
}
}
public double getBalance() {
return accountBalance;
}
}
Creating objects involves invoking the class constructor with specific values. For instance, instantiating a new Customer object:
Customer customer1 = new Customer("C001", "Amina Mwangi", 5000.0);
customer1.deposit(1500.0);
System.out.println("Balance: " + customer1.getBalance());
This instance represents a real customer with an initial balance, demonstrating encapsulation and interaction through methods.
Hands-on practice in defining classes helps Kenyan developers internalize OOP principles, enabling them to build maintainable and scalable software components for sectors like healthcare management or educational platforms.
Collaborative software development is standard in Kenya’s tech industry, where teams divide tasks to increase efficiency. Implementing different classes from a unified design teaches coordination, interface adherence, and integration skills vital for professional development.
A shared design, often documented in UML diagrams or design specifications, outlines the system architecture and class relationships. Team members must thoroughly understand the design to implement their assigned classes correctly.
Each member focuses on a specific class, such as User, Product, or Order in an e-commerce system. This division promotes specialization and parallel progress without overlapping work.
Classes often interact through defined interfaces or method calls. Team members must adhere to agreed method signatures and data formats to ensure seamless integration. For example, the Order class might call methods from the Product class to retrieve pricing information.
Using tools like Git allows teams to manage code versions, resolve conflicts, and maintain a centralized repository. Kenyan software companies increasingly adopt such tools to coordinate development across dispersed teams.
After individual implementations, integrating classes into a cohesive system requires thorough testing to detect interface mismatches or logic errors. Continuous integration practices support early detection and resolution of issues.
Regular team meetings and clear documentation help synchronize efforts, clarify ambiguities, and track progress. These practices reflect professional standards in Kenyan software development firms and foster a culture of accountability.
Create a free account to open more of this chapter.
Free: practical guides, quick cards, workplace scenarios and more.
Create a free accountThis chapter explored various programming language types, highlighting procedural, object-oriented, and functional categories, and discussed how to select a language based on specific user requirements. It then examined common programming paradigms, including imperative and declarative approaches, emphasizing the importance of choosing the right paradigm to suit project needs. The program development life cycle was described with its key stages such as planning, design, and implementation, alongside best practices for adapting these stages to different work contexts. Design tools like algorithms, flowcharts, wireframes, pseudocode, and decision tables were introduced, with guidance on selecting appropriate tools depending on project complexity and user requirements. The chapter also covered program writing tools and integrated development environments, evaluating options like Visual Studio and Eclipse based on system needs and developer preferences. Practical skills were reinforced through activities involving creating simple classes, instantiating objects, and engaging in collaborative projects where team members implement different classes from a shared design. Together, these topics provide a comprehensive foundation for applying computer programming skills effectively.
Which of the following best describes a procedural programming language? (2 marks)
a) Focuses on objects and their interactions
b) Executes instructions sequentially using procedures or routines
c) Emphasizes immutability and pure functions
d) Uses declarative statements to define logic
Identify two key differences between object-oriented and functional programming paradigms. (4 marks)
Type: Individual
| Tools & Equipment | Materials |
|---|---|
| Computer with Windows 7 OS or higher | List of programming languages for classification |
| Installed Java Development Kit (JDK) | Printed classification table template |
| NetBeans or Eclipse IDE | |
| Flash disk or CD RW |
| S/N | Item | Quantity |
|---|---|---|
| 1 | Computer with Windows 7 OS or higher | 1 Pc per Candidate |
| 2 | Installed Java Development Kit (JDK) | 1 Pc per Candidate |
| 3 | NetBeans or Eclipse IDE | 1 Pc per Candidate |
| 4 | Flash disk or CD RW | 1 Pc per Candidate |
| 5 | List of programming languages for classification | 1 Set per Candidate |
| 6 | Printed classification table template | 1 Sheet per Candidate |
| Items to be Evaluated | Marks Available | Marks Obtained | Comments |
|---|---|---|---|
| TASK 1: Identify Programming Language Types | |||
| Candidate reads and understands the list of programming languages (Award 2 marks for correctly identifying all languages) | 2 | ||
| Candidate uses IDE or notes to research language types if unsure (Award 2 marks for effective use of IDE or research) | 2 | ||
| Candidate classifies each language into correct category: Procedural, Object-Oriented, or Functional (Award 1 mark per correctly classified language, total 6 marks) | 6 | ||
| Sub-Total | 10 | ||
| TASK 2: Document Classification Results | |||
| Candidate fills the classification table template neatly and legibly (Award 3 marks for clear and complete documentation) | 3 | ||
| Candidate saves and backs up the completed classification table on flash disk (Award 2 marks for correct saving and backup) | 2 | ||
| Sub-Total | 5 | ||
| PRODUCT CHECKLIST | |||
| Classification table accurately lists languages under correct categories (Procedural, Object-Oriented, Functional) (Award up to 10 marks for accuracy and completeness of classification) | 10 | ||
| Classification table is neat, legible, and properly formatted on A4 sheet (Award up to 5 marks for presentation and formatting) | 5 | ||
| Sub-Total | 15 | ||
| GRAND TOTAL | 30 | ||
Type: Individual
| Tools & Equipment | Materials |
|---|---|
| Computer installed with Windows 10 OS or higher | Flash disk |
| Internet access for research | |
| Office suite software (Word Processor, Spreadsheet) |
| S/N | Item | Quantity |
|---|---|---|
| 1 | Computer installed with Windows 10 OS or higher | 1 Pc per Candidate |
| 2 | Internet access for research | 1 Pc per Candidate |
| 3 | Office suite software (Word Processor, Spreadsheet) | 1 Pc per Candidate |
| 4 | Flash disk | 1 Pc per Candidate |
| Items to be Evaluated | Marks Available | Marks Obtained | Comments |
|---|---|---|---|
| TASK 1: Analyze user requirements | |||
| Identified and listed user requirements clearly (Award 3 marks for clear, complete listing of requirements or 0) | 3 | ||
| Researched programming languages suitable for the requirements (Award 4 marks for thorough research covering at least 3 languages or 0) | 4 | ||
| Evaluated languages against criteria such as performance, ease of use, platform compatibility, and community support (Award 5 marks for detailed evaluation with relevant criteria or 0) | 5 | ||
| Sub-Total | 12 | ||
| TASK 2: Select and justify programming language | |||
| Selected the most appropriate programming language based on analysis (Award 5 marks for a justified, logical selection or 0) | 5 | ||
| Prepared a written report with clear reasoning and supporting facts (Award 6 marks for a well-structured report with justification or 0) | 6 | ||
| Included recommendations for future scalability and maintenance (Award 4 marks for relevant recommendations or 0) | 4 | ||
| Sub-Total | 15 | ||
| TASK 3: Present deliverable | |||
| Formatted report professionally with headings and bullet points (Award 3 marks for professional formatting or 0) | 3 | ||
| Saved and submitted report on flash disk in Word or PDF format (Award 2 marks for correct file format and submission or 0) | 2 | ||
| Sub-Total | 5 | ||
| PRODUCT CHECKLIST | |||
| Report contains all required sections: user requirements, language options, evaluation, selection, justification, and recommendations (Award 8 marks for complete, coherent report or 0) | 8 | ||
| Report length approximately 1000 words (Award 4 marks for meeting length requirement or 0) | 4 | ||
| Report free from spelling and grammatical errors (Award 3 marks for error-free writing or 0) | 3 | ||
| Sub-Total | 15 | ||
| GRAND TOTAL | 47 | ||
At the start of this chapter we promised you would be able to:
Tick each one you can genuinely do.
So, are you there yet?
You're competent when you can confidently do 50% or more of what this chapter promised.
Sign in to record how you're doing.