Assign 1 (Java Program) DIT65896
Assign 1 (Java Program) DIT65896
Programming languages have evolved over time, with each generation introducing
new features and improvements. There are typically five generations of
programming languages:
1) First Generation(Machine Language):
Advantages:
Directly understood by the computer’s hardware
Maximum control over time
Disadvantages
Extremely low-level and hard to program
Not portable between different computer
Examples: Binary machine code, assembly languages.
2) Second Generation (Assembly Language):
Advantages
Easier to understand than machine code.
Closer to human-readable form
Disadvantages
Still tied to specific hard ware architectures.
Labor-intensive and error-prone.
Examples: IBM 360 Assembly, x86 Assembly.
3) Third Generation (High-Level Languages):
Advantages
More abstraction from hardware, making programming easier.
Platform-independent to some extent.
Disadvantages
Require compilers or interpreters.
May sacrifice performance for ease of use.
Examples: FORTRAN, COBOL, C, Pascal.
4) Fourth Generation (Domain-Specific Languages):
Advantages
Designed for specific applications or domains
Rapid applications development
Disadvantages
Limited to specific use cases.
May lack general-purpose capabilities.
Examples: SQL (for databases), MATLAB (for scientific computing)
5) Fifth Generations (Modern Languages and Paradigms):
Advantages
Highly abstracted, emphasizing productivity.
Support for object-oriented, functional and concurrent programming.
Disadvantages
May require a learning curve for programmers.
Overhead due to language complexity.
Examples: Java, Python, JavaScript.
2. Different Programming Approaches
There are several programming approaches that define how problems are solved,
and the common programming approaches includes:
i. Imperative Programming
In imperative programming, the focus is on describing “how” to perform a
task step by step.
It uses statements that change a program’s state by modifying variables or
data structures.
Common imperative language include C, C++ and FORTRAN.
ii. Object-Oriented Programming(OOP)
OOP is based on the concept of objects, which encapsulate data and
behavior.
It promotes the reuse and organizations of code through classes and objects.
Languages like JAVA, C++ and Python support OOP.
iii. Procedural Programming
Procedural programming organizes code into procedures or functions.
It is similar to imperative programming but focuses on grouping related code
into reusable functions.
C and Pascal are examples of procedural languages.
iv. Event-Driven Programming
Event-driven programming responds to events or user interactions, such as
mouse clicks or keyboard input.
It is common in graphical user interface (GUIs) and game development.
JavaScript and Visual Basic are used for Event-driven programming.
v. Logic Programming
Logic Programming is based on formal logic and uses rules to infer
outcomes.
Prolog is a popular logic programming language is used for artificial
intelligence and expert systems.
vi. Scripting Languages
Scripting languages are typically used for automating tasks and have a focus
on simplicity and ease of use.
Examples includes Python, Ruby and Perl.
vii. Low-Level Programming
Low-level programming is necessary for systems programming and working
directly with hardware.
Assembly languages and languages like C are often used.
viii. Aspect-Oriented Programming
AOP allows developers to modularize cross –cutting concerns such as
logging and security.
AspectJ is a common language in AOP.
3. Discuss the various factors that needs to be considered when selecting a
programming.
1) Performance:
Consider the performance requirements of the project. Some
languages are better at handling computationally intensive tasks,
while others excel at I/O operations. Choose a Language that aligns
with performance needs.
2) Development Speed:
Time-to-market is critical in many projects. Some languages are
known for their rapid development capabilities (e.g. Python, Ruby),
while others may require more time (e.g. C++, Rust) due to strict
type checking or manual memory management.
3) Costs:
Consider licensing costs for proprietary languages or development
tools. Open-source languages can be effective but may require
additional support and maintenance.
4) Long-Term Viability:
Ensure that the language you choose has a roadmap for future
development and is not risk of becoming obsolete.
5) Legacy Systems and Integration:
If the project needs to interact with existing legacy system, choose a
language that supports the necessary integration protocols and
libraries.
6) Testing and Debugging
Ensuring that the language supports robust testing and debugging
tools to facilitate code quality assurance.
7) Regulatory and Compliance Requirements:
Some industries and projects must adhere to specific regulations and
compliance standards. Choose a language that helps meet these
requirements.
8) Licensing and Legal considerations:
Understand the licensing terms associated with the language and any
legal implications, especially for the commercial or proprietary
software.
9) Project Requirements
The nature and scope of the project play a significant role in language
selections. Different languages are suited for specific types if projects
such as web development, data analysis or embedded
10) Scalability
If the project is expected to grow over time, choose a language that
supports scalability. Languages with good support for concurrent
programming can handle growing workloads.