2020. 2. 21. 08:30ㆍ카테고리 없음
Design, Execution and Expected OutputThree programs in different languages, i.e. Java, Python and C and with identical functionality create and call each other in a cyclic manner.
The weird thing is, that each program creates, compiles and executes the next from the scratch without loading the sources from the filesystem. So, every program must know the code of all the others and start them in a asynchronous way.A Starter application creates the file HelloWorld.java in the working directory, compiles it and executes it with two command line arguments.
This Java program creates and executes a Python program. The Python program creates, compiles and executes a C program. Then the C program creates, compiles and executes the initial Java program.This cycle is executed several times and all three programs write into a file called HelloWorld.log.In the first command line argument the source code of Java, Python and C is encoded. In the second argument is defined how often the Java program should be executed.Stopping the application after a finite number of runs and delaying the execution is important. Because when you have processes which live just some milli seconds and start then the next process are difficult to kill the processes. 2016-06-04T23:12:40.097 - JavaSE - round 3 2016-06-04T23:12:40.111 - JavaSE - Hello, World! 2016-06-04T23:12:40.119 - JavaSE - delete HelloWorld.py succeeded=false 2016-06-04T23:12:40.119 - JavaSE - create HelloWorld.py 2016-06-04T23:12:40.123 - JavaSE - execute HelloWorld.py 2016-06-04T23:12:40.124 - JavaSE - end 2016-06-04T23:12:40.124 - JavaSE - exit 2016-06-04T23:12:43.170 - Python - round 2 2016-06-04T23:12:43.170 - Python - Hello, World!
2016-06-04T23:12:43.171 - Python - delete HelloWorld.cpp succeeded=true 2016-06-04T23:12:43.171 - Python - create HelloWorld.cpp 2016-06-04T23:12:43.172 - Python - execute 2016-06-04T23:12:44.003 - Python - end 2016-06-04T23:12:44.003 - Python - exit 2016-06-04T23:12:47.009 - cpp - round 2 2016-06-04T23:12:47.009 - cpp - Hello, World! 2016-06-04T23:12:47.010 - cpp - delete HelloWorld.java succeeded=true 2016-06-04T23:12:47.010 - cpp - create HelloWorld.java 2016-06-04T23:12:47.012 - cpp - execute HelloWorld.java 2016-06-04T23:12:47.759 - cpp - end 2016-06-04T23:12:47.759 - cpp - exit 2016-06-04T23:12:50.931 - JavaSE - round 2 2016-06-04T23:12:50.940 - JavaSE - Hello, World! 2016-06-04T23:12:50.946 - JavaSE - delete HelloWorld.py succeeded=true 2016-06-04T23:12:50.946 - JavaSE - create HelloWorld.py 2016-06-04T23:12:50.949 - JavaSE - execute HelloWorld.py 2016-06-04T23:12:50.950 - JavaSE - end 2016-06-04T23:12:50.950 - JavaSE - exit 2016-06-04T23:12:53.988 - Python - round 1 2016-06-04T23:12:53.988 - Python - Hello, World! 2016-06-04T23:12:53.990 - Python - delete HelloWorld.cpp succeeded=true 2016-06-04T23:12:53.990 - Python - create HelloWorld.cpp 2016-06-04T23:12:53.990 - Python - execute 2016-06-04T23:12:54.384 - Python - end 2016-06-04T23:12:54.384 - Python - exit 2016-06-04T23:12:57.391 - cpp - round 1 2016-06-04T23:12:57.393 - cpp - Hello, World! 2016-06-04T23:12:57.394 - cpp - delete HelloWorld.java succeeded=true 2016-06-04T23:12:57.394 - cpp - create HelloWorld.java 2016-06-04T23:12:57.397 - cpp - execute HelloWorld.java 2016-06-04T23:12:58.101 - cpp - end 2016-06-04T23:12:58.101 - cpp - exit 2016-06-04T23:13:01.279 - JavaSE - round 1 2016-06-04T23:13:01.290 - JavaSE - Hello, World! 2016-06-04T23:13:01.296 - JavaSE - delete HelloWorld.py succeeded=true 2016-06-04T23:13:01.296 - JavaSE - create HelloWorld.py 2016-06-04T23:13:01.299 - JavaSE - execute HelloWorld.py 2016-06-04T23:13:01.300 - JavaSE - end 2016-06-04T23:13:01.301 - JavaSE - exit 2016-06-04T23:13:04.342 - Python - round 0 2016-06-04T23:13:04.343 - Python - stopped.
Two reasons - why the C code is so large - can be found in the facts that C has missing support of base64 decoding and the need to start a new thread to execute a process asynchronously.Additionally the C code is not platform independent. Starting on Mac OS X and Windows differs and the code is not platform independent. Here I decided not to code for Windows, but this would result some additional lines.The key problem with C is the missing support of base functionality in the standard libraries. Python and Java are here the clear winners.Some empirical investigations indicate that Java and C are in the same range in the category source code size (see ) but for this example this is not true.Even if the expressiveness of Java and C should be almost the same, the standard library support decides how much work you will have to develop real world software. And this is quite often ignored when just the expressiveness of software is compared.
Rube Software 2017
Code of the Java SE StarterThe Starter program is not necessarily needed to start, but it is more convenient to calculate the arguments automatically. As already mentioned each program must know all the source code and the best is to provide this information is with a command line argument. The source code is encoded as base64 string and concatenated with a space and then encoded again as base64 string. This gives a single argument with all the needed source code information.The second argument is the number of rounds and the default value is 3. The argument is the same for all programs.
Rube Goldberg Machine Software
They decode the source code for the next process and create a file.
Not everybody understands the humor of programmers. Filters.Submission rulesRules are zero-indexed. If they do not appear zero-indexed you are asked to contact for recalibration. It's actually a programmer vision test. How'd you do?Alas, my nephew wasn't thinking Reddit when he did the screenshot.
My brother sent it to me with that comment, so I shamelessly exploited both the screenshot and title for fake internet points. Sadly, I posted to the wrong sub first, and discerning redditors are noting the form rather than being as amused by the content as I was, so my nefarious plan has failed to gain me the infinite sweet, sweet karma I sought.Next time, I'll steal better content!.