Category Archives: #CS

Software Frameworks

What are they?

A software framework is a structural or conceptual platform that allows developers and users to selectively specialize or override common code with generic capabilities. Frameworks are libraries that have a well-defined application program interface (API) that may be used anywhere in the product being developed. Software frameworks are adaptable, resilient, and efficient because they are frequently designed, tested, and optimized by numerous skilled software engineers and programmers. Developing apps with a software framework allows you to concentrate on the application’s high-level functionality. This is because the framework handles all of the low-level functions.

Top Frameworks

Angular

Angular is an HTML and TypeScript-based platform and framework for creating single-page client applications. TypeScript is used to write Angular. As a set of TypeScript libraries that you load into your apps, it implements core and optional functionality. An Angular application’s architecture is based on a few key ideas. The Angular framework’s fundamental building pieces are Angular components, which are arranged into NgModules. NgModules are functional groupings of linked code; an Angular application is defined by a set of NgModules. An application must include at least one root module to facilitate bootstrapping, and many more feature modules are common. Some popular website that used Angular are Netflix, Youtube, Django etc

Apache Spark

Apache Spark is a large-scale data processing engine with a unified analytics engine. Using Apache Spark, you can easily create apps in Java, Scala, Python, R, and SQL. Apache Spark can handle data from Hadoop Distributed File System (HDFS), NoSQL databases, and relational data stores like Apache Hive. Spark can do in-memory processing to improve the efficiency of big data analytics applications, but it can also perform traditional disk-based processing when data sets are too huge to fit into system memory. Some top companies that used Apache Spark are Amazon, Microsoft, Oracle, Visa wtc

Pytorch

Torch is an open-source machine learning tool based on the computer language Lua, while PyTorch is a Python machine learning package based on Torch. PyTorch, which was created by Facebook’s AI research lab, may be used with both Python and C++. PyTorch is a programming language that is used for computer vision and natural language processing (NLP). The following are some examples of popular websites built with PyTorch: Comcast, Exelon, Trifo, Quadient etc

Why this topic?

I’ve been hearing about frameworks for a long and have even had talks about them while not understanding anything about them. I learned what frameworks are, how they function, and which frameworks are most commonly utilized by well-known firms. I’ve also learned that as a developer, it’s important to understand what frameworks or programming languages I will need to create the application I desire.

link: https://hackr.io/blog/what-is-frameworks

From the blog cs@worcester – Dream to Reality by tamusandesh99 and used with permission of the author. All other rights reserved by the author.

Docker

What is vs What isn’t

Docker is an infrastructure manager for Linux Containers. Docker is an excellent image distribution strategy for server templates created with configuration management systems like as Chef, Puppet, SaltStack, and others. Docker is not a replacement for Configuration Managers such as Chef, Puppet, SaltStack, and others. Docker offers a single store of public and private disk images that may be used to run a variety of operating systems (Ubuntu, Centos, Fedora, even Gentoo). Docker is not yet capable of connecting several servers or virtual machines.

When to use

Docker, like git or java, is a basic technology that you should start using in your everyday development and operations processes. You may use docker as a version control system for the complete operating system of your project. You can also use a docker to distribute/collaborate on your app’s operating system with a team. When your project has to go through many stages of development, use Docker. Try Drone or Shippable, both of which support Docker CI/CD. One of the best thing is that docker allows you to execute your code in the same environment as your server on your laptop.

Docker comparison

When you run java, you run the program on any system with a JVM, however, when you run docker, you run the code on any machine with a Docker server after you arrange your servers exactly the way you want them. Git tracks the changes in your code while docker tracks the changes in your system. In Docker, you can track changes throughout your entire system. GitHub is mainly though for code management, and Docker Hub is though for container build, management and distribution. They all work in the same way, despite the fact that they do various tasks.

Why docker

