Posts tagged "programming languages"

What Is the C – – Programming Language?

March 20, 2019 Posted by Programming 0 thoughts on “What Is the C – – Programming Language?”

C – – is a compiler language created by Simon Peyton Jones and Norman Ramsey that’s intended to be the output of compilers used in high level languages.  A great way to remember the purpose of the language and its relation to C is to think of it as a low level C, hence the double minus. Version 2 of the C – – specification defines the purpose of the language as follows:

  1. C-- encapsulates compilation techniques that are well understood, but difficult to implement. Such
    techniques include instruction selection, register allocation, instruction scheduling, and optimization
    of imperative code with loops.
  2. C-- is a language, rather than a library (such as gcc’s RTL back end). As such, it has a concrete syntax
    that can be read by people, and a semantics that is independent of any particular implementation.
  3. C-- is a portable assembly language. It is, by design, as low-level as possible while still concealing
    details of the particular machine architecture.
  4. C-- is independent of both source programming language and target architecture. Its design accommodates a variety of source languages and leaves room for back-end optimization, all without upcalls
    from the back end to the front end.
  5. C-- is efficient—or at least admits efficient implementation. So C-- provides almost as much flexibility
    and performance (assuming a good C-- compiler) as a custom code generator.

C-- is not related to C, as some may be lead to be believed. C-- is much more related to assembly in that it exposes the word size, byte size, and “endian.”  This means that you can’t easily portC-- code written for one architecture to another architecture as you would be able to with C++, for example. The language also does not come with all the bells and whistles of a platform like JVM or LLVM. JIT compilers and libraries aren’t a feature ofC--. Rather, the language sacrifices features found in higher level languages for versatility. WithC--, a developer can develop their own code generator from the ground up.

Here’s an example of how a developer might implement recursion in C--:

/* Ordinary recursion */
export sp1;
sp1( bits32 n ) {
bits32 s, p;
if n == 1 {
return( 1, 1 );
} else {
s, p = sp1( n-1 );
return( s+n, p*n );
}
}
/* Tail recursion */
export sp2;
sp2( bits32 n ) {
jump sp2_help( n, 1, 1 );
}
sp2_help( bits32 n, bits32 s, bits32 p ) {
if n==1 {
return( s, p );
} else {
jump sp2_help( n-1, s+n, p*n );
}
}

If you’ve ever looked at assembly code, you’ll notice the more semantic C-- version of the jump command and the explicit reference to memory with bits32 as opposed to a type reference like int. Though C-- is not C, it’s obvious that it borrows heavily from C in terms of syntax. It’s just important to keep in mind that the strong similarity is merely superficial. The maintainers of the language explain the reasoning behind making C--‘s syntax similar to that of C:

“Many compiler writers have significant experience reading low-level C code; making the syntax C-like helps them benefit from this experience. There are a number of syntactic tweaks in C-- that make it easier to generate than C; for example, every operator has a prefix form, so it’s not necessary to use infix operators.”

 

In the end, the next time you hear a C-- joke between compiler engineers, you’ll know what they’re talking about.

 

Resources:

If you want to learn how to develop in C--The C-- Language Specification Version 2.0 is worth a read.

Please follow and like us:
0

4 Basic Programming Languages For Beginners

March 19, 2019 Posted by Programming 0 thoughts on “4 Basic Programming Languages For Beginners”

The field of programming can seem intimidating if you’re a newcomer–everywhere you turn, there seems to be yet another programming language lurking. You search on Google and find an article that lists 50 programming languages and you think to yourself, how am I supposed to know which one to choose?

Well, choosing a programming language shouldn’t be your entire focus if you’re a beginner. Your choice in a career will dictate what language you should learn, for the most part. For example, if you want to design websites, you should learn JavaScript and a scripting language like Python. Still, since you’re an absolute beginner when it comes to programming, it may be better off to forgo learning these languages until you truly understand what programming is all about.

In other words, you should learn how to cook before you worry about fancy tools; because languages are just tools used to solve problems and a good programmer knows what tool is best suited for a particular job. To become a good at programming, we should start from the basics. Below is a list of 3 basic programming languages for beginners.

It’s important to note that some of the basic programming languages here were defined as such due to the opinions of researchers and teachers. To define a language as being a basic programming language for beginners we also considered the context in which the language is used.

 

CoffeeScript and CodeMonkey

Image result for Codemonkey

 

CoffeeScript is not “basic” in that developers use this language in serious projects, though CoffeeScript is branded as ,” a little language that compiles into JavaScript.”

That in itself doesn’t make this language a basic language, but, when you pair it with CodeMonkey, you get to code with CoffeeScript in a very basic manner. You’re introduced to CoffeeScript in bite-sized chunks as you learn programming concepts like loops. And as you code on CodeMonkey you actually get to build games.

 

Scratch

Image result for scratch programming

Scratch is a block-based programming language that was created by MIT Lab’s Lifelong Kindergarten Group. Led by Mitchel Resnick, the team released the first version in 2003.  Now, as of 2019, there are over 46 million projects shared worldwide.

Scratch is basic in that blocks represent chunks of programming logic in colorful blocks. It’s the bright and interactive interface and the power behind the blocks that makes Scratch different from many of the other block based programming languages.

What makes text based programming languages difficult is not only the syntax, but the amount of code that has to be written before you can see some notable results. Scratch solves that by simplifying animations and game design processes.

 

Alice

Image result for alice programming

