iT邦幫忙

第 12 屆 iThome 鐵人賽

DAY 21
0
自我挑戰組

Women in IT field系列 第 21

Different Programming Languages Quick Review

  • 分享至 

  • xImage
  •  

C# is based on java. Therefore, you will see a lot of coding style is similar with java
For example:

Using System;
using System.IO;

namespace FileIO {
class Program {
static void Main(string[] args) {
string[] characters = new string[] {"A", "B"};

using (StreamWriter sw = new StreamWriter("test.txt")) {

foreach (string s in characters) {
sw.WriteLine(s);
}
}

// Read and show each line from the file.
string line = "";
using (StreamReader sr = new StreamReader("test.txt")) {
while ((line = sr.ReadLine()) != null) {
Console.WriteLine(line);
}
}
Console.ReadKey();
}
}
}

Python is a more user readable programming language with less line to write with. For example:

f = open("test.txt", "w")
f.write("A with B!")
f.close()

f = open("test.txt", "r")
print(f.read())
f.close()

Golang is the next programming languages that might be popular after Java. The example of coding as:
package main

import (
"bufio"
"fmt"
"io/ioutil"
"log"
"os"
)

func CreateFile(filename, text string) {
file, err := os.Create(filename)
if err != nil {
log.Fatalf("failed to create file: %s", err)
}
defer file.Close()
len, err := file.WriteString(text)
if err != nil {
log.Fatalf("failed to write to %s", err)
}

fmt.Printf("\n File Name: %s", file.Name())
}

func ReadFile(filename string) {

data, err := ioutil.ReadFile(filename)

if err != nil {
log.Panicf("failed read from %s", err)
}
fmt.Printf("\n File Name: %s", filename)
fmt.Printf("\n Data: %s", data)

}

func main() {

fmt.Println("Enter a filename that wants to call with: ")
var filename string
fmt.Scanln(&filename)

fmt.Println("Enter text wants to put in the file: ")
inputReader := bufio.NewReader(os.Stdin)
input, _ := inputReader.ReadString('\n')

CreateFile(filename, input)
ReadFile(filename)
}

For more and more programming languages, they all have similar concepts or learned and adopted from each other. Therefore, once you are deeply familiar with one programming language, it is not difficult to learn another. The only issue is if you have good teachers or mentors to guide or point at you when you went into mass at the beginning.

The same situation with front-end languages. Until now, we still use HTML as a base. Then, you could learn JavaScript since Angular, Vue, and React JS since they all have different yet similar parts.

For automation testing, which are the same as well. There are behavior tests that are using objects that are based on java or python. There are unit testings that are using frameworks that are based on java or python as well. The only differences are the frameworks or drivers are different.


上一篇
Quick Summary in Java
下一篇
Seek and Hire Members for your team
系列文
Women in IT field30
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言