Since we’re already using Docker in class, why not take advantage of the extra time to learn more about it? I understood what Docker was but had never considered what it wasn’t, therefore this post helped me better comprehend what Docker isn’t. I’ve also discovered how docker is similar to both java and git, something I never considered before. I had no idea there were alternatives to Docker, such as the Amazon AMI Marketplace, which is the closest thing you’ll find to the Docker Index. With Docker, you can run the images on any Linux server that runs Docker. Another is the Warden project, which is an LXC manager designed for Cloud Foundry but lacks any of Docker’s social capabilities, such as sharing images with others on the Docker Index. The most important thing I learned is when to use docker.

https://www.ctl.io/developers/blog/post/what-is-docker-and-when-to-use-it/

From the blog cs@worcester – Dream to Reality by tamusandesh99 and used with permission of the author. All other rights reserved by the author.

API

What really is an API?

We’ve all heard of APIs, but what are they exactly? To put it another way, imagine you’re seeking for a method to express yourself in a unique way. Our thoughts, wants, and ideas may all be expressed through language (both written and spoken), gestures, and facial expressions. For interaction with computers, applications, and websites, user interface components such as a screen with a menu and graphical elements, a keyboard, and a mouse are necessary. Software and its components do not require a graphical user interface to communicate with one another. APIs (application programming interfaces) are machine-readable interfaces that allow software products to exchange data and functionality.

Rest API

Roy Fielding first mentioned REST in his doctorate dissertation in 2000. It’s a collection of architectural elements, design concepts, and interactions for constructing distributed systems that employ any type of media (text, video, etc.). REST is a method of system development that provides for flexible transmission and presentation of information over the web while also giving the framework needed to quickly create general-purpose components. REST differs from other web services because it requires delivering data to the requesting application. While this gives the program a lot of freedom, allowing it to do anything it wants with the data, it comes at the expense of efficiency. Delivering data over the internet for processing is much slower than conducting the processing locally and then sending the results.

Private API

These application software interfaces should improve an organization’s solutions and services. In house developers or contractors can use these APIs to integrate a company’s IT systems or applications, as well as to create new systems or customer-facing apps that use current systems.

Partner API

Partner APIs are marketed freely but only shared with business partners that have signed a contract with the publisher. Software integration between two companies is a frequent use case for partner APIs. A firm that gives its partners access to data or capabilities might generate additional income streams. It can keep track of how the exposed digital assets are being used, ensuring that third-party solutions that use their APIs deliver a good user experience, and guarantee that corporate identity is maintained in their apps.

Public API

These APIs, often known as developer-facing or external APIs, are open to all third party developers. When correctly implemented, a public API program may increase brand recognition while also providing an extra source of revenue. There are two kinds of public APIs: open (free) and commercial (for a fee).

Why I chose this topic?

I have always wanted to learn more about APIs because I have used rest api before and I never really knew how it worked or what it was. I only followed the documentation about I’ve always wanted to understand more about APIs because I’ve used them previously but had no idea how they operated or what they were. I only used it after reading the documentation on how to do so. After doing this research, I have a basic understanding of APIs and their various kinds.

From the blog cs@worcester – Dream to Reality by tamusandesh99 and used with permission of the author. All other rights reserved by the author.

cs@worcester – Dream to Reality 2021-09-26 23:53:59

What are UML Class Diagrams

Foremost, UML diagrams

UML stands for Unified Modeling Language and was invented by Grady Booch, Ivar Jacobson, and James Rumbaugh in 1995 while working at Rational Software. We create UML diagrams to help us comprehend the system more clearly and simply. A single diagram does not represent all aspects of the system. UML defines various kinds of diagrams to cover most of the aspects of a system. UML diagram has two categories of diagrams, Structural Diagrams and Behavioral Diagram. Inside Structural Diagrams, there is Class diagram, Object diagram, Component diagram, and Deployment diagram.

UML class diagrams

