Friday, April 24, 2020

Choosing Programming Languages (Java Vs Python)

Some of us may be thinking about which language(s) to learn. A lot of options are available: C, C++, Java, Kotlin, Python, Go, Dart, Swift etc. One of the popular questions is how to choose between Java and Python.

Should we be choosing a programming language based on
  • which one is easier to learn?
  • which one is easier to program in? 

Rather, the factors we might wish to consider are:
  • Academic rigor
  • Global trends for businesses/job market
  • Global trends for learners
  • Local trends for businesses/job market
  • Local trends for learners
  • Which language is better for long term software project maintainability

Please refer to the following comparison of Java and Python

Worldwide
Bangladesh
Reference
Business
/Market
Java 1st,
Python 3rd
TIOBE, both current month and Very Long Term History
Learners
Java 2nd,
Python 1st
Mixed
Java 2nd,
Python 3rd
Google
Trends
Java < Python
14 < 19
Java > Python
12 > 4
Linkedin
Jobs
Java > Python
304,153 > 230,553
Java > Python
16 > 9
Worldwide: 
Bangladesh:
  Java, Python
BdJobs
Java > Python
6 > 4

Github ranks Python as 2nd and Java as 3rd at
https://madnight.github.io/githut/#/pull_requests/2020/1

Java has 8 "yes" and Python has 5 "yes" at
https://en.wikipedia.org/wiki/Programming_languages_used_in_most_popular_websites

"I’d also rather maintain someone else’s Java code"
https://hilton.org.uk/blog/maintenance-expressive-languages

More reading:
https://en.wikipedia.org/wiki/Comparison_of_programming_languages


Conclusion:

Java has the advantage of having some similarity with C, C++, C#. Learning java may provide easy access to learning C - family of languages and their markets. Overall, Java has been prevalent and still is strong at the time of writing this article.

On the other hand, Python is growing fast.

Application area for both Java and Python largely overlaps. Both are useful for the web. While it is not impossible to create desktop and mobile app in python, Java programmers have the advantage of access to desktop (j2SE), embedded systems, and the global apps (Android) market.

Based on these factors, learners may choose to learn both (1) Java and (2) Python. Even if these two cross each other in rank, they are expected to be two of top several languages for some time to come.

After those two, 3rd / 4th and other languages may depend on task at hand or other job requirements. It may be a good practice to have several languages up ones' sleeve. Learning too many languages might seem lucrative. Unfortunately, it may have detrimental effects as each language may get less attention.

Your feedback and any insight is appreciated.

Tuesday, August 13, 2019

FizzBuzz

FizzBuzz is a pretty basic problem yet interesting for different purposes. It has been used in a variety of situations :

1) As a kids game as pointed out by wikipedia article, FizzBuzz

2) As a job interview question for programming related posts as pointed out in a 2007 article on by Mr Imran on Using FizzBuzz to Find Developers who Grok Coding.

3) For online judge contests and challenges like HackerRank

The question may be used in coding interview for good reasons as discussed by CodingHorror article, Why Can't Programmers.. Program?

Some of us might be wondering why a ~ 2007 problem is still relevant in 2019! This question has been answered already by a hackernoon article, Why I’m still using “Fizz Buzz” to hire Software-Developers

Many more approaches along with their variations have been discussed at
a) FizzBuzz Solution Dumping Ground
b) FizzBuzz JavaScript solution
c) HackerNews: What's the shortest FizzBuzz you can write? What language?    (discussion on Anarchy Golf : FizzBuzz)
d) Twenty Ways to FizzBuzz, An exercise in Javascript
e) FizzBuzz In Too Much Detail

The hackerrank challenge specially asks for the shortest code. The ability to write a short code depends on the minimum requirement of boilerplate code. In Java we can reduce length of the codef based on identifier(s), parentheses, ternary operator, line breaks, pre/post increment, re-writing n%3==0 conditions with greater-than (or less-than operators) as follows.
class S{public static void main(String[]a){for(int i=0;++i<101 i="" ystem.out.println="">0?i%5>0?i:"Buzz":i%5>0?"Fizz":"FizzBuzz");}}

Using javascript, we make it even shorter. We may need to remind ourselves that writing unreadable, difficult to maintain, is not recommended. Java, C, C++, C#, Python, Ruby, R, none of the submissions in these languages reached the top score yet which is 16.0. It leads us to the question, which submission led to the top score? The answer is bash script (proof). How? The hint has been kindly provided by the author of the top submission, Byron Formwalt at here.

If we are new to bash scripting, we may wish to get started with few resources mentioned here, here, and here. The Advanced Bash-Scripting (ABS) Guide (HTML, PDF) from The Linux Documentation Project (LDP) may be a good starting point.

Disclaimer: Even though this may be suitable for the purpose of the getting higher score in hackerrank or just for exercise, it may not be a part of best coding practices. There are many scopes for improvement in this post. Suggestions are welcome. .

Java Code Convention or Style Guide

Almost all organizations either adopt the coding style from someone else or develop their own one. Newly recruited employees as well as interns may be expected to following the existing code convention or style guide of the company. If you are starting your own company, you may wish to adopt or develop your own one based on one of the available ones. Some examples are:


Java Code Convention / Style Guide

Oracle/Sun
1999:
https://www.oracle.com/technetwork/java/codeconvtoc-136057.html

1997:
https://www.oracle.com/technetwork/java/codeconventions-150003.pdf


OpenJDK:
http://cr.openjdk.java.net/~alundblad/styleguide/index-v6.html


Google:
https://google.github.io/styleguide/javaguide.html


Android:
https://source.android.com/setup/contribute/code-style


Facebook:
https://github.com/facebook/jcommon/wiki/Coding-Standards


Twitter:
https://github.com/twitter/commons/blob/master/src/java/com/twitter/common/styleguide.md


Mozilla:
https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Coding_Style#Java_practices


Spring Framework:
https://github.com/spring-projects/spring-framework/wiki/Code-Style



CMU SEI:
https://wiki.sei.cmu.edu/confluence/display/java/Java+Coding+Guidelines
https://wiki.sei.cmu.edu/confluence/display/java



See also:
Python Style Guide or Code Convention

Wednesday, October 24, 2018

Sharing PC/Laptop Internet via WiFI or creating WiFi hotspot

The following steps discusses about sharing LAN Internet connectivity from laptop or desktop with wifi/wlan card. to other laptops / phones



  1. open cmd in administrative mode
  2. To start the network, copy paste the following two lines

netsh wlan set hostednetwork mode=allow ssid=MyWiFi key=MyPasswordHere

netsh wlan start hostednetwork



To stop the network, copy paste the following line

netsh wlan stop hostednetwork



to connect to it, use the following from phone or other laptops
Wifi name (SSID):
MyWiFi

password:
MyPasswordHere

Monday, October 22, 2018

How to choose a research or thesis topic

As-salamu Alaikum,

Often we struggle to choose a thesis topic or research area. The following links might help as a starter:

TOPIC
 
Computers are used to solve problems in many domains: Computational Sciences
 
Computer Science hot research topics
 
 
Computer Science Graduate Theses
 
How to select a thesis topic?

Saturday, October 6, 2018

Mathematics in Computer

What Every Computer Scientist Should Know About Floating-Point Arithmetic
https://docs.oracle.com/cd/E19060-01/stud8.compiler/817-0932/ncg_goldberg.html


SUN Numerical Computation Guide


https://en.wikipedia.org/wiki/IEEE_754

https://steve.hollasch.net/cgindex/coding/ieeefloat.html