According to Randy Pausch, lead developer of the bloc-based programming language, Alice was named after Lewis Carol’s creation: “Carroll was a mathematician, novelist, and photographer. Most important, he could do intellectually difficult things but also realized the most powerful thing was to be able to communicate clearly and in an entertaining way. This inspires our efforts to make something as complex as computer programming easy and fun.”

Alice, like other block based programming languages, uses a drag and drop interface to facilitate easy development. Despite the absence of syntax, the language teaches its users how to build programs using object oriented principles that are often used in text based programming languages.

A key thing to note about Alice is that its interface isn’t as simplified as Scratch. The work environment emulates an IDE. At the same time, the muted colors remove the stigma that block based programming languages have, that these languages are kid-only languages. If you’re above the age of 16 and you’re uncomfortable using something that is clearly geared for kids, you have this option.

 

 

Swift and Swift Playgrounds

Image result for swift playgrounds

Swift, a text-based language, is Apple’s proprietary programming language used to build iOS apps. You can learn how to program in that language by using Swift Playgrounds. In some ways, Swift Playgrounds embodies the principles of block-based programming languages because you can make elements move by using “function blocks.” Yet, you still get the practicality of text based languages.

With Swift Playgrounds, you can truly learn what functional programming is all about. You can string a bunch of small functions and put them all into one function that will execute them, you can loop functions, and so on.

The clean interface encourages creativity and exploration. You can go as far as programming drones, so there is room for beginner and advances users alike. For Apple users, the best basic programming language to choose within a user-friendly context just may be Swift.

 

 

 

 

Please follow and like us:
0

5 Programming Languages Used To Program a PLC

March 5, 2019 Posted by Programming 0 thoughts on “5 Programming Languages Used To Program a PLC”

 

Before we go through the 5 PLC languages, let’s briefly mention what a PLC is. Programmable Logic Controllers(PLC) were designed to replace electromechanical relays. Back in the day, you had to get an electrician to risk life and limb to rewire the relays if you wanted to make an adjustment to a line. With the advent of PLCs, electricians were taught how to use programmable logic to make updates.  

Programs that allow for such updates are often written on a PC, and then transferred via cable or USB to the PLC itself. These programs are stored in non-volatile memory to ensure that the processes they are designed to control continue to run smoothly. You don’t want the program that controls prison doors in high security prisons to suddenly be wiped out.

Like any other machine that can execute programs, there are a bevy of languages available to break down into machine code. The languages below have their use cases. Some are great for their simplicity within the context of electromechanics while others are great because of their complexity.

There are only 5 languages that are considered to be standard languages for use on PLCs, according to IEC section 61131-3. Here they are:

 

Ladder Diagram (LD)

Image result for ladder diagram

image source: Wikepedia

 

Ladder Diagram is the oldest PLC language. This graphical programming language was modeled from relay logic to allow engineers and electricians to transition smoothly into programming PLCs.

Within Ladder, rungs and rails represent the real world electrical connections. Specifically, the vertical “rails” represent the supply power of the device while the rungs that are connected to the rails are equal to the amount of control circuits.

Input conditions can be written in input terminals, which then impacts the output on the output terminals. The dearth of instructions in ladder logic makes it difficult to model motion or batching–understandably so, because ladder logic strictly adheres to the on/off logic of hard-wired relays.

 

Sequential Function Charts

 

image source: inductiveautomation

 

A sequential function chart is a graphical programming language that mimics a flow chart. You use steps and transitions to get output.

Steps are functions within the program and house events that are activated based on state and other specified conditions.

Transitions are instructions based on true/false values that move you from one step to another.

Branches are used to initiate multiple steps at a time. The branches act like threads where functions can run concurrently.

All of these steps, transitions, and branches are housed in a series of scripts that execute in a procedural manner. The visual nature of the language allows users to monitor processes that both heavily use conditional logic and run parallel instructions. PLCs that are prone to suffering from bottlenecks can be more intuitively maintained and troubleshooted using the chart to follow the logic of the program.

 

Function Block Diagram

 

Image result for function block diagram

image source: shneider-electric

Block based programming languages are a type of graphical language that minimizes code into blocks, which allows for a simple way to create executable commands.

FBD in particular describes a function between inputs and outputs that are connected by connection lines. The logic of the inputs and outputs are stored in blocks. The blocks are programmed onto sheets and the PLC scans these sheets in order or by specified connections between blocks, much like procedural languages.

The I/O focus mirrors that of ladder logic. Yet, the code that the blocks contain allow engineers to develop more complex batch control tasks among other repeatable tasks.

 

Instruction List

 

Image result for plc instruction list

image source: ResearchGate

 

This is the PLC’s equivalent to assembly language. This gives you immediate access to the machine itself, which allows you to write code that is compressed and fast. The code is represented in the manner that the language’s name suggests: in a list of commands.

 

Structured Text

Image result for structured text

image source: contactandcoil

 

Structured Text  is a high level language designed to program PLCs. This is essentially the C++ of the PLC world. Any PLC that requires complex data handling will most likely use ST.

 

Resources:

https://www.allaboutcircuits.com/textbook/digital/chpt-6/ladder-diagrams/

https://docs.inductiveautomation.com/display/DOC79/Sequential+Function+Charts

https://en.wikipedia.org/wiki/Programmable_logic_controller

 

 

Please follow and like us:
0

50 Most Popular Programming Languages of 2019