Class diagrams are the most common diagrams used in UML. Classes, interfaces, relationships, and collaboration are all represented in class diagrams. The features and activities of a class, as well as the system’s restrictions, are depicted in a class diagram. Class diagrams are often used in the design of object-oriented systems since they are the only UML diagrams that can be directly mapped with object-oriented languages.

What is Class?

A Class is an object’s blueprint. Objects and classes are inextricably linked. We can’t discuss one without discussing the other. And, because we utilize classes to generate objects, the entire objective of Object-Oriented Design is not about objects, but about classes. As a result, while a class describes what an object will be, it is not the object itself. Classes, on the other hand, specify the types of things, whereas objects are useable instances of classes. Each Object was constructed using the same blueprints and so has the same components (properties and methods). An object is a member of a class and has states and behaviors, according to the standard definition.

Examples

An example can be such as there is a base class as an animal dog and we create an instance like Bobby, which is a dog. A dog has properties such as color, eye color, height, weight. And the method example for a dog can be such as a dog can jump, can sit, can eat. And for the object which is Bobby, Bobby has property value. Bobby is a yellow color, he has brown color eye; he is 17 inches tall, and he weights 24 pounds. For the methods Bobby can jump, he can sit, can eat as well.

Why UML class diagrams?

I chose this topic because UML diagrams have always made it easier for me to understand the topic/code. It helps me figure out which classes are inherited from which, which classes are abstract, and so on. For example, a class may override a method, but with the UML diagram/markdown preview, I can easily tell where the original method was created and why I have override that method. Also, since our 1st assignment is about markdown preview and UML diagrams, why not. So far, these two websites have helped me gain a better understanding of UML diagrams. https://www.tutorialspoint.com/uml/uml_standard_diagrams.htm https://www.visual-paradigm.com/guide/uml-unified-modeling-language/uml-class-diagram-tutorial/

From the blog cs@worcester – Dream to Reality by tamusandesh99 and used with permission of the author. All other rights reserved by the author.

CS Mission

Some of you may know me and some may not, but I am Sandesh Gurung and I am currently a senior at WSU pursuing a dream of becoming software developer. This is my introductory blog post for CS-343 section 2. I’m hoping to get a lot out of this lesson. It may not be easy, but it is what I most desire at the moment. As time passes, I will continue to update this blog about what I have learnt in this course. 

From the blog cs@worcester – Dream to Reality by tamusandesh99 and used with permission of the author. All other rights reserved by the author.

Reading list

The most valuable thing you can get out of any book is a list of other books worth reading. Over time, you will find that certain books keep popping up from the “bibliography”, and you should move those books to the top of the reading list. Other books will sink. Since the reading list is essentially a priority queue, you’ll eventually find that some books sink so far down the queue that you may never read them again.

Start by picking a broad book to give you a general idea of the subject you are aiming for. Then choose a few specific books to master the aspects of the topic that interest you.

Reading the right book at the right time will have a better effect. A lot of reading can improve your reading ability. You will also improve your knowledge of the outside world through reading. For computer science, reading a lot of the latest information will be of great help to your future work and research. Reading will improve your horizon and enrich your spare time.

Even if you read a good book on programming every two months, which is about 35 pages a week, it won’t take long for you to gain a deep understanding of our industry and differentiate yourself from everyone around you. — Steve McConnell, Code Complete

Focusing on the classics also carries a risk: you devote too much energy to them, at the expense of more pragmatic knowledge and information that would improve your everyday skills. Make sure to mix classics with modern, more pragmatic books and articles on your reading list.

In practice, algorithmic problems do not appear at the beginning of a large project. Then, all of a sudden, they appear as subproblems when the programmer doesn’t know how to proceed or when the current program is clearly inappropriate. — Steven S.Skiena, Scenario Analysis of The Algorithm Design Manual

From the blog haorusong by and used with permission of the author. All other rights reserved by the author.

