Honk if You Love Blockly
erco
Posts: 20,256
I'm trying to love it, but it sure seems like work. I get that it's new, and I'm old. I get that it's Google, cloud-based, tablet-friendly, and potentially wireless. And everyone has endless videos showing kids effortlessly dragging beautiful colorful blocks around. But much like "viewing the Matrix encoded", I still prefer text-based programming. Lots of indentation, white space, and comments make it readable to me, custom to me.
Perhaps "I must unlearn what I have learned" to embrace Blockly. I just don't have time right now. For what I do, it's not bringing anything new to the party, it's just a struggle challenge to learn a different way to do something.
I'm honestly not trying to undo any of the fine work Ken and Carol are doing for Blockly and LEARN.. I'm sure the graphical environment makes it look less intimidating to new people. And maybe it is better and easier for them. Just curious I'm alone in my thoughts or if any other old-timers are also scratching their heads about this newfangled ruckus. Maybe I'm just a grumpy old fuddy duddy. Back in my day...
Perhaps "I must unlearn what I have learned" to embrace Blockly. I just don't have time right now. For what I do, it's not bringing anything new to the party, it's just a struggle challenge to learn a different way to do something.
I'm honestly not trying to undo any of the fine work Ken and Carol are doing for Blockly and LEARN.. I'm sure the graphical environment makes it look less intimidating to new people. And maybe it is better and easier for them. Just curious I'm alone in my thoughts or if any other old-timers are also scratching their heads about this newfangled ruckus. Maybe I'm just a grumpy old fuddy duddy. Back in my day...
Comments
Kids today don't have to get acquainted with numbers and arithmetic because they have calculators.
They don't need to learn to read and write because they can send pictures, videos and emoji to each other.
Now they don't have to learn to write source code for programs because they can drag and drop graphical things.
It's all far too many layers of abstraction too much for me. Somebody somewhere has to know how all this maths and technology works. That means numbers, arithmetic, machine instructions, logic gates, zeros and ones, transistors, atoms....
Who is going to know all that and keep everything running if it's never even hinted at in school?
Anyway, drag and drop programming is not so new. Back in 1996 I worked on a project where they insisted on using a graphical tool, Prosa http://www.insoft.fi/, to specify the program and it generated C or C++ code. Very nice in theory but soon turned out to be unmanageable. Not to mention inefficient at run time. When the company I worked for decided not to pay the licence anymore man-years of software effort became totally unmaintainable.
Don't forget Whit has been doing a HUGE amount of work with the S3 and Blockly.
That has been wish all along. Seems like it is on the back burner.
I think it serves an educational purpose.
There is pressure to introduce 'coding' earlier in schools, and this is a good way to 'tick that box'.
I'm not sure anyone expects it to be used for large commercial projects.
PLC's have used ladder diagrams for a long time, but they have also proven to be not as portable as Text, which is why IEC 61131 included Structured Text, & Instruction List text based programming.
https://en.wikipedia.org/wiki/IEC_61131-3
http://www.61131.com/st.htm
http://www.plcopen.org/pages/whats_new/tc1/status.htm
P2 should be well suited to supporting many elements of this.
Here is a list of the IEC 61131-3 Data Types needing support :
Elementary Data Type
Bit Strings - groups of on/off values
BYTE - 8 bit (1 byte)
WORD - 16 bit (2 byte)
DWORD - 32 bit (4 byte)
LWORD - 64 bit (8 byte)
INTEGER - whole numbers (Considering byte size 8 bits)
SINT - signed short integer (1 byte)
INT - signed integer (2 byte)
DINT - signed double integer (4 byte)
LINT - signed long integer (8 byte)
USINT - Unsigned short integer (1 byte)
UINT - Unsigned integer (2 byte)
UDINT - Unsigned double integer (4 byte)
ULINT - Unsigned long integer (8 byte)
REAL - floating point IEC 60559 (same as IEEE 754-2008)
REAL - (4 byte)
LREAL - (8 byte)
Duration
TIME - (Size is not specified)
LTIME - (8 byte)
Date
DATE - calendar date (Size is not specified)
LDATE - calendar date (Size is not specified)
Time of day
TIME_OF_DAY / TOD - clock time(Size is not specified)
LTIME_OF_DAY / LTOD - clock time (8 byte)
Date and time of Day
DATE_AND_TIME / DT - time and date(Size is not specified)
LDATE_AND_TIME / LDT - time and date(8 byte)
Character / Character string
CHAR - Single-byte character (1 byte)
WCHAR - Double-byte character (2 byte)
STRING - Variable-length single-byte character string
WSTRING - Variable-length double-byte character string
STRING escape sequences
Generic Data Types - Only available for the input / output/ in-out variables of system-defined POUs
User-defined Data Types
Enumerated data type
Enumerated data type with named value
Subrange data type - puts limits on value i.e., INT(4 .. 20) for current
Array data type - multiple values stored in the same variable.
Structured data type - composite of several variables and types.
Directly derived data type - type derived from one of the above types to give new name and initial value as a type.
References - a kind of strongly typed pointer. Arithmetic operation of the value of this type is prohibited.
Great question. It has me scratching my head too.
Seems to be some parallel universe of programming. And they are just now realizing ideas about "structured programming" that the software engineering world grasped in the early 1970's or so.
Anyway, I guess if young kids, and other beginners, can make things happen with blockly, or whatever, that is good.
PLC is all about real time control, so there is a lot of overlap with Embedded Controllers.
Not sure of the 'just now' claim given this reality :
"The international standard "IEC 61131-3" was released in 1993 and, since its adoption, has become widely accepted by the international user and vendor community. Today, it is, as such, the worldwide recognized standard for programming and configuring industrial control devices."
1993 seems quite a long time ago, in software terms, but it is 'just now' in geological terms
The Structured Text branch, is quite close to Wirth's Pascal/Modula-2/Oberon, and that has been around 'forever'.
A quick lesson is here :
http://www.plcacademy.com/structured-text-tutorial/
One would be hard-pressed to configure an Arduino, RasPi, or Propeller module to do what these things are good at for less money. But, yeah, ladder logic is the spawn of the devil. I don't know how anyone can look at a ladder diagram and figure out what its algorithmic equivalent would be. It's an entirely different way of looking at logic control, derived from the hardwired relay panels that used to do such work.
-Phil
Apologies, my bad. I dearly love Whit and his fine, huge body of work!
More like the spawn of relay logic and the Electricians/Electrical Engineers that worked with it.
This thread is not about PLC..Ladder Logic.
-Phil
That's how I initially thought, but I've found it useful since I can program in different places without having to email my incomplete programs to myself. Now when my internet dies, I'll probably hate it again. The other nice thing is that the version I am using is always up to date, and there have been significant upgrades since I started using it.
I tried rewriting 2 medium size C programs into Blockly using my program outlines (not trying to translate C into Blockly, but just using the logic I had previously used). One was for an ActivityBot controlled by a Sony TV remote with obstacle detection using whiskers coded in a second cog. The other was a demo program for the EMIC2 text to speech module running on an Activity Board. (They are both in the learn subforum).
It was nice not to worry about syntax, but there were some issues. One was that there was a bug in Blockly converting text (from the console) to numbers. I had to mess around for a while until I found a work around. That added a lot of time to my effort. That bug has since been fixed. Also some of the blocks get physically large so the program does take up more space than a text program.
My ActivityBot program has a lot of if-then-else statements with repetitious snippets to cover the translation of the SIRC code into action. I just make a lot of copies of the blocks, but it does clutter the workspace while building the code. Parallax recently added Switch-case blocks and arrays which would make that more concise.
For short educational programs I think it is nice to just deal with the logic and not semi colons, curly braces or indentation. And as a student gets more advanced, they can look at the generated C code. It would be nice if it produced both C and Spin code (and what the heck, why not PASM), although that would take a major effort by Parallax.
The two examples that I did are probably the largest programs that I would be comfortable writing using blockly since there isn't anyway for a user to make a personal library of standard objects, like Jon uses.
Tom
Well, it's not for me.
This whole graphical thing I find... irritating.
Icons everywhere. What do they mean?
BUT- its what the young seem to be attracted to- so why not?
If they can make it work- good for them.
I'll stick to text and simple stuff like Basic and assembler.
Of course just to be able to code requires a tablet or PC, and that's ok I do it all the time, since memory and cpu power is unlimited these days, but could blockly run self hosted on a prop as I believe some have done with Basic? What's the point? Well I was just thinking of my first computer which managed an operating system and high level programming language in 3 k rom and 3k ram. With that I learned the basics of programming in about 4 hours, from the manual, it was SO simple. I haven't stopped since- 39 years!
Dave
Students want this solution. Unless you've taught in a class where you have two options: text-based coding or visual programming (with Blockly), you may not fully understand the benefit of this tool from a student's perspective. For them, it speeds their projects forward, eliminates syntax issues, and helps them understand program flow very easily. Students will chose it over languages very quickly.
In most programming classes there's a small percentage of students who really want to program, who learn because they like it and they're inspired to sprint forward beyond the rest of the class (and the instructor). Everybody can code to some extent, but not everybody really needs to really code. Everybody needs to be familiar with coding and this gives everybody a chance to participate. In an organization like Parallax, there are people who work in non-engineering positions like social media, marketing, sales, and tech support who understand our products very well but generally "don't code" daily. Tools like Blockly bring them closer to understanding programming and make them equally useful for the purposes of their own roles.
You need to be part of our target audience to really appreciate these things. If you're a professional programmer or skilled hobbyist this looks like cartoon coding or and leaves too many unknowns behind the scenes. Loose bits, memory usage, and feeling like it's abstracted a bit too much would be a concern.
In education Blockly is considered a "bridge" to text-based languages. In the same way, the S3 robot is a bridge to component-based robots like the ActivityBot. That's how we're using the system. It's part of the continuum of our educational program. You can start in elementary school using the S3, move to the ActivityBot, and then do inventions with the Propeller Multicore. This can all be done in Blockly or you can move to C language if you prefer.
These educational tools are what paid for the development of Propeller 1 (and will do the same for Propeller 2).
The Blockly audience widens our customer base. For what it's worth, I've seen more Blockly projects created inside our building over the last couple of months than the prior five years. The audience has really widened. A family member of one of our team works in a traffic department and just built a stoplight to pass a test (and he could've done this many years prior). Chuck, my dad, hasn't coded this much since the BASIC Stamp - solving equations in Blockly with four unknowns. Chuck is 80+ years old and even submits bug fixes on our GitHub.
My final point: our uses of Blockly are beyond Arduino's Block programming capabilities. We're bringing something new to the table here, starting with what ya'll know as cognew (our "new processor" block).
Ken Gracey
I realize you ask the question to make the point, but for those interested start here http://learn.parallax.com/tutorials/language/blocklyprop and look at the Reference Guide on the left side.
Ken Gracey
Tom, we're about to put new ActivityBot blocks from Demo to the Production Blockly. We've made some library changes to make the encoders work better and you'll see these appear in the next day or two. I thought I'd better let you know.
You first paragraph above makes an important point "this is how I initially thought" relative to the required internet connection. How we think depends on where we've been and how old we are. Students are now issued Chromebooks in what's called one-to-one (everybody gets one). These things are hardly useful without an internet connection and students clearly take it for granted - there is "always internet". In fact, there's so much of it they assume there is no life without it. All of their educational systems are cloud-based.
From a student point of view this internet dependency is perfectly normal. And as you pointed out it has some big benefits - your programs live on-line, can be shared easily, contributed to by multiple authors, and the Blockly system can be updated without more installations by you.
Finally, for those still reading, we have the ability to ship out a RasPi that's fully loaded with the Blockly system. Students could log into a RasPi and it could be their local Blockly server if there is no internet connection.
A Blockly Believer,
Ken Gracey
So, addressing the requirement for an internet connection, is it possible to set up a Blockly server locally? I can well understand why this might be a sticking point for some. It really is a legitimate concern.
-Phil
Yes. You have two options (a) bridge a smartphone for an internet connection or (b) we can put the tools on a RasPi and ship it out, so it acts as a local server. Using WiFi students would log into the RasPi and it'd serve up the pages and compiler.
We haven't prepared for (b) yet, but all of the code is open source and placed on our GitHub. I bet one of our forumistas could figure it out before we get it accomplished. According to our internal engineers it's an easy project to do [so maybe I should ask them "where is it then?"].
Ken Gracey
Yes, Ken said as much here :
"Finally, for those still reading, we have the ability to ship out a RasPi that's fully loaded with the Blockly system. Students could log into a RasPi and it could be their local Blockly server if there is no internet connection."
It's an open source system, including the Propeller and hardware boards.
It all starts here https://github.com/parallaxinc
Ken Gracey
-Phil
It doesn't just look that way; it is that way.