February 26, 2019 Posted by Programming 0 thoughts on “50 Most Popular Programming Languages of 2019”

 

Programming languages are sometimes talked about as if they are interchangeable. The C++ engineer may espouse a thousand reasons why her programming language is better than Java or Kotlin. Yet, for most Android apps, a majority of the code is written in Java or Kotlin.

So, within the framework of mobile development, the Java engineer has no time to argue about the pros and cons of her language. The ubiquitous nature of the IoT and the number of developers who are proficient in Java combine to make Java a very popular language despite its known flaws(Kotlin was created as a sort of bandage).

We can conclude that popularity does not necessitate that one language is better than the other. Trends often dictate popularity. For a time, Ruby was one of the most popular languages and its growth positively  correlated with a   rise of coding bootcamps. As coding bootcamps have waned in popularity, Ruby has also waned in popularity. It has now been usurped by Python. And what’s popular now? AI.

Below is the top 50 programming languages so far in 2019 according to the TIOBE index. The software quality company rated these languages by analyzing results from search engines that include the number of skilled engineers, courses, and third party vendors. Description of the languages have been added below.

 

1 Java

Java is a general purpose programming language that is highly portable due to the fact that compiled code runs on a Java virtual machine.

2 C

C is a low level programming language that translates efficiently into assembly code. Because of this, it is used to write other high level languages.

3 Python

Python is an interpreted, high-level, general-purpose programming language. Created by Guido van Rossum and first released in 1991, Python has a design philosophy that emphasizes code readability, notably using significant whitespace.

4 C++

C++ is a compiled programming language designed for  system programming with performance, efficiency and flexibility of use as its design highlight.

5 Visual Basic .NET

Visual Basic .NET is a multi-paradigm, object-oriented programming language, implemented on the .NET Framework. Microsoft launched VB.NET in 2002 as the successor to its original Visual Basic language.

6 JavaScript

JavaScript is a single-threaded non-blocking asynchronous concurrent language used mainly to create interactivity in web pages.

7 C#

C#, not to be confused with C or C++, is actually a product of Microsoft’s .NET initiative.

8 PHP

PHP is a dynamic programming language primarily designed to create web applications.

9 SQL

SQL is a domain-specific programming language in that it has a singular purpose: to query a database.

10 Objective-C

Objective-C is a general purpose programming  language that was widely used to develop iOS applications before Swift arrived.

11 Assembly language

Assembly Language is a low-level programming language. Only machine code is lower than assembly code. An assembler compiles assembly code into machine code.

12 MATLAB

MATLAB is a computational programming language developed specifically for MathWork’s software.

13 Perl

Perl is a dynamic programming language that borrows features from C,shell script, AWK, and sed.

14 Object Pascal

Object Pascal is an extension of the Pascal language that was developed at Apple Computer by a team led by Larry Tesler in consultation with Niklaus Wirth, the inventor of Pascal.

15 R

R is a programming language designed for statistical computing and graphics. The R language is widely used among statisticians and data miners for developing statistical software and data analysis.

16 Ruby

Ruby is a dynamic programming language that is often used in conjunction with Ruby on Rails to scale web apps quickly.

17 Visual Basic

Visual Basic is an event-driven programming language that was derived from BASIC. It is no longer updated.

18 Go

Go is a procedural programming language developed by Google with the benefits of a dynamic scripting with the inclusion of a packet management system.

19 Groovy

Groovy is a functional programming language that is compatible with the Java platform due to its similarity in  syntax.

20 Swift

Swift is a general purpose language that was developed by Apple. It is compatible with  Objective-C, which is compatible with C++.

 

21 PL/SQL

PL/SQL is a procedural language designed specifically to embrace SQL statements within its syntax.

22 SAS

The SAS language is a computer programming language used for statistical analysis.

23 D

D is a general purpose systems and applications programming language that is used to interact directly with the operating system API’s and with hardware.

24 Lua

Lua is a embeddable scripting language that allows for  an all in one package of procedural programming, object-oriented programming, functional programming, data-driven programming, and data description.

25 Dart

Dart is a general-purpose programming language used to build web, server, desktop, and mobile applications.

26 Fortran

Fortran is a general-purpose, compiled imperative programming language that is especially suited to numeric computation and scientific computing.

27 COBOL

COBOL is a compiled computer programming language designed for business applications. It has always been imperative and procedural and has recently become an object oriented language

28 Scratch

Scratch is a visual programming language for kids where blocks are used to represent chunks of code.

29 Scala

Scala is a general purpose programming language that combines object-oriented programming and a functional programming. It’s concise, statically type design addresses the criticisms of Java.

30 ABAP

ABAP is a programming language used to develop business solutions using the SAP Application Server in conjunction with the language.

31 Lisp

Lisp is one of the oldest high-level programming languages. Because of its focus on data structures, Lisp was used for data modeling. Languages like Scheme, Closure, and Common Lisp derived from Lisp.

32 Logo

Logo is a general purpose language that provides a watered-down version of Lisp for use in an educational setting.

33 Ada

Ada is a structured, statically typed, imperative, and object-oriented high-level computer programming language, extended from Pascal and other languages.

34 Transact-SQL

T-SQL (Transact-SQL) is a set of programming extensions from Sybase and Microsoft that add several features to the Structured Query Language (SQL), including transaction control, exception and error handling, row processing and declared variables.

35 Prolog

Prolog is a logic programming language associated with artificial intelligence and computational linguistics. It is not algorithmic.

