Skip to content

A-Fujihara/AlternativeLanguage_Proj2

Repository files navigation

AlternativeLanguage_Proj2

Table of Contents

Programming Language Choice

Which programming language and version did you pick?

-For my Alternative Language Project I chose C#. The version of C# used is 12.0 with .NET 5.

Why did you pick this programming language?

I chose this language as it had been communicated with us that C# could have a great deal of usefulness beyond this project.

While I was interested initially in other languages such as F#, COBOL, and Kotlin, I ended up coming full circle back to C# for a few reasons. In researching these languages, I learned that COBOL lacks built-in functionalities to deal with CSV files specifically. Meaning COBOL could still do the job, but it would be potentially very labor intensive. The learning curve for F# has the potential to be steep. As time is somewhat short at the juncture of the quarter, it seemed wise to choose the language that is both somewhat familiar, but also less niche such as COBOL.

How your programming language chosen handles:

Object-Oriented Programming

-While C# was inspired by C, its full support for OOP is a big difference between the two lanugaes. C# has built-in support for defining clases, and therefore creating objects. Additionally, C# fully supports encapsulation, inheritance, and polymorphism.

File Ingestion

-In terms of file ingestion, C# offers classes like StreamReader and StreamWRiter for reading and writing different file formats, as well as handling user inpupt.

Conditional Statements

-C# provides a full set of conditional statements such as if, else if, else, and switch statements. Assignment statements are done using the = operator. C# offers the familiar options in terms of loops: for, while, do-while and for each.

Assignment Statements

-In C#, assignment statements are used to assign values to variables. The assignment operator is the equal sign (=).

Loops

-C# offers all the standard flavors of loops one would expect to see. For example:

  1. For Loop: A for loop repeats a block of code a specified number of times. It's typically used when you know exactly how many times you want to iterate.

  2. While Loop: A while loop repeats a block of code as long as a particular condition is true.

  3. Do-While Loop: Similar to the while loop, but the do-while loop checks the condition at the end of the loop, ensuring that the block of code is executed at least once.

  4. Foreach Loop: A foreach loop iterates over items in a collection such as an array or list. It's typically used when you want to perform an action on each item in a collection.

Subprograms (functions/methods)

-C# allows you to define methods to capture re-usable blocks of code, promoting modularity and organization.

Unit Testing/Exception Handling

-In C# you will find it fully supports testing frameworks, such as xUnit and NUnit. These frameworks are conceptually similar to JUnit testing, which use assert-like statements to verify expected outcomes of different code blocks.

-In C# you will find a exception handling as robust as Java. It uses try-catch blcoks, allowing one to gracefully handle errors during program execution.

List out 3 libraries used

  1. CsvHelper I encountered some complications during the intial implementation phases with this project. I believe this was somewhat a result of an over-dependence I've developed on the Scanner class in Java. The Scanner class uses methods such as while (file.hasNext()) to ingest tokens. I found myself attempting to construct a similar type of logical structure to maneuver my way through ingesting the csv file, cleaning it and storing it in another data structure. Since C# doesn't offer these methods, I found that my intial approach ammounted to a sort of rickity patchwork of methods and libraries that were attempting to build something that didn't natively exist in C#. After a few failed attempts, I did some research and learned about CsvHelper. CsvHelper is an open-source .NET library designed to handle efficient parsing and manipulation of CSV files. CsvHelper boasts a wide variety of tools that provide usefulness at every stage of CSV data ingestion and manipulation. CsvHelper proved to be extrememly helpful even though it is very new to me. Because of its vast capapilities it sort of forced me to approach this process in a more unified way instead of trying to patchwork together different ideas which ultimately did not work well together.

  2. NUnit In terms of why the decision was made to use the NUnit framework over the xUnit framework, amounted initially to its similarity to JUnit. Both offer various assertion methods making NUnit more familiar. I did discover after that decision was made that xUnit also offers assertion methods, although they are not exactly the same.

  3. LINQ Language Integrated Query (LINQ) allows you to express data queries directly within C#. It highly resembers SQL syntax with keywords such as SELECT, WHERE, etc. LINQ was introduced in C# 3.5 which was released in 2007. Prior to the addition of LINQ, developers would have to use ADO.NET or include SQL commands as Strings. This was clearly not ideal. When LINQ was released it allowed for a much more straightforward and reliable way of making database queries. Additionally, LINQ also works well with an Enumerator (Iterator in Java). This provided for a very easy and direct way of filtering the HashSet for specific data for the additional methods that were provided, basically eliminating the need for loops.

Additional Required Methods/Screenshots

Answer the following questions (and provide a corresponding screen showing output answering them)

  1. What company (oem) has the highest average weight of the phone body? Method1
  2. Was there any phones that were announced in one year and released in another? What are they? Give me the oem and models.
  3. How many phones have only one feature sensor? Method3
  4. What year had the most phones launched in any year later than 1999? Method4

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages