Programming languages are evolving faster in the Information Age. The rapid growth in the language features and new Programming languages being introduced in the market is overwhelming. It is difficult to keep up with this pace. Moreover organisations like Oracle which adopted 6 months release cycle using Agile process has given us very little time to learn new things and establish our stronghold. When I went through few of these Programming languages I found the usual pattern that conceptually they are very similar only the Programming construct is different. Hence I believe the concept is more important than Programming language construct.
Let's take an example of Groovy and Java 8. Both of these languages have the concept of lambda but the programming construct is different. In Groovy Programming language they call it Closure and in Java 8 they called it Lambda. The concept is same to pass code as an argument. The concept of code as an argument is to extract the reusable code or extracting change from the constant.
Above image shows how the way we could write the code is Groovy vs Java. In case of Groovy the curly braces are wrapping the entire code in case of Java parameters are outside the curly braces. Now we can argue that the differences are not limited to these but each Programming language will provide different options and restrictions. The implementation they follow may be different. But if we learn the very basic concept then we can write better code. We get engrossed in learning the programming constructs and then hardly find time to understand the concept. Hence start understanding the concept first then you can go to the language construct. When you are learning a new Programming language, even if you may not know the construct but the concept being similar all you need to do is learn the construct.
In this case we are looping through the list of contacts and based on the type of contact whether Email, Instant Message ID and Mobile Number we are sending appropriate Notifications to destination. Here notification type varies with Destination. The constant in this case is to LOOP through some list and based on the the CONDITION ( Predicate ) we are performing certain ACTION which varies based on the condition. We have now created a generic code which will follow same pattern
LOOP -> CONDITION -> ACTION
Noticeable feature here is that the generic code can invoke a code ( i.e Condition and Action ) which is passed as an Argument.
With this thought process it does not matter if you know many Programming languages or not but learning any new Programming language will be easier for you.
Comments
Post a Comment