1 A Comparative Study of Java and R Programming Language. Student’s name: Institutional affiliation: Instructor’s name: Date: 2 1.0 Introduction With the growing growth of the software sector, an increasing number of people are interested in learning programming languages. However, while there are over 200 programming languages accessible today, only a few of them are extensively used (Shinn et al., 2021). The study of programming languages was carried out in this thesis. The objectives of study are two of the most popular programming languages, R and Java. The technical aspects of these two programming languages for solving the Fischer Random Chess Initial Chessboard Configuration Generation are outlined and contrasted (mathbits, 2010). The experiment's outcome was documented and assessed. 1.1 Fischer Random Chess Fischer random chess, often known as Chess960, is a chess variant created by way of former World Chess Champion Bobby Fischer. On June 19, 1996, Fischer made this adjustment in Buenos Aires, Argentina. Fischer random chess uses the same board and pieces as traditional chess, but the initial function of the pieces at the players' domestic rankings is randomized according to certain rules (Marwick et al., 2018). The random configuration makes it impossible to receive a benefit by memorizing openings; instead, players must rely on their skill and ingenuity throughout the board. Shuffle chess has long been used to randomize the first sections, but Fischer random chess adds new regulations for the first random setup, "maintaining the dynamic aspect of the sport by preserving bishops of opposing colors for each player and the right to fort for both sides." As a result, there are 960 distinct possible starting locations (mathbits, 2010). 3 FIDE added Chess960 to the Laws of Chess as an appendix in 2008. The FIDE World Fischer Random Chess Championship 2019, the first worldwide championship fully sanctioned by FIDE, gave the variation even more attention (Programming, 2017). 1.2 Imperative And Non-Imperative Programming In science, imperative programming is defined as "a programming paradigm that expresses processing in terms of statements that alternate over an application nation" (Thieme, 2018). Imperative packages are a set of instructions for the computer to follow. This is in contrast to declarative, which communicates what this system should do without dictating how to achieve it in terms of movement sequences to be taken. Practical and logical programming may favor the non-essential programming language. A natural practical language like Haskell contains country changes that are best expressed as capabilities that change the country (Foss, 2015). 1.3 Java Java is a high-level, class-based, object-oriented programming language with few implementation requirements. It is a general-purpose programming language that allows programmers to write once and run anywhere (WORA), which implies that compiled Java code may run on any Java-enabled machine without the need to recompile. Java programs are often compiled to byte code that can run on any Java virtual machine (JVM), regardless of the underlying computer architecture. Java's grammar is similar to that of C and C++, but it contains fewer low-stage centers than both (Programming, 2017). The Java runtime provides dynamic features (such as mirrored images and runtime code change) that are typically not available in traditional compiled languages. 4 Sun Microsystems' Java platform was launched in May 1995 with the creation of Java by Sun Microsystems' James Gosling. Under private licensing, Sun originally distributed the unique and reference implementation Java compilers, virtual machines, and advanced libraries. As of May 2007, Sun have relicensed much of its Java technology under the GPL-2.0-best license, as required by the Java Community Process. The Open JDK JVM is a free open-source software program that is widely used by developers and is the default JVM for almost all Linux distributions. Although Oracle has its own Java Virtual Machine, the Open JDK JVM is the most reliable reference implementation (Tiobe, 2011). As of March 2022, Java 18 is the current version, whereas Java 11, 8, and 18 are the current long-term support (LTS) versions. Oracle released the final free public replace for the legacy model Java 18 LTS in January 2019 for commercial use, while it will continue to support Java 8 via public updates for non-public usage indefinitely. Other providers have begun to give no-cost builds of Opened eight and eleven that are still receiving security and other updates. 1.4 R software The R Core Team and the R Foundation for Statistical Computation promote R, a programming language for statistical computing and photography. R was developed by statisticians Ross Ihaka and Robert Gentleman and is used by data miners, bio technicians, and statisticians for data analysis and statistical software development. Users have written programs to extend the capabilities of the R programming language (Tiobe, 2011). 5 R is one of the most often used programming languages in data mining, according to consumer surveys and analysis of scientific literature databases. R is ranked tenth in the TIOBE index, a measure of programming language popularity, as of March 2022. 2. Analysis A programming paradigm is an technique to resolve troubles the use of a few programming language or additionally we are able to say it's miles a technique to resolve a trouble the use of equipment and strategies which can be to be had to us following a few technique. There are masses of programming languages which can be recognized however they all want to observe a few methods while they're applied and this methodology/method is paradigms. Apart from styles of programming languages, there are masses of paradigms to meet every and each demand. Figure 1: Difference in programming paradigms Source: (Tiobe, 2011) Because the call shows is a type of programming paradigm that explains how this system runs, Java is an Imperative Programming language. Developers are more 6 concerned with the process of obtaining a solution step by step. It can hold a large number of command imperatives. The order of execution is crucial in this case, as it makes use of both mutable and immutable data. The programming languages Fortran, C, and C++ are all instances of essential programming. As the name implies, R is a Declarative Programming language. It's a programming paradigm that specifies which packages should be run. Developers are particularly invested in the solution that is provided. It declares what kind of outcomes we want and focuses on really defining how to achieve them rather than programming languages. In simple terms, it makes a specialty of giving away results. It expresses the computation's excellent judgment. Other well-known declarative programming languages include Miranda, Erlang, Haskell, and Prolog (Tiobe, 2011). After learning the principles of each language, we'll discuss the significant differences between these various types of programming. Java Vs. R Software. Complete abstraction based on OO principles R does not provide support for Object-Oriented Concepts. It requires an extension to put those notions into action. However, there may be a straightforward implementation of such principles in Java (Foldoc, 2022). Reflection Java appears to have a better mirrored image technique than R. Although R has libraries for dynamics, they do not yet provide complete mirrored picture. In contrast, Perl features right-mirrored image techniques (Eckel, 2006). 7 Functional programming Though Java provides some support for functional programming through the use of references and closures, R is developed as a functional language and is therefore better for functional programming than Java. Declarative programming As previously stated, there are several impediments to Declarative / Logic programming in Java. However, libraries may be used to achieve Declarative/Logic programming in R. As a result, R is an excellent choice for Declarative Programming. UI design prototype As previously stated, both R and Java offer extensive libraries for creating GUI applications. I've just shown the outline of one library for each Java and R, but there are many more UIs that each programming language provides. Advantages of JAVA It's the easiest programming style to analyze and comprehend, which is why it's the most commonly taught (Eckel, 2006). Debugging a critical application is also easier since you have complete control over all steps: tell this system what you want and how to achieve it. The main advantage of crucial programming is that you can control the system's complexity. So, as shown in the following graph, we may try to reduce it as much as possible in order to improve its performance. Disadvantages of JAVA 8 However, there are drawbacks to essential programming. It is largely reliant wholly on the order of this system, making it difficult to design in certain circumstances and necessitating additional code to carry out simple activities. As a result, for more intricate systems, the code may quickly become voluminous and lose its readability due to its size (Anon, 2022). When modifying code to add features or improve it, for example, the risk of making mistakes is significant. We outline what to accomplish and how to acquire it using crucial programming. As a result, all of the levels of this system must be specified. Advantages of R Declarative programming languages help developers working on big, feature-rich projects increase their productivity and code efficiency. Declarative languages have a function-primarily based structure that eliminates the need to write and maintain a large number of lines of teaching code (Anon, 2017). In addition, the following are some of the additional advantages of declarative programming: Declarative code is simple to understand since it specifies what the system should do rather than describing how it should accomplish it. The declarative method reduces data mutability, which enhances application security since immutable data systems are less prone to errors in many circumstances. Although declarative features are often reusable and shareable, builders retain the ability to implement new approaches as needed. Disadvantages of R 9 Of course, the declarative method affords its very own set of challenges. Here are a number of the maximum super boundaries that builders confront: Declarative programming calls for a positive diploma of familiarity with summary theoretical programming models, which now no longer all builders have. Despite the capacity for reusability, man or woman builders who need to customize that sharable code might also additionally want to carry out sizable rewrites (Anon, 2017). In the occasion of an error, the anomaly of manage float inside the code could make it hard to decide what particular moves an utility done without near exam of particular utility logs. IMPERATIVE DECLARATIVE JAVA R SOFTWARE Programs define how to accomplish this. Programs indicate what should be done in this case. Java merely describes the computation's R just explains the computing logic. control flow. Its primary purpose is to explain how to R primary purpose is to convey the desired get or complete it. outcome without giving specific instructions on how to achieve it. Its benefits include simplicity of learning Its benefits include effective code that can and reading, a simple conceptual model, be applied in a variety of ways, easy and so on. expansion, and a high degree of abstraction, among others. Procedural programming, object-oriented Logic programming and functional programming, and parallel processing are programming are two types of it. examples of its types. 10 The user can make judgments and give A compiler is authorized to make orders to the compiler in this mode. judgments in this case. In comparison to declarative When compared to imperative programming, it brings many errors and programming, it has no side effects and no involves mutable variables. mutable variables (JAVA). It allows developers complete control, R has the potential to automate repetitive which is crucial in high-level processes while also reducing code programming. structure. 3. Results Synthesis and Consolidated Analysis CRITERIA JAVA R Complete abstraction It's primarily an object- Object-Oriented Concepts based on OO principles oriented language with a lot are not supported by of capability. Haskell. It requires classes e.g S3 to output O-O concepts. Reflection Strong mechanism for Although Haskell has reflection. Provides a libraries for dynamics, they comprehensive range of do not yet allow metadata functions while comprehensive reflection. avoiding complexities. Functional programming No features It's much easier R is a language for to emulate some of the functional programming. 11 capabilities of FP using interfaces and inner classes. Declarative programming JSolver and JSetL libraries, CatDataAnalysis for example, provide a package is used to variety of DP-related implement features. Declarative/Logic programming in R. UI design prototype Although there is a large For GUI applications, R library for UI apps, the includes a large library. code is verbose and might be confusing to stakeholders. Criterion 1: Complete abstraction based on OO principles The cat package in R offers support for OO-based programming, whereas Java includes macros that help to increase efficiency. Criterion 2: Reflection Haskell has limited support for reflective programming, but Java is so well-designed that it provides great security even without reflection (Anon, 2013). Criterion 3: Functional programming R is a functional programming language, whereas Java utilizes AspectJ, a language extension that treats AOP notions as first-class features. Criterion 4: Declarative programming 12 Frameworks, interpreters, and extensions are required for declarative programming in the indicated programming languages. In Java, the JSolver and JSetL libraries provide a range of DP-related functionality, whereas R implements Declarative/Logic programming via the CatDataAnalysis package (Anon, 2013). Criterion 5: UI design prototype R offers a great collection of libraries for GUI programs, whereas Java has a rich set of libraries for GUI applications but the code is verbose (Anon, 2012). 4. Conclusion This article cannot conclusively demonstrate that one is superior than the other. It all depends on the circumstances in which it is utilized. For tiny systems with a lot of data, a practical solution is preferable since it is closer to the CPU and hence more powerful. It also requires far less math for the same final result, making it more environmentally friendly. This may already be seen in the primary example's overall performance final result. Important programming is better for more intricate data processing since it allows you to keep control over how the code is performed and, as a result, how it is optimized. In certain circumstances, particularly when dealing with large amounts of data with a complex structure, it's far better to use a mix of these solutions, which are all close to the processor and allow you to handle each program and thus its complexity. The most important contrast between imperative and non-imperative programming is that imperative programming recognizes how this system must observe its tasks, whereas non-vital, useful, or logical programming informs this system what it wants to perform rather than how to achieve it. 13 Procedural language, on the other hand, is a crucial language in which a system is built from one or more procedures (subroutines or functions). Imperative programming is also applicable to traditional and modular programming. The hardware implementation of almost all computer systems is critical, as almost all computer systems are designed to execute device code, which is local to the computer and written in imperative style. Selected imperative programming (JAVA) language makes experience because the hardware implementation of almost all computer systems is vital. In the imperative paradigm, assignment statements perform an operation on facts stored in memory and save the results for later use. High-level vital language provides for the evaluation of complex expressions as well as a combination of mathematical operations and characteristic evaluation (Foldoc, 2022). We've concluded that each language has its own set of strengths and limitations after thoroughly reading them. Every programming language serves a certain function, but it may be extended or changed to match current programming requirements. Regardless, each language has its own distinct features. It is known for its cutting-edge programming approaches, which have revolutionized the business. computing universe In the future, Java is likely to introduce a few new and intriguing features. a critical viewpoint on programming methodologies that evolved from procedural to objectoriented, Declarative, Reflective, and appropriate for a range of activities R is currently evolving and introducing new features, as well as competing with other programs. 14 References Anon. (2012). associatedcontent.com. Www.afternic.com. http://www.associatedcontent.com/article/369862/the_evolution_of_computer_p rogra Anon. (2013). TIBCO Spotfire® - Learn. TIBCO Software Inc. http://spotfire.tibco.com/discover-spotfire/what-does-spotfire-do/predictiveanalytics/tibco-enterprise-runtime-for-r-terr Anon. (2017). Declarative modelling | Simulistics. Www.simulistics.com. http://www.simulistics.com/tour/declarative.htm Anon. (2022). Fischer Random Chess / Chess960 / FullChess. Dwheeler.com. https://dwheeler.com/essays/Fischer_Random_Chess.html Eckel, B. (2006). Thinking in Java. In Google Books. Pearson Education. https://books.google.com/books?id=bQVvAQAAQBAJ&q=imperative&pg=PA 24 Foldoc. (2022). declarative language from FOLDOC. Foldoc.org. https://foldoc.org/declarative%20language Marwick, B., Boettiger, C., & Mullen, L. (2018, March 20). Packaging data analytical work reproducibly using R (and friends). Peerj.com. https://peerj.com/preprints/3192/?td=wk mathbits. (2010). Beginning Java. Beginning Java, Brief history of Java, available at http://mathbits.com/mathbits/java/Introduction/BriefHistory.htm (Accessed May 25th, 2010) Programming, I. (2017). Imperative programming. IONOS Digitalguide. https://www.ionos.com/digitalguide/websites/web-development/imperativeprogramming/ 15 Shinn, A., Cowan, J., Gleckler, A., Ganz, S., Radul, A., Shivers, O., Hsu, A., Read, J., Snell-Pym, A., Lucier, B., Rush, D., Sussman, G., Medernach, E., Russel, B., Kelsey, R., Clinger, W., Rees, J., Sperber, M., Dybvig, R., & Flatt, M. (2021). Revised 7 Report on the Algorithmic Language Scheme. https://small.r7rs.org/attachment/r7rs.pdf Thieme, N. (2018). R generation. Significance, 15(4), 14–19. https://doi.org/10.1111/j.1740-9713.2018.01169.x Tiobe. (2011). Home. TIOBE. http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html APPENDIX APPENDIX 1: JAVA PROGRAM (Fischer Random Chess Initial Chessboard Configuration Generation Problem) public class CHESS_JAVA { private static List<Character> pieces = Arrays.asList('R', 'B', 'N', 'Q', 'K', 'N', 'B', 'R'); public CHESS_JAVA() { } public static List<Character> generateFirstRank() { do { Collections.shuffle(pieces); } while(!check(pieces.toString().replaceAll("[^\\p{Upper}]", ""))); return pieces; } private static boolean check(String rank) { if (!rank.matches(".*R.*K.*R.*")) { return false; } else { return rank.matches(".*B(..|....|......|)B.*"); } } public static void main(String[] args) { for(int i = 0; i < 10; ++i) { System.out.println(generateFirstRank()); } 16 } } Output: [N, R, B, K, N, R, Q, B] [N, B, B, R, N, K, R, Q] [R, N, K, R, B, B, Q, N] [B, R, Q, N, K, B, R, N] [R, Q, N, K, N, B, B, R] [N, Q, N, B, B, R, K, R] [B, N, N, R, Q, B, K, R] [B, B, N, N, Q, R, K, R] [B, Q, R, N, K, B, N, R] [B, B, R, N, K, Q, N, R] Process finished with exit code 0 17 APPENDIX 2: R PROGRAM (Fischer Random Chess Initial Chessboard Configuration Generation Problem) pieces <- c("R","B","N","Q","K","N","B","R") generateFirstRank <- function() { attempt <- paste0(sample(pieces), collapse = "") while (!check_position(attempt)) { attempt <- paste0(sample(pieces), collapse = "") } return(attempt) } check_position <- function(position) { if (regexpr('.*R.*K.*R.*', position) == -1) return(FALSE) if (regexpr('.*B(..|....|......|)B.*', position) == -1) return(FALSE) TRUE } 18 s <- function() { s <- sub("K","\u2654", s) s <- sub("Q","\u2655", s) s <- gsub("R","\u2656", s) s <- gsub("B","\u2657", s) s <- gsub("N","\u2658", s) } cat(s(generateFirstRank()), "\n") Output: ♘♗♘♖♗♕♔♖