Apps¶
- As a DevOps engineer, you should be aware of the basics of programming and the software development lifecycle.
Compilers¶
- Older compilers used to compile directly into machine code which was specific to a processor set. So, it could not be run on other machines.
- Modern compilers convert to an intermediate code called as Byte Code which is then run by the interpreter (in case of interpreted languages)
Languages¶
Java¶
- JDK (Java Development Kit) - tool to develop, build and run Java applications
- javac - used for compiling
- javadoc - used for documentation
- jdb - used for debugging
- Java code compilation and execution process
- Source code is compiled into byte-code
- Java Archive (JAR) is a packaging format to package multiple java
.classfiles and dependent libraries into a single distributable package in.jarformat.jar cf MyApp.jar MyClass.class Service1.class Service2.class ...- to create a jar filejava -jar MyApp.jar- run a jar file
- Web Archive (WAR) is a packaging format to package all the contents of
.jaralong with images and static contents required to build a web application. - JavaDoc is a tool to automatically generate documentation of the code
javadoc -d doc MyClass.java- generate documentation for the given java file
- Java Application Build Process
- Application build process can be automated using Build Tools like Maven, Gradle & ANT. They use configuration files where we can specify build steps
JavaScript / NodeJS¶
- JavaScript was originally developed as a client side scripting language
- NodeJS brought JS to the server side
- NodeJS can handle a large number of concurrent connections by implementing a non-blocking IO model
- Node Package Manager (NPM) is a package manager and repository of publicly available NodeJS packages
npm -v- get the NPM versionnpm install serverless- install a packagenpm install -g serverless- install a package globallynpm uninstall serverless- uninstall a packagenpm search serverless- search a package
- When importing a package in the code, node looks at the local
node_modulesfolder under the application folder. If not found, it looks at the globalnode_modulesdirectory. To see the list of paths node scans, runnode -e "console.log(module.paths)" - Application dependencies are stored as configuration in
package.jsonfile at the root of the application directory.
Python¶
- Server-side scripting language heavily used in Analytics
- Both Python2 and Python3 can be installed on the system simulatneously
- Pip Install Package (PIP) - package manager for Python
pip2 install numpy- python2pip3 install numpy- python3pip -V- check which python pip is pointing topip show numpy- show where a package is installedpip install numpy --upgrade- version upgrade a packagepip uninstall numpy- uninstall a package
- Application dependencies should be written in
requirements.txtand installed by runningpip install -r requirements.txt
Last updated: 2022-09-23