36 Scheme

Scheme, a dialect of Lisp, is a general purpose programming language created at the MIT AI Lab in the 1970’s

37 Rust

Rust is a general purpose programming language that was designed to provide a safer alternative to C++.

38 Kotlin

Kotlin was developed to overcome Java’s major flaws, some of which include raw types and checked exceptions,

39 Haskell

Haskell is a statically typed, purely functional programming language. It’s mainly used for business logic and prototyping.

40 G

A visual programming language used in conjunction with labVIEW(Laboratory Virtual Instrument Engineering Workbench).

41 Julia

Julia is a high level dynamic language designed for numerical analysis and computational science.

42 Tcl

Tcl is a dynamic programming language that is commonly embedded into C applications for prototyping and testing.

43 PostScript

PostScript is a page description language in the electronic publishing and desktop publishing business. It is a dynamically typed, concatenative programming language and was created at Adobe Systems

44 Ladder Logic

Ladder Logic is a programming language that produces a graphical diagram based on the circuit diagrams of relay logic hardware.

45 PL/I

PL/I(or Programming Language One) is a procedural programming language that can manipulate complex data formats.

46 Hack

Hack is a programming language for the HipHop Virtual Machine, created by Facebook as a dialect of PHP.

47 Erlang

Erlang was developed by Ericsson to aid in the development of software for managing a number of different telecom projects, with the first version being released in 1986, and the first open source release of the language in 1998. It’s most noted for its simple concurrency model.

48 Standard ML

Standard ML is a functional programming language that is widely used by compiler writers and computer science researchers.

49 RPG

Not to be confused with the video game genre, RPG is a high level programming language internally used by IBM.

50 Bash

Bash is a command language written by Brian Fox and is used within the Bash Shell, which runs Bash scripts. Confused yet?

 

Please follow and like us:
0

Retired Hacker In The 80’s Wrote “Raunchy” Code With BASIC Programming Language

February 25, 2019 Posted by Programming 0 thoughts on “Retired Hacker In The 80’s Wrote “Raunchy” Code With BASIC Programming Language”

After digging through the archives, I pulled up some raunchy algorithms written by an amateur programmer in the 80’s. What’s interesting to note is how amateur hackers back in the 80’s sometimes worked like pulp fiction writers by publishing code to computer books and magazines. The contributor to The Dirty Book was a retired Ham Radio Operator who knew how to write BASIC code on a Commodor PET. To have his submission fit the style of the book, he wrote a “Dirty Word” generator.

Another point to take away is that during the period of the 80’s, especially with the advent of Atari, software and code started moving out of laboratories and into homes where hobbyists would make software on their free time. Whereas you now need teams of engineers to complete tasks, you only needed one coder to sit in their home office and spin up code Bandersnatch-style.

Here’s the BASIC code. The profanity and suggestive terms have been removed and what you have left are funny verbs, adjectives, and adverbs:

Please follow and like us:
0

Students In Pakistan And Afghanistan Are Learning How To Program

February 22, 2019 Posted by Programming 0 thoughts on “Students In Pakistan And Afghanistan Are Learning How To Program”

Programming is a worldwide phenomenon that has produced some of the most notable apps known to humankind. As more and more citizens expect to be serviced in some way by one app or another, the demand for programmers will only begin to grow. In 2016, there were over 35,000 Computer Science degrees awarded in the United States alone. China and India have also seen a rise in their tech sector and have been considered within the same league as Silicon Valley’s startup culture.

Countries that are not often mentioned when talking about the rise of developers is Pakistan and Afghanistan. Despite the political strife that have embroiled these countries in violence, there are still ordinary students who dream to one day become developers. In order to help make this dream come true, FreeCodeCamp has set up base in both of these countries to teach aspiring students there the fundamentals of web development.

FreeCodeCampKarachi has a Facebook page that welcomes fellow coders to join their program and meetups whether they be male or female. The contributors are students, workers, and entrepreneurs whose goal is to spread JavaScript knowledge to beginners.

In so doing, they’ve make Karachi, Pakistan an incubator for young talent. Experienced coders are paired with those who are less experienced and all the while the values of Open Source development are imbibed into the coders.

The group even has a podcast with topics that discuss women’s roles in tech and breaking down stereotypes among many other social and technical topics.

Just an hour’s flight away, CodeWeekend is creating savvy developers in Kabul, Afghanistan. By combining weekly practise sessions and monthly networking events, CodeWeekend’s organizers are allowing young Afghans the opportunity to achieve success in a country that has been frayed at the edges by war.

It’s appropriate that freeCodeCamp’s symbol is a torch because the non profit organization that has been based in Kabul have been living examples that shared knowledge is a light that overcasts any shadow.

Taking all of this into account, we can see that the world has become increasingly more app-based and wherever you look, there’s someone who now wants to learn to code. Routers and modems have become the highways of the 21st century, spreading information across the globe. Because of this, a web surfer from Indonesia might be reading this article right now.

We’ve become a more connected society. No longer can we turn a blind eye to the suffering of Syrian refugees or the persecution of Uyghurs. Software engineers and their entrepreneurial leaders have forged our ties to places like Twitter and Facebook. There is still a west and a east, but now we’re simply separated by artificial VPNs and firewalls and censorship.

Perhaps learning to speak the same language, the language of code, may finally bring us together. At least a small group of students in Kabul and Karachi are trying to impact their own societies by learning the languages that make the web run.

Please follow and like us:
0

Compiled Programming Languages vs. Interpreted Programming Languages

February 21, 2019 Posted by Programming 0 thoughts on “Compiled Programming Languages vs. Interpreted Programming Languages”

I read a book titled Liar’s Poker some time back. It was written by Michael Lewis and it chronicled his stint at Salomon Brothers. One of the terms used to characterize traders who raked in money for the company was Big Swinging You know What. I added the You Know What, but you get the idea. The term was meant to describe the sort of pride that haloed a successful trader.

The point is that programmers–both women and men–can sometimes wear their preferred language like a halo, looking down on the other less endowed. One of my favorite lines about this hierarchy within the field of programming comes from Steve Yegge, a satirical blogger/rant artist/ software engineer.  Here’s his description of what he coins the DAG of Disdain:

“At Google, most engineers are too snooty to do mobile or web programming. ‘I don’t do frontend’, they proclaim with maximal snootiness.

There’s a phenomenon there that I like to call the ‘DAG of Disdain’, wherein DAG means Directed Acyclic Graph, which is a bit like a flowchart.

At the top of Snoot Mountain sit the lofty Search engineers writing in C++, which is considered cooler than Java, which is cooler than Python, which is cooler than JavaScript.

And Search is cooler than Ads, which is cooler than Apps, which is cooler than Tools, which is cooler than Frontends. And so on. Programmers love to look down on each other. And if you’re unlucky enough to be a Google mobile engineer, you’re stuck scuffling around at the bottom of several totem poles with everyone looking down on you.”

Of course this is at Google, which isn’t exactly known for its robust UI. It’s known for its powerhouse of a search engine with marketers talking about its new algorithms like they talk about restaurant specials. But just like the bond traders at Solomon, the demand for C++ programmers is high, which drives up their value, and, for some, their egos.

They live in their paradisaical niche of compiled programming languages lording it over those who share their realm and batting a slanted eye at that other realm: the interpreted languages and the jank often associated with them.

To speed demons of the ilk of C++ programmers, a JavaScript developer is racing on a tricycle.  Or, better yet, a 2001 Jaguar X-Type badly in need of a tune up. Eventually, JavaScript developers will have to visit the local C++ tune up shop if they ever want their app to scale.

So, when it comes down to it, what is better? A compiled programming language? Or an interpreted programming language? A few developers actually have a friendly discussion about this matter. Here are their responses.

 

On The Fence

 

Rob Hoelz

At the risk of being pedantic, there’s no reason you can’t have both a compiled and interpreted implementation of a language – for example, Haskell has GHC, which compiles down to native code, and the lapsed Hugs implementation, which is an interpreted implementation of Haskell. Scheme and ML are other languages which have both interpreted and compiled implementations.

Then you get into interesting territory with languages like Java, which are compiled to bytecode, and the bytecode is interpreted (and possibly just-in-time compiled) at runtime. A lot of interpreted languages – Python, Ruby, Lua – actually compile to bytecode and execute that when you run a script.

Performance is a big factor when it comes to interpreted vs compiled – the rule of thumb is that compiled is faster than interpreted, but there are fancy interpreted systems which will generate faster code (I think some commercial Smalltalk implementations do this).

One nice thing about compiling down to native code is that you can ship binaries without needing to deploy a runtime; this is one of Go’s strongest features, in my opinion!

Dustin King

Ideally, it would be like Common Lisp in that it has interpretation and compilation both built in from the start. ANSI Common Lisp described it as having “the whole language there all the time”: you can compile code at runtime, or run code at compile time (which allows for lots of metaprogramming).

When you want fast iterative development, you want interpreted code. In production (and especially on resource-constrained devices), you want code to run as fast and memory-efficiently as possible, so you want it compiled. The ideal language would make it effortless to transition between the two as needed.

Derek Kuhnert

It all depends on the intended purpose.

Compiled languages:

  • Are faster at runtime
  • Conceal source code
  • Have associated compile time
  • Are better when you’re not making frequent changes to the code, and care a lot about runtime speed

Interpreted languages:

  • Are slower at runtime
  • Have open source code, but that code can be obfuscated (minification, uglification, etc)
  • Don’t have to compile before use, but can have an initial parse time that’s typically much faster than compile time
  • Are better when you are making frequent changes to the code, and don’t care as much about runtime speed

There are also factors regarding whether you need additional software to be able to run the code, but languages like Java (compiled but still needs the JVM) kinda muddy the waters on this.

For Interpreted Languages

 

Ben Halpbern, in response to Rob Hoelz:

I don’t think this is pedantic, I feel like it’s a great evaluation of the whole question.

I personally take the give and take of each scenario and don’t draw the line for my own uses.

In my life these days, I’ve been writing Ruby and JS for the most part but a bit more Swift for iOS lately. I don’t like that I have to wait to compile and run when I write native in Swift, but I accept it as part of the world I’m in when I work with this tool.

I hope in the long run that good work keeps going into making interpreted code more performant and compiled code easier to work with.

 

rhymes

I don’t like that I have to wait to compile and run when I write native in Swift

That’s one of the “selling” points for Go, the fast compilation times, in my experience it invalidates this:

compiling

I’m sure Swift compilation phase is also “slowed” from the enourmous amount of stuff you have to compile for a mobile app to function 😀

 

For Compiled Languages

 

Casey Brooks

I am a huge Java and Kotlin (compiled languages) fanboy, and really don’t care much for Groovy, Javascript, Ruby, or Python (all interpreted languages). One of the main reasons why I like compiled languages is because it gives me a sense of safety in refactoring that you don’t get with interpreted languages.

For example, if I change a variable name and forget to update the code that used that variable, a compiled language will fail to compile, and I am forced to fix it everywhere.

In an interpreted language, even one that is preprocessed using something like Webpack, you can’t know for sure that you’ve renamed the variable everywhere until you start getting errors at runtime.

You can mitigate it with static analyzers, but that’s just an extra thing you have to get set up, which comes for free with compiled languages.

 

Yaser Al-Najjar 

Compiled languages just win on everything (performance, reliability,

But, most famous enterprise backend langs (Python, C#, Java… etc) are using both of the best worlds… they get compiled into some special binary format, then an interpreter on any platform (android, ios, win, linux) gets that special code and execute it.

All that to achieve super cross-platform, and they do work on virtually all devices.

Ah, JS is an exception 😀

[continuation]

C / C++ are just faster than any other lang (given we use the latest compiler optimizations and the right implementation of the software)… Perl interpreter itself is implemented in C & C++.

All the people here agree on this point: news.ycombinator.com/item?id=8626131

Ditto for reliability. I can’t see C being more reliable than Haskell, for instance.

From my experience, run-time errors occur more in interpreted languages than compiled languages. I do Python and C#, and I face lots of run-time errors in Python than C#.

 

Paul Lefebvre

Interpreted languages can often give you more instant feedback when coding. But they also typically have slower code and you might have to ship your code in source (or obfuscated) form with the run-time interpreter which is often less than ideal.

Then there are intermediate languages that are compiled a bit, but still use a run-time. Java and C# come to mind here.

Then there are fully compiled languages. Compiling your code to native machine code is nice for source security. Performance is often better as well, but the compile process can take time.

I guess I would prefer a fast, compiled language these days.

 

Zuodian Hu

A lot of people are arguing about performance.

Assuming good implementation:

Compiled languages are faster in general because they don’t need to run through any intermediate interpreter. Instead of finding out what needs to be done and then doing it, at run time the program just does what needs to be done.

In an interpreted language, the program needs to first figure out what needs to be done (be interpreted), then it can go and do it. The sorts of optimizations that this allows can reduce the interpretation overhead, but I can’t think of a practical and useful way it can turn that overhead around into an advantage.

 

tux0r

Compiled languages always have a superior performance and require much less resources at runtime. Interpreted languages are neat while debugging, but if they don’t have a compiler, they’re out for me.

 

What Are Your Thoughts?

 

Please follow and like us:
0

1983 Conference Program Was Already Concerned About Teaching Youth Programming

February 15, 2019 Posted by Programming 0 thoughts on “1983 Conference Program Was Already Concerned About Teaching Youth Programming”

I came across a conference program for “Computer-Using Educators” that took place in 1983. Even back then, terms like “computer literacy” were being thrown around when it came to educating students.

I thought the program might stop at basic computer operations and software uses, but there was a second section dedicated to implementing full-fledged computer science courses in schools as well as teaching seminar attendees languages of the time like Logo.

There was one program proudly titled, “Debuggers Seminar for Logo Users”. In that seminar users could learn more Logo which would probably then allow them to teach what they’ve learned to students. Another seminar called for implementing Logo and BASIC not for  teenagers alone, but for elementary school students from Kindergarten to 5th grade.

 

The big point that’s worth making here is that we’ve always seen the need to introduce computer science courses to students. Yet, decades have gone by, new languages have been developed, and still it’s newsworthy to actually have a school that has a k-12 computer science program. An Education Week article written a year ago mentioned that some classes even consider learning how to type on a computer as part of a computer science curriculum. Perhaps that’s why I’m so shocked by the seemingly radical proposals put forth in the 1983 program. Sure most of them were geared towards the educators, but the idea that fifth graders could be learning to use BASIC is stunning when it shouldn’t be the case. By fifth grade, students are learning grammar and are performing calculations that they would perform in programming languages.

Now more than ever, children as little as seven can manipulate user interfaces. The world is becoming one in which technology is inescapable. The need for computer literacy as it pertains to software use is a concern of the 80’s. Now, we can move on to program literacy whereby students can learn to develop their own apps to solve their own problems just as they gain textual literacy to communicate.

 

 

 

 

Please follow and like us:
0

How Programmers Learn New Programming Languages

January 22, 2019 Posted by Programming 0 thoughts on “How Programmers Learn New Programming Languages”

 

When you’re learning a programming language for the first time, it can be exciting to learn the syntax of that language. You’ve probably explored languages like JavaScript and Ruby by coding along with samples provided to you by a book or online tutorial. It may feel like you’re learning a lot, but when you complete these tutorials, you may find that you’re not sure how to apply the basic concepts of the language you’re learning. How can JavaScript functions help you build a website, you wonder.

That’s the problem with treating the process of learning a programming language like the process of learning a spoken language. Just because you know the syntax rules of JavaScript doesn’t mean you know how to code. The key to learning new languages is to apply them to real world situations. In other words, you have to try to build applications with the language. This step will be one of the toughest hurdles to overcome in your journey towards acquiring mastery of a language, because it requires getting rid of a mentality whereby knowledge is learned by consuming text.

In the case of programming, you learn them by taking concepts and applying them to solve a certain problem. For example, if your website requires a menu that slides open with the click of a button, you need to figure out how to accomplish that with a language like JavaScript. You Google your problem, find the solution, and apply it to your situation.

The question then is what do you build? Four programmers will tell you how they learn programming languages.

 

Programmer 1

I build fully managed blogs and Twitter clones to practice new languages. It encompasses most techniques used in the real world, and enough of each to get some good practice in doing real world data processing and handling with a display and management layer.

Building a clone of a website is an excellent way of developing your programming skills without having to spend too much time thinking about design. Clones also allow you to show off your skills to future employers. So if you ever have the doubt that you’re not creative, just copy the style and function of your favorite website.

Programmer 2

To learn other languages, I like using sites like codingame.com, many little challenges, it helps me to learn a new languages and hone my skills. For Frameworks it’s something more substantial like a project or little website or Web API.

Programmer 3

I learn new skills (a new framework, practice backend, design process) in Chingu — great place to just take on a project and apply whatever new thing you need to practice.

Disclosure – after doing it a few times, I now work for Chingu. I still highly recommend it!

Websites like Codin Game and Chingu allow coders of every level to build projects together. If you lack the motivation to build a personal project from the ground up, you can join these coding communities to build cool applications. In the process of collaborating with others, you’ll be able to pick up tricks that you probably wouldn’t learn in a textbook. These websites are also a great way to network because at the end of the day, you want to be able to get paid to code. Employers sometimes scout coders on these types of websites. Hacker Rank and Code Wars are two more examples worth exploring.

Programmer 4

You could use the projects you do at work as a starting point for inspiration. Try to look at the smaller projects. Note down the core functions and features of that project. Then you can research on the best way to implement that project in the language you’re learning. The key is to keep at it though, because many times you may run into many roadblocks and dead-ends before finding the path that works best for the language you are learning.

This tip applies to those who are at least at an intermediate stage in their learning. As you learn more concepts, you can refer back to the rudimentary projects you built and refactor the code so that you can add concepts you’ve learned. You can document the changes you make to give yourself a sense of the progress you’ve made.

Conclusion

No matter what stage you are in your learning, you will get the sense of imposter syndrome; you’ll doubt your accomplishments, feeling like you don’t know enough to start a certain project, that you’re not cut out for programming because you don’t fit a certain stereotype. The amount a developer has to learn to keep up with changes can be overwhelming at times. The key is to realize that you don’t have to know everything about a language. You just need to know enough to build your next project.

 

 

Please follow and like us:
0

Programming Languages You Need To Know To Build A Website

January 7, 2019 Posted by Programming, Uncategorized 0 thoughts on “Programming Languages You Need To Know To Build A Website”

When you want to get somewhere but you don’t have any idea how to get there, you’re probably going to use a GPS or some other pathfinder. The same should apply to building a website for the first time. However, instead of telling you how to get there, many blog posts tell you what you need to get there. They’d list the technologies you need to know to build a website but they won’t show you the path. 

The purpose of this post is to show you the tools you need to build a website and how these tools will contribute to building your first website.

Let’s start off with the basics, shall we?

Text editor

Get a text editor and love it, because you’re going to be staring at it while gnashing your teeth at every new problem that arises. You can save a lot of trouble by becoming familiar with your editor’s quirks.

Sublime and Atom are the best GUI options, in my opinion. Having used Sublime, I can tell you that the customization options are seemingly endless. Give it a go.

Command line

No, hackers are not the only people who use command lines. Don’t run away from it. This black screen will become your closest virtual friend in due time.

Go through this painless tutorial here

If you don’t need any hand holding, check out this cheat sheet

Front End and Back End

Once you grasp the tools, it’s important to know that the field of programming is vast. If you only want to create your own blog, then you should focus on front end development. You can think of front end development as the store front of a website. Almost everything that a user of your website can see and interact with is the front end of development. The primary languages used here are HTML, CSS, and JavaScript. We’ll break down how you’ll go about learning these languages later, but, in a nutshell, HTML is like the scaffolding of a building, CSS is like a building’s exterior and interior design, and JavaScript is the wiring of the building. What you get by implementing these languages is a website that is structured, stylized, and functional.

On the other hand, if you want users to log in to your website and if you want to track their activities, you will need a back end. Building a back end requires knowledge of scripting languages like PHP, Python, and Ruby. You also need a database like MYSQL and  Postgresql to store a user’s data. Adding these features to a website makes it dynamic.

Now, Let’s Learn Languages

Before we get into languages, let’s talk a little bit about files. Every web project requires an organization of files. The more complex your website is, the more organized you have to be.

It’s a good idea to learn how to organize files before you start coding. It’ll make your life easier. This website breaks down how to organize a basic website.

Essentially, the file structure of a very basic front end project  looks like this:

In the main folder, you have your project name–in this case, awesomewebsite. Within that folder, you have your style sheet folder(CSS), your scripts(JS), and anything else you may need.

HTML

HTML helps form the skeleton of the website. Most website consist of a navigation bar, main content area, and a footer.

<!Doctype html>
<html>
<head>
 <title>MY Website</title>
</head>
<body>
 <!-- Navigation section-->
 <header>
   <p>Home Page</p>
 </header>
 <!--Main Content -->
 <section>
 </section>
 <!-- Sidebar --> 
 <aside>     
 </aside>
  <!--Bottom -->
  <footer>
  </footer>
</body>
</html>

CSS

Now you have to make these elements look presentable. This isn’t as hard as it seems. Remember that every HTML element is a potential box. Look at your favorite websites. The most common shape is a quadrilateral, or a four sided figure. All of these quads are positioned nicely using a grid system. Colors and shadows and thingamabobs are then added to create a unique user experience. This is CSS in a nutshell.

If you want to do cool things, like applying shadows, just ask Google.

Tip: to see your styling effects, you have to link your style sheet in the <head></head> tag of your HTML file. The link would look like this:

<link rel="stylesheet" type="text/css" href="css/filename.css">

“Filename” is whatever name you decide to give your CSS file. If your stylesheet isn’t in a folder, then you don’t have to include the relative folder path.

JavaScript

You only need to learn the essentials of JavaScript. Javascriptissexy.com is one of the best sites to learn about every nook and cranny of this language. 

If you’re still nervous about grasping this language, you can go really slow by learning JavaScript from the ground level at Codecademy.

When you click a button, an event occurs. The specific library we use to create events is called jQuery.

  • Learn jQuery from scratch here

Tip: to see your JavaScript events, you can link your script in the <head></head> tag of your HTML file. The link would look like this:

<script src="myscripts.js"></script>

Wrapping Up The Front End

This is all you need to learn if you want to create a static website like a portfolio or a personal site. You can skip all of the server stuff. To host your site, you can use free hosting. One I’ve found to be user-friendly is Github Pages.

But, if you want to make the next Facebook, you need to learn the back end.

Server-side Languages

Nodejs(server-side environment for JavaScript), Ruby, Python, PHP are the four primary server-side languages used to create dynamic websites. Anything that needs to be updated on a website requires the server. A log in attempt immediately triggers an exchange of information between the client and server.

I’m not going to dive into every single language. You have to pick one. Nodejs is hot right now, so if you feel comfortable with JavaScript, go for it. Ruby is easy to use and has superb documentation. Python has similar syntax, but less support than Ruby. PHP is widely used and relatively easy to learn.

After you pick your language, you need a database. Server frameworks use databases to save, fetch, update, and delete data. Keep that in mind as you read this guide.

MongoDB, PostgreSQL, and MySQL are some of the database management systems that get thrown around every so often.

Once you’ve picked your server-side language and database, try learning:

 

1) A Server Framework

Frameworks make it easier to build web applications from scratch. Every language has its own particular framework. Mozilla breaks them down here

2) The MVC File Structure

If you pick a framework, this is the way you should think about web programming from now on. Of course there are other structures, but this a good one to start out with for your first project.

  • Model: Object Oriented Programming (OOP) in insert language

I know, I know. Wax on, wax off, right? How does OOP help? Well, in the back end, every form of data is an object. For example, every user on Medium is a user object.

In Ruby, using the Rails framework(this is a crude example), a user will look like this:



class User < ApplicationRecord

 #Lot of relationships goin’ on in here. More on that later.

End

 

The controller is used to render HTML pages depending on the route. Within the route method, you can manipulate data from the database which would then be showed in the view.

I’ll pseudo code an example. Note that frameworks will abstract HTTP routing in their own way:

GET /users

let users = User.findAll

render the index.html.faketemplate

Everything you learned about HTML applies, but now you can inject your server language in your HTML files to create dynamic content. If you have 10 users in your database, you can loop through all of the users we stored to the users variable in the controller and render them.


#this is just pseudo code
index.html.faketemplate
{loop through users.each do}
 <div class= ‘user-card’>
   <p>{user.name}</p>
   <p>{user.summary}</p>
 </div>
{end}

There are many templates to choose from. Mustache is a popular one. Check it out.

3) How to integrate the database

If you look up at the template pseudo example, you’ll see that each user object has accessible attributes. These attributes are defined using what’s called a schema. Essentially, a schema is a fancy word for a table of organized data.

If you’ve been using a framework, then you’ll see now that the hard work of learning a framework’s nuances payoff here. When I pseudo coded User.findAll, “findAll” was an abstracted method. The SQL equivalent would be SELECT * FROM users. Yeah, I’d stick with the abstraction.

Schemas are blueprints for SQL tables. Note that frameworks will use syntax from your chosen server-side language for table creation. Under the hood, SQL is driving everything.

Once you create a table with the aid of a framework, this table is mapped to an object. The object corresponds to the Model you create. In my case, its the User model. This is what Object Relational Mapping is all about(ORM). The relational aspect describes the relationship between objects.

Let me clarify that non definition with an example: a user can author many posts, but a post can only be authored by one user — a one-to-many relationship. This is just one of many relations that objects can have with one another.

For more examples of relations visit this link

Note: Non relational databases like MongoDB do not follow the relational paradigm per se, but if you read MongoDB’s documentation, there are ways around this restriction.

Let’s Put All Of This Together

Before you begin, wireframe your project. You should know what your site will look like and how it will function.

Once you have a wireframe, organize your schema. Both wireframe and schema will serve as a blue print for the front and back ends of your app.

  1. Initialize your MVC framework.
  2. Start the development server that comes with your framework.
  3. Code models based on your tables.
  4. Write HTML in view files.
  5. Now its time to create database tables based on the schema.
  6. In the controller file, use REST to create routes. Query the database if you need data and render the view pages.
  7. Once your website is running and the routes are configured, start applying CSS.
  8. Finally, go wild with JQuery.

One, Two, Three Lift Off!

Deploy your website to Heroku so that the world can see your hard work. 

 

 

Please follow and like us:
0