Skip to main content

Posts

Showing posts from March, 2020

Description of program highlighting language features

Description of program highlighting language features This program allows the user to enter an equation and the program will return the value the equation w ould equal as a polynomial. This program used a lot of print statements in order to debug the program. This program highlights the dynamic language features that Groovy has such as the key word def. The default parameter in groovy is a string so in this program, the coder needs to convert the parameter using the built in function, .toInteger().

Description of interesting language facet # 2

Description of interesting language facet #2         In Groovy, objects are used for almost everything. Due to the fact that Groovy uses objects, Groovy automatically will wrap the types of variables in the code. Something that is worth mentioning is boxing and unboxing. When the coder is converting a primitive data type to an object it is called unboxing. Likewise, when the coder is converting an object to a primitive data type. For clarification purposes, there are eight primitive types which are  boolean , byte , char , short , int , long , float and double. In Java, widening is done before boxing is done. Widening is defined as taking a small primitive type value and is automatically accommodated in a bigger primitive data type.  The first method is the method that Java prioritizes because it does widening rather than boxing. However, for Groovy, the second method would be the method that would be called because no matter what c...

Description of interesting language facet # 1

Description of interesting language facet # 1            Groovy is a unique language for many different reasons. One reason Groovy is different than Java in particular, is that Groovy is a language that has dynamic typing. This means the coder does not specify the data type of a given variable or method being instantiated. This allows the coder an environment that can be fast paced because the coder does not need to specify the data type. Programming languages that have dynamic typing are more efficient for the programmer.             One issue with dynamic typing is that it can be vague and it does not specify the type. This becomes an issue when coders are pair programming.

Implementation of binary search in the language

Implementation of binary search in the language                         Searing through data can be a very tedious task for the coder, so binary search was invented to search through data in an efficient manner. A key detail is that for the coder to use binary search to search through a set of data, that given data must already have been sorted in order for it to work.                         Binary search allows the coder to search through a sorted array or list of data in an efficient manner. In groovy, binary search is implemented by allowing the coder to divide the data in half and then check for the desired value. Then if the value is not in that given data set, the other half of the data set is checked. The data set is then divided into a new interval for the code This cycle is then repeated until the value is determined or the interva...