Detailed and basic usage of Mockito

 Mockito is a Mock framework for Java single-testing, but it can also be used with other single-testing frameworks in addition to JUnit. Mockito changes the behavior of a class or object, allowing us to focus more on testing the code logic without the effort of constructing the data.

The basic concept

Mocks can be of two types, Class and Partial,so Mockito is called spy. The behavior of changing methods on mock objects is called Stub.

A Mock process is called a Mock Session, and it records all the Stubbing. It consists of three steps:

+———-+ +——+ +——–+ | Mock/Spy | ===> | Stub | ===> | Verify | +———-+ +——+ +——–+

Class Mock

A Class Mock changes the behavior of a Class so that the object it mocks completely loses its original behavior.

Method returns default values (null, false, 0, etc.) if it is not pegged.

The most basic usage is as follows:

1
2
3
4
5
6
7
8
9
10
11
12
import static org.mockito.Mockito.*;

// use List.class to creat a mock subject --- mockedList

List mockedList = mock(List.class);

//operation of mockedList

mockedList.add("one");
mockedList.clear();

//validation

verify(mockedList).add("one");
verify(mockedList).clear();

Partial Mock(spy)

If we only want to change the behavior of an instance, we need to use spy:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
List list = new LinkedList();
List spy = spy(list);

// optionally, you can stub out some methods:
when(spy.size()).thenReturn(100);

// using the spy calls *real* methods
spy.add("one");
spy.add("two");

// prints "one" - the first element of a list
System.out.println(spy.get(0));

// size() method was stubbed - 100 is printed
System.out.println(spy.size());

// optionally, you can verify
verify(spy).add("one");
verify(spy).add("two");

As you can see from the code, the main difference between a Spy and a MockSettings is that the MockSettings for a Spy needs to be passed in a SpiedInstance.

The default Answer to a spy is CALLS_REAL_METHODS, which means that if a method is not stub, it performs its real behavior.

The default Answer to a mock is RETURNS_DEFAULTS. Methods that are not stub return a default value.

source:

https://www.vogella.com/tutorials/Mockito/article.html

https://howtodoinjava.com/mockito/junit-mockito-example/

From the blog haorusong by and used with permission of the author. All other rights reserved by the author.

Use the Source

 When working on an open-source project, please get in the habit of downloading the latest version of the code (preferably from their source control system), so you can review its history and track future developments. Please take a look at the codebase structure and think about why it is organized the way it is. Look at how developers manage their code modules to see if it makes sense and compare them to how they might have used them. Try to refactor the code to understand why its coders made the decisions they did, and think about what the code would look like if you were the one coding it. It will give you a better understanding of the projects; Also, make sure you can build those projects. If you’ve found a better way to do something, you’re ready to contribute code to the project. Inevitably, as you go through the code, you’ll come across decisions you completely disagree with it. Ask yourself if the developers of the project might know something you don’t or vice versa. Consider whether this is a legacy design that needs to be refactored; consider whether making a toy implementation for the relevant feature would help clarify the issue.

You end up with a toolbox filled with all sorts of quirks that you’ve collected from other people’s code. This will hone your ability to solve minor problems more quickly and quickly. You’ll be able to tackle issues that others think are impossible to solve because they don’t have access to your toolbox. Take a look at the Git distributed source control system written by Linus Torvalds or any code written by Daniel J. Bernstein (known as DJB). Programmers like Linus and DJB occasionally use data structures and algorithms that most of us have never even heard of. They’re not magicians — they’ve just spent their time building bigger and better toolboxes than most people. The great thing about open source is that you can look at their toolbox and make their tools. One of the problems in software development is the lack of teachers. But thanks to the proliferation of open-source projects on sites such as SourceForge. Net and GitHub, you can learn from relatively representative code examples from the world’s programmer community.

In ODS, Bill Gates says: “The most subtle test of programming ability is giving the programmer about 30 pages of code and seeing how quickly he can read through it and understand it.” He realized something significant. People who quickly learn directly from the source code will soon become better programmers because their teachers are the lines of code written by every programmer in the world. The best way to learn patterns, idioms, and best practices is to read the open-source. Look at how other people to code. It’s a great way to stay relevant, and it’s free. — Chris Wanstrath at Ruby 2008 [

Pick an open-source project with deep algorithms, such as Subversion, Git, or Mercurial source control system. Browse through the project’s source code and jot down any algorithms, data structures, and design ideas that seem novel to you. Then write a blog post describing the project’s construction and highlighting the new ideas you’ve learned. Can you find a situation in your daily work where the same concept can be applied?

From the blog haorusong by and used with permission of the author. All other rights reserved by the author.

Breakable Toys

 We can all benefit from writing random “toy” programs to push ourselves to the limit by setting artificial limits. — Donald Knuth, The Art of Computer Programming

If you can learn as much from failure as you can from success, you need a relatively private space to look for the loss. In balling acrobatics, a performer who tosses three balls will never progress if he has never tossed five. Those who spend hours picking dropped balls until their back hurts eventually get good at it. The same lesson applies to software, where software workers often need to step out of their comfort zone to try something they’re not good at it. It is by taking bold chances again and again that you improve your skills, that you learn and grow from failure after failure. Just as a three-ball-tossing performer does not throw five balls in a formal performance, software developers often make mistakes in new areas. Software developers also need a safe place to make mistakes. It’s terrible not to have such a safe place to make mistakes. The fear and unwillingness of software developers to make mistakes make them stuck in a rut, unable to learn from failure, and thus makes the entire software development industry staid and stagnant.

Other examples of the “crunchy toy” pattern include games like Tetris and Tic-Tac-Toe. One senior I know has a habit of using every new language he learns to create a game, blog software, and IRC client. The nature of the problem is to build a toy that contains learning something new and provides an opportunity to let you in a special environment to deepen the understanding of hand tools. The environment is not only safe because you are the only or most influential users, and, even to the most powerful commercial products, you still have room to serve you as a user’s needs better.

You still have to remember that they’re just toys, and that’s why they’re supposed to be fun. If they’re not interesting, then when the initial excitement is over, they’ll just become a dusty relic, and you’ll be able to focus your energy on what you enjoy building.

From the blog haorusong by and used with permission of the author. All other rights reserved by the author.

DD path graphs

Structural testing is based on the source code of the program under test, rather than the definition. This is known as white box testing, while functional testing is known as black-box testing.

Program diagram: For a program written in an imperative programming language, the program diagram is a directed graph with nodes representing statement fragments and edges representing control flow.

DD – path

DD path: Decision-to-decision path (Miller). Begin with the “exit” of the decision statement and end with the “path” of the next decision statement.

DD chain: A path of starting and ending nodes at different points in a directed graph.

Consisting of a node, the internality =0;

Consisting of a node, externality =0;

Consisting of a node, the inner degree > =2 or the outer degree > =2;

Consisting of a node, the degree inside =1 and the degree outside =1;

Length > =1 for maximum drill

DD – path graph

A DD-path graph is a labeled directed graph in which nodes represent the DD Path of a program graph and edges represent the control flow of the Path.

For a given program, many different program diagrams can be constructed, all of which can be reduced to a unique DD-path diagram.

It is possible to generate DD paths for programs up to 100 lines, and above that size, analysis tools are generally required.

The simplest control flow diagram is the DD path. DD can be thought of as belonging to the control flow diagram.

DD path definition:

Given a program written in an imperative language, its DD path graph is a directed graph, where nodes represent the DD paths of its program graph and edges represent the control flow between successive DD paths.

In fact, the DD path graph is a compressed graph in which 2-connected components are compressed into a single node corresponding to the 5DD path.

source:

Click to access 08-PathTestingCoverage.pdf

From the blog haorusong by and used with permission of the author. All other rights reserved by the author.