what is the most relevant programming language for ee? - Page 1
Forum section: electronics / beginners

author: hatokay
author_rank: Newbie
timestamp: November 04, 2018, 12:03:58 am
content: hello guys.iam currently studying electronic engineering and entering my second year.as of right now they only thought us a little bit of C language. my question is, what programming language is best for ee. i heard pyton and c++ are what i need to know, but what do you guys think.

author: rstofer
author_rank: Super Contributor
timestamp: November 04, 2018, 12:08:18 am
content: One language war coming up!I am going to talk about EMBEDDED programming, not some application that tries to cure world hunger!From my point of view, embedded programming is done in C. Personally, I don't want objects created and destroyed along with the requisite memory allocation and deallocation on a device with limited resources - so, C++ is out (in my view). There is a tiny Python for embedded programming but, in general, Python is an interpreted language so of very little use in an embedded application.Possibly Ada but I just haven't gotten involved with that. The .gov likes it, the rest of the world, not so much.Now, looking at the broader 'engineering' world, Fortran is my choice for numeric programming. I have been using it for nearly 50 years so, yes, I kind of like it. OTOH, MATLAB is my favorite solver and wxMaxima is right there as well. Octave is supposed to be useful but I haven't used it. These selections are for the working engineer who wants to solve something.I LIKE Pascal but it's been superseded by Modula 2 and Oberon, neither of which I have used. I play with Pascal from time to time. I like using it for recursive descent compilers (like the original P4 compiler by N. Wirth).If you want to change from EE to CS, I suppose C++ and Java are at the top of the heap (particularly Java) and Python is coming along. Definitely, learn C++ and Java unless you are going to work strictly in the embedded world.

author: Crazy_Pete
author_rank: Regular Contributor
timestamp: November 04, 2018, 12:17:05 am
content: Well everyone is biased but i would say C++. It is standard on some platforms anyway (For example much of the Arduino Libs are in C++ and the Arduino IDE links it in for you if needed.)Generally C and C++ are the most commonly used although i am seeing some python here and there. If you are new to programming i would learn C++ first. It is very hard to make the jump from C to C++ since the 2 languages are so close, C++ programmers who started in C tend to "think in C" and lose some of the benefits of C++.A little known fact is that C++ was originally invented to do large network simulations and is ideally suited for engineering work. In any case i find it also helpful to learn the assembly language for the MCU in question, if for no other reason than to see what the C++ compiler is actually doing!ThanksCrazy Pete

author: langwadt
author_rank: Super Contributor
timestamp: November 04, 2018, 12:27:05 am
content: Quote from: rstofer on November 04, 2018, 12:08:18 amjust because C++ has lots of bells and whistles doesn't mean you have to use them, Arduino is basically C++ using only the stuff that makes sense in a (small) embedded worldI haven't use much python but I'd think it can do what you would else do in Matlab etc. or if you need to do a simple gui or test system for some embedded do-that

author: coppice
author_rank: Super Contributor
timestamp: November 04, 2018, 12:31:12 am
content: Somewhere in the broad EE domain pretty much every computer language has relevance. Which particular area are you interested in? Embedded programming? Modelling? I think you need to be more specific to get meaningful answers.

author: Crazy_Pete
author_rank: Regular Contributor
timestamp: November 04, 2018, 12:54:21 am
content: >just because C++ has lots of bells and whistles doesn't mean you have to use them, >A very very important point. The nice thing about C++ is you can use it as a high level language, a low level language or anything in between and if the compiler and linker are working properly, and you don't use C++ features you don't need, the resulting C++ program should be about identical in memory footprint to a similar C program.C++ is a very vertically scalable language and can be used for everything from Low Level embedded programming to highly complex abstract models (like the network models it was originally created to simulate.) The fact that C++ was originally intended to be a modeling language really makes it attractive for scientists and engineers.ThanksCrazy Pete

author: T3sl4co1l
author_rank: Super Contributor
timestamp: November 04, 2018, 01:11:36 am
content: Excel.Sad, perhaps, but very true.If you're doing a lot of data analysis, consider MATLAB (or the free Octave or such), or the many libraries in Python, say.Analog circuitry, SPICE.Digital (hard), VHDL or Verilog. Digital (soft), C and whatever else. (I don't recommend actually writing much of anything in assembler, but knowing a few instruction sets is, well, instructional to making sure the compiler is writing what you want it to write. Higher level languages may be tricky to interface in an embedded context, but by that point, you're probably running an OS that can do e.g. JS, Python, etc. native, so who cares.)Some generic, easy to use languages are good for general purpose use: interfacing with network, OS or device services, creating calculators or tools, running quick calculations without the restrictions of a spreadsheet or the heavy weight of MATLAB, or with higher performance. JS (ubiquitous, runs in a browser!), Java, Python, C#, VB, etc. come to mind.Tim

author: JustMeHere
author_rank: Frequent Contributor
timestamp: November 04, 2018, 01:12:14 am
content: I'm finding that OO encapsulation is very important if you are using libraries. Stops any issue with variable names. Don't even have to think about it.For small stuff, C works better.For me

author: Crazy_Pete
author_rank: Regular Contributor
timestamp: November 04, 2018, 02:00:40 am
content: As a language war loomsi am compelled to quote Bjarne Stroustrups (creator of C++) answer to the question: "Which programming language do YOU think is best?"Without actually thinking about it, he responded "Oh the one programmer feels most comfortable using."Thanks to AllCrazy Pete

author: vk6zgo
author_rank: Super Contributor
timestamp: November 04, 2018, 02:05:46 am
content: Solder?

author: xrunner
author_rank: Super Contributor
timestamp: November 04, 2018, 02:15:51 am
content: Quote from: JustMeHere on November 04, 2018, 01:12:14 amKernighan & Ritchie C, straight from The Good Book (which I still have), that's what I used for years for the small projects I needed to get going in the lab at work.Times have changed, but it's still a great language.

author: spec
author_rank: Frequent Contributor
timestamp: November 04, 2018, 03:45:07 am
content: C++

author: CatalinaWOW
author_rank: Super Contributor
timestamp: November 04, 2018, 05:51:25 am
content: Don't worry too much about it. When I was an undergraduate the argument was whether Algol or Fortran was best for engineers. Both have mostly become history. Right now C or C++ and Python are valuable, but you will likely learn several more languages and many, many variants over your career.Just a partial list of the languages that have been important to me for at least a year or two.Fortran, Algol, Pascal, Basic, Forth, APL, Ada, C, C++All of these except Algol and Ada ended up with some fairly significant flavor variants depending on the target processors and environment.

author: Mechatrommer
author_rank: Super Contributor
timestamp: November 04, 2018, 07:55:48 am
content: Quote from: hatokay on November 04, 2018, 12:03:58 amprobably thats the only lesson you'll get from them.when i was back in the day, they taught us "the legendary" Fortran in 3rd (or 4th? cant remember) semester ie second year. and then nothing more. my further knowledge on programming later on are 100% self learning because of interest where all my friends still in the same state until today. i got a chance to learnt Pascal/Delphi, C/C++ and Basic. for the longest time i developed my personal use programs in "the venerable" Visual Basic and at the same time keep dreaming that i will have the same easeness at developing GUI but in C/C++ language IDE. i bought a complete book on MFC but i cant cope with it during the day because i think i was too obsessed with "raw metal i want to do it all from scratch" mental programming state, so i never got to understand MFC, in the end i tried to build my own "MFC" guided by Windows++ book by Paul Dilascia, you dont want to know how much time i spent on developing just a small portion of equivalent MFC. now i have Qt thats what i decided to learn next since VB is becoming obsolete now. but its been years i only touched the surface, its quite a challenge i think due to the age and family responsibilities and other tasks at hand, so i'm now really slow at it. otoh i discarded Delphi/Pascal long time ago, i think just for few months after learning it, i still keep few programs that developed with it though, for historic and remembrance reasonFortran? i abandoned it the day i got an A+ mark on the slip in the end of the semester, i was a programming nerd nuts obsessed with many things and wonders what we can do with it (computer programing) i cant sleep if i dont complete a programming task... the nerdness up to a point when few chicks were keeping an eye on me although my not so interesting appearanceback to topic, if you have to ask what language? as the wise man said, if you can understand many languages, its better. but if you have to learn ONE language, imho its going to be C/C++, if you dont want to risk obsoletion, there is not a slightest hope that C/C++ is going to obsolete anytime soon, not as Fortran that we learnt back in school.http://moreisdifferent.com/2015/07/16/why-physicsts-still-use-fortran/

author: Feynman
author_rank: Regular Contributor
timestamp: November 04, 2018, 08:28:57 am
content: Since "EE" an "Programming" often lead to "Embedded Programming" C is the most relevant language by far followed by C++.I agree that Python is relevant as well, because it is very handy to simply have a scripting language in your toolbox (automating stuff, etc).

author: exe
author_rank: Unknown
timestamp: November 04, 2018, 08:30:57 am
content: Quote from: rstofer on November 04, 2018, 12:08:18 amI use C++ and static memory allocation. So far I'm happy with it.

author: Fred27
author_rank: Unknown
timestamp: November 04, 2018, 08:56:08 am
content: Quote from: vk6zgo on November 04, 2018, 02:05:46 am+1Best answer so far.

author: tggzzz
author_rank: Super Contributor
timestamp: November 04, 2018, 09:25:09 am
content: Don't focus on the language; they change regularly and will continue to change throughout your career.Do focus on selecting theright toolfor yournextjob:which languages employers will want you to use. There are surveys of that.what tools are available so you can develop your solution faster, especially librariesways in whichproblemscan be definedways in whichsolutionscan be expressed. These should be congruent with the problem, so you can see the implementation is a correct solution of the problemunderstand what each tool doesn't doseamless implementation of specifications in both hardware and software. Sometimes you need to move implementations from one to the otherand don't use a hammer to insert screws!So, which tools should engineers have in their toolbox?Provably correct implementation: Ada/SPARK.Multicore processing: xC, OCCAM.Hardreal-time embedded, i.e. timings guaranteed by the compiler not by testing and hoping: xC.Simple embedded programming: C.Finite State Machines: either a specific tool or one of the standard design patterns in whatever language you are using.Statistics: R and similar.High performance computing and numerical codes: Fortran.General purpose, without other overriding constraints: Java or Python.Analogue electronics: SpiceRF: whichever very expensive tool your employer has purchased, or a limited freeware version.Digital HDLs, especially for FPGAs: Verilog or VHDL.Scalable soft-realtime, e.g. telecoms systems: Java.Quick and dirty number manipulation: a spreadsheet.Algebra, when exploring conceptual designs: Mathematica.Be aware that C++ has become so complex that everybody and project has to choose a subset that is used and a subset that is avoided. One problem is that every project/designer/library chooses a different subset, often incompatible and often without realising the consequences.

author: brucehoult
author_rank: Super Contributor
timestamp: November 04, 2018, 11:09:41 am
content: Quote from: tggzzz on November 04, 2018, 09:25:09 amNot really. I first programmed in C in 1983 and C++ in 1988 and those are still what 95% of my work in operating systems, compilers and interpreters and JITs, runtime libraries, and embedded programming use, 30 to 35 years later.Most of the other 5% is bash/grep/sort/etc/perl. Perl is 30 years old and Perl 5 24 years. The unix utilities are 35 to 40+ years old.And I do all my editing in emacs. It's similar vintage.I'd say you can't go wrong learning those tools. They're going to be here forever, even if there is something else that comes into popularity from time to time.

author: tggzzz
author_rank: Super Contributor
timestamp: November 04, 2018, 11:36:18 am
content: Quote from: brucehoult on November 04, 2018, 11:09:41 amFirst point: those languages have changed very significantly over the years. (I first programmed C in, IIRC, 1982)Second point: while they might be not inappropriatefor the work you have done, there are alternatives with some advantages.Third point: they are an inappropriate and/or a waste of time for many applications - see the list I gave. (Or maybe you really think it would be best to do statistical analysis or analyse analogue circuits in C!)Fourth point: by concentrating on one tool/technology, you are limiting your future options. Technologies do become obsolete; I was once offered a job based around core memory! If you are the world expert in, say, CCDs, you will be very well paid until your employer is no longer interested in CCDsFifth point: if you know alternative tools and strategies, they can improve your designs and implementations even if you use a different language. FSMs in C are the canonical example, e.g. see this current topic:https://www.eevblog.com/forum/microcontrollers/state-machines-is-this-topic-taught-any-more/msg1931161/#msg1931161

author: emece67
author_rank: Frequent Contributor
timestamp: November 04, 2018, 11:37:08 am
content: .

author: tggzzz
author_rank: Super Contributor
timestamp: November 04, 2018, 11:56:45 am
content: Quote from: emece67 on November 04, 2018, 11:37:08 amYes, but...the OP needs to understand that EE is a large field and that no one language is sufficient. He will have to choose which to ignore, based on his (unstated) interestshe is at an age at which he can learn easilymany people stick with the first tool they learn, thus limiting the quality of what they produce and limiting career optionsit isnecessaryto realise that youwillneed more than one tool, so get an appreciation of their advantages and disadvantagesknowing when to use/avoid a tool is averygood discussion point in job interviews

author: Karel
author_rank: Super Contributor
timestamp: November 04, 2018, 12:12:27 pm
content: C language is the most important language for EE's.Apart from that, it's the second most used language in the world. Only Java is more popular.Once you have mastered C, you will have a very good understanding of programming in general andyou will have no problems to learn other langauges in case that's needed.Personally, I would never hire an embedded engineer who doesn't understand the concept ofpointers to pointers.

author: IanMacdonald
author_rank: Frequent Contributor
timestamp: November 04, 2018, 03:35:00 pm
content: Quote from: Karel on November 04, 2018, 12:12:27 pmPersonally, I would never hire a bench engineer who thought that wrapping tinfoil round fuses or splicing cables with tape were good ways to repair things.Something over half of all IT security issues are due to programming with pointers. (and forgetting the small issue of bounds checks) The cost of this practice in terms of downtime and stolen data outweighs by orders of magnitude any advantage.

author: Karel
author_rank: Super Contributor
timestamp: November 04, 2018, 04:09:31 pm
content: Quote from: IanMacdonald on November 04, 2018, 03:35:00 pmYou have to blame the programmers or their bosses who put tight deadlines and/ordon't want to pay for an experienced C programmer.I have learned to always:- check all input- use Valgrind- use unittestsI have seen many that skip those because of lack of time.

author: rstofer
author_rank: Super Contributor
timestamp: November 04, 2018, 04:10:36 pm
content: Quote from: Karel on November 04, 2018, 12:12:27 pmI'm not sure 'popular' is the right word for Java. Java is used in cell phones and there are a bunch of phones. As a result, Java is probably the most 'executed' language, perhaps not the language with the most programmers. I think we get into a semantic battle when discussing the 'popularity' of Java.In terms of application programming, I would expect C++ to be the most used (have the most programmers). I imagine C# will become important and when I want a widget in a hurry, Visual Basic is the way to get it built.In the end, a language is just a methodology for expressing an idea. It's the idea that's important, not the implementation. Sure, the implementation gets all the accolades but almost every idea can be programmed in almost every language.Bottom line: Learn to express the ideas and worry less about the language. Your employer is going to tell you what language to use. Therefore, you need to know all of the top languages (C, C++, Java, Python) and it wouldn't hurt to know the second tier as well (Fortran, Pascal, Perl, Ruby, Rust, Visual {Basic, C++, #}, <whatever>).For the practicing EE, I still expect C to be the most important tool in the toolbox.

author: Karel
author_rank: Super Contributor
timestamp: November 04, 2018, 04:15:39 pm
content: Quote from: rstofer on November 04, 2018, 04:10:36 pmNot in my case. I decide which tools to use. That's including the programming language.Do I exclude myself from many job opportunities? Definitely yes.Am I happy with the jobs that are left for me? Definitely yes. At least because I'm in control.

author: rstofer
author_rank: Super Contributor
timestamp: November 04, 2018, 04:22:55 pm
content: Quote from: brucehoult on November 04, 2018, 11:09:41 amQuoteTony Hoarehttps://www.azquotes.com/quote/721008More to the point:QuoteTony Hoarehttps://www.azquotes.com/quote/592444One of the true luminaries in CS:https://en.wikipedia.org/wiki/Tony_HoareAnd EVERYBODY needs to be able to use the 'vi' editor.

author: Beamin
author_rank: Super Contributor
timestamp: November 04, 2018, 04:33:50 pm
content: Can you get away without learning a programming language and still be relevant in the field after school to employers?I thought everyone was going to hands down say C since micro controllers run that. Or am I mistaken? Is C++ to C like Spanish is to Italian?

author: tggzzz
author_rank: Super Contributor
timestamp: November 04, 2018, 04:42:43 pm
content: Quote from: Beamin on November 04, 2018, 04:33:50 pmComputers, of whatever size, do not run languages.Computers use hardware to interpret the numbers in memory; the interpretation is the computation and hopefully that computation produces useful side effects.There are many ways by which those numbers can be selected, including by hand - as anybody that has manually bootstrapped a computer knows.

author: xrunner
author_rank: Super Contributor
timestamp: November 04, 2018, 04:45:11 pm
content: Quote from: Beamin on November 04, 2018, 04:33:50 pmI wouldn't think you'd be smart to try to "get away" without learning one. Matter of fact, I'd say you wouldn't be able to graduate at all because it would be a requirement, I'm sure of that LOL.

author: coppice
author_rank: Super Contributor
timestamp: November 04, 2018, 04:59:02 pm
content: Quote from: Beamin on November 04, 2018, 04:33:50 pmCan you get through an EE degree of any kind without learning Matlab?

author: kripton2035
author_rank: Super Contributor
timestamp: November 04, 2018, 05:05:13 pm
content: as a programming language, I learned Basic during my EE degree, 30 years ago ...well I did not learn it because I knew it before, but that's all we were teached at that time.

author: Nusa
author_rank: Super Contributor
timestamp: November 04, 2018, 05:27:25 pm
content: In a technical field, unless you've found and gotten stuck in a particular niche, you continue learning for your entire career. One of the most important lessons you get from your formal education is learning how to teach yourself, if you didn't know already.

author: rstofer
author_rank: Super Contributor
timestamp: November 04, 2018, 05:54:26 pm
content: Quote from: coppice on November 04, 2018, 04:59:02 pmWell, we did! When I graduated in '73, I was probably the only student with unlimited access to a computer and the IBM Circuit Analysis Program. The HP35 calculator had just been invented and we had gone to the moon with slide rules.So, yes, you can avoid MATLAB but I don't think it's a good idea to try. Remember "Statics"? There were a lot of matrices to solve and MATLAB makes it elegant. Same for circuit analysis - all those simultaneous equations using complex numbers! I can solve a 3x3 matrix by hand. I don't even want to try to solve a 4x4. It's not difficult, it's just error prone and who wants to spend a lot of time getting the wrong answer.It's a side issue to this discussion but don't overlook SymboLab.com for graphing and desmos.com for equation solving.As to EE, there's a MATLAB book: "Solving DC and AC Circuits By Example Using MATLAB" by Haskell and Hanna. There are a lot of MATLAB books and I think I am most interested in those relating to Physics. I really like undergrad Physics.And another: "Electronics and Circuit Analysis Using MATLAB" by AttiaOur local community college has a required MATLAB course for lower division engineering. Required!

author: hendorog
author_rank: Super Contributor
timestamp: November 04, 2018, 06:05:44 pm
content: Quote from: rstofer on November 04, 2018, 04:10:36 pmI am not surprised that Java is the most popular. Nothing to do with phones either.Something has to sit behind every website in the world, and that is usually going to be Java or C#.Also, you may be discounting the huge amount of development that goes on in boring old businesses. Businesses want all their systems integrated these days.

author: rstofer
author_rank: Super Contributor
timestamp: November 04, 2018, 06:44:19 pm
content: Quote from: hendorog on November 04, 2018, 06:05:44 pmWhich gets back to the use of Java for web sites but a lot of that is actually JavaScript. Different pig, different lipstick.Just watching Eclipse or MATLAB load gives excellent examples of why nobody in their right mind would develop an application using Java - unless they really wanted the 'write once, run anywhere' feature.C# is a 'Johnny come lately' kind of deal. CGI scripts could be written in any language but, realistically, languages oriented toward web development would make the job easier. Back 20 years ago, I just used JavaScript but my web pages were mostly static. There are better tools today. Maybe we need to add PHP to the list of languages plus an understanding of CSS.I have never seen so many buzzwords in one sentence in my life:Quotehttps://en.wikipedia.org/wiki/C_Sharp_(programming_language)How about something simple like:Quotehttps://en.wikipedia.org/wiki/FortranI could shorten that: "A language for number crunching."Alas, over time, all of these languages come in and out of job requirements.

author: Mechatrommer
author_rank: Super Contributor
timestamp: November 04, 2018, 07:41:22 pm
content: there are languages that run easy and cute, and there are languages that run packed and fast. if you want to run cute, like many businesses prefer, then you should learn java.

author: Crazy_Pete
author_rank: Regular Contributor
timestamp: November 04, 2018, 07:41:29 pm
content: Ok, lets stop the language wars and tell this poor guy who is new to EE the TRUTH:The most important language for a budding engineer to learn is.....CHINESE!:-)(In the words of Shakespeare : "The truth shall out in jest!")Thanks AllCrazy Pete

author: coppice
author_rank: Super Contributor
timestamp: November 04, 2018, 07:51:43 pm
content: Quote from: rstofer on November 04, 2018, 05:54:26 pmI also found it remarkably easy to get through an EE degree without a non-existent product. Things are different now it does exist. I was really wondering if you can get through an EE degree today without Matlab. In most degree courses there is now so little lab work being done in actual labs, and so much being done by simulation, that I really wonder if there is any choice of options in any University which would allow a student to not encounter Matlab.

author: Howardlong
author_rank: Super Contributor
timestamp: November 04, 2018, 08:09:22 pm
content: Quote from: tggzzz on November 04, 2018, 11:56:45 amIt also needs to be in the context of the job you’re applying for. I discounted an otherwise well experienced lead database admin interviewee because he talked about nothing but Perl for automation. I’m all for automation, and have nothing against Perl, but there was the rest of the team to consider, none of whom knew Perl, they were already comfortable with the automation scripting tools that come out of the box.

author: Zero999
author_rank: Super Contributor
timestamp: November 04, 2018, 08:19:21 pm
content: Sadly I didn't do much programming in college.I used to be interested in BASIC programming when I was at a child, but got bored of it.When I did GCSE IT and later A-level computing, databases were the thing, just MS Access with little coding. At college we did a bit of assembly on a very old educational microprocessor board. We had to write the program, then manually assemble it to binary code and type it in, using a keypad, which was very slow and time restrictions meant we didn't achieve much. A bit later at college we studied PLCs (Programmable Logic Controllers) and ladder logic, a graphical programming language. The hardware was obsolete: some old PLC, which was programmed using a386 PC running MS-DOS, ancient even in 2003.Since college I'd dabbled a bit with coding, but never done much of it since.

author: CatalinaWOW
author_rank: Super Contributor
timestamp: November 04, 2018, 08:21:55 pm
content: Quote from: Howardlong on November 04, 2018, 08:09:22 pmThose kind of interviews come in all flavors. Just substitute a technology or brand. CMOS, 68000, VHDL, Java are just a few of those situations I have run into.

author: nomadd
author_rank: Contributor
timestamp: November 04, 2018, 08:48:40 pm
content: Quote from: hatokay on November 04, 2018, 12:03:58 amFar too many "young folks" on this thread..<Han Solo voice> "Listen, kid: an Assembler and a datasheet is all you need."..Oh, and a strong pot of tea.

author: tggzzz
author_rank: Super Contributor
timestamp: November 04, 2018, 08:53:27 pm
content: Quote from: Howardlong on November 04, 2018, 08:09:22 pmWhen I was a interviewer, one of my questions was to get the interviewee to think of many ways to implement a traffic lights controller for a toy manufacturer. Even in the 80s a depressing number of candidates could only think of using a micro. My favourite answer had zero electronics in it!

author: brucehoult
author_rank: Super Contributor
timestamp: November 04, 2018, 09:52:30 pm
content: Quote from: tggzzz on November 04, 2018, 11:36:18 amI know, use privately, and at various times in the last 20+ years have tried to persuade employers there are advantages in using: Scheme, Dylan, Ocaml, HaskellNo one cares. Even if I do a project in Dylan in a tenth the time it can be done in C++, they'll say they can't hire anyone who knows it.That's realistic, by the way. In 2002 I used Dylan for one work project. It took a day, and was in production for years. At some point after I had left a modification was needed. They had someone (a talented guy) rewrite it in C++. It took him two weeks. He told me he understood my code and how it worked instantly, even though he'd never seen Dylan before, but it simply took far more code to do the same thing in C++. The performance of the C++ version was no better. And it was ten times as many lines of code.At the same job in 2002 I was assigned by one of the company founders to implement custom telephone call and SMS processing steps using Scheme. Using continuations I was able to make it far simpler to write such code -- basically you write the code for any given call as if there were no other calls existing. Usually, you'd have to break everything down into states and write a big switch statement in C with explicit management of states. This is very annoying if you want to call common subroutines in different kinds of call processing and those themselves have internal states (e.g. playing an audio message and then waiting for a DTMF tone). You can't use OS or normal library-provided threads for this because you can have literally millions of calls in progress at the same time and you'll simply run the machine out of resources (RAM or PIDs or both).A modern analogue of this is node.js.At some point the founder who supported the "Scheme Node" (this is literally what it was called) left the company and my work (again: in production without any problems) was ripped out of the product.Now I don't bother trying to be an evangelist for better programming language technology. I just use C, as they want.

author: tggzzz
author_rank: Super Contributor
timestamp: November 04, 2018, 10:16:12 pm
content: Quote from: brucehoult on November 04, 2018, 09:52:30 pmI've been making very similar points in the last day, in the thread about state machines, especiallyhttps://www.eevblog.com/forum/microcontrollers/state-machines-is-this-topic-taught-any-more/msg1939237/#msg1939237w.r.t domain specific languages.Nonetheless, that doesn't change the point that some languages are some suited to some domains than others. Unless, of course, you really believe that an EE should use C to analyse analogue circuits or RF structures!

author: bsfeechannel
author_rank: Super Contributor
timestamp: November 05, 2018, 03:14:13 am
content: In short, solder, C, HDL, Matlab and Chinese.

author: Nusa
author_rank: Super Contributor
timestamp: November 05, 2018, 03:58:57 am
content: I'd add that if your plans include programming your own micro-controllers, doing at least one small project in assembly is a valuable learning experience. Especially if you think micro-controllers run directly on C or C++.On the other hand I don't claim to be a real engineer. My degree is in CS, but I spent many years in the embedded world among hardware people and understand the digital world quite well. Analog not so much, beyond basic stuff like noise filters and decoupling capacitors. Hardware is a hobby for me.

author: Crazy_Pete
author_rank: Regular Contributor
timestamp: November 05, 2018, 05:06:46 am
content: Hi again all!I would like to really underline that C is obsolete and if you have no experience in programming you should forget C (it will only teach you bad thoughts) and go right ahead to learning C++. Java was originally designed to be the embedded language of the future. (The idea was every CPU would have a java interpreter built into hardware and thus execute quickly.) For many reasons that never came to pass. However Java is a great learning tool and is certainly the place to start, NOT C!Honestly the 2 languages that i see all the time that i wish i had learnt long ago really are Python and Simplified Chinese. There is a tonne of stuff out there from low level embedded code (the raspberry pi crowd are all over python) to high level UI stuff on desktops. I think you will find an investment in learning python to be of value simply to be able to read code that you will encounter in your career.ThanksCrazy Pete

author: spec
author_rank: Frequent Contributor
timestamp: November 05, 2018, 05:51:30 am
content: Quote from: Nusa on November 04, 2018, 05:27:25 pmSo true: learning how to learn. That is the key to success.The pro programmers I have known seemed to be able to use most languages.On one big project the core language was Ada, but there were chunks of assembler, Fortran, Basic and C.

author: Karel
author_rank: Super Contributor
timestamp: November 05, 2018, 07:23:01 am
content: Quote from: Crazy_Pete on November 05, 2018, 05:06:46 amNow I understand your nickname. C is far from obsolete and is here to stay for a long time, whether you like it or not.And C++ is a terrible language...

author: HB9EVI
author_rank: Frequent Contributor
timestamp: November 05, 2018, 08:12:45 am
content: just to mention: even though the arduino language uses a c++ like syntax, it is in fact no c++, although it uses the gcc toolchain, there is no libstdc++ for the avr platform but only the avr-libc.So far i guess c and asm are the most used languages in the EE environment - so far that, what I used; for bigger embedded platforms python is coming into business.

author: bd139
author_rank: Super Contributor
timestamp: November 05, 2018, 08:15:45 am
content: @Karel: I couldn’t agree more.If anything more people need to learn C.For me, on the desktop, you write in python and fix the slow bits using C extensions.On embedded stuff, C first every time.No C++, no java. There is no place for abstraction that deep in that space. Even the bastardised C++ on Arduino stuff is vile.There is some room for some imperative stuff like FORTH however.

author: Rerouter
author_rank: Super Contributor
timestamp: November 05, 2018, 09:15:13 am
content: C / C++ for the micros, and probably python for UI to those devicesIt mainly comes down to your use case, but my approach is bash out the functionality in "Bodge code" the ugly inefficient stuff that you know will work, e.g. going as far as bit banging a protocol, then setup the test cases and begin cleaning it up as time allows, you already know it works, you can demo it or release a version early if push comes to shove. but it keeps dev time short.

author: brucehoult
author_rank: Super Contributor
timestamp: November 05, 2018, 09:32:35 am
content: Quote from: HB9EVI on November 05, 2018, 08:12:45 am"Wiring" (the Arduino language) uses a common subset of C++ and Java and a custom library that has implementations in both.If you compile Wiring with C++ then a preprocessor adds a #include for the library, followed by forward declarations for all the top level functions in the source files (so that, like in Java, the user doesn't have to put them in any particular order).If you compile Wiring with Java then a preprocessor adds some imports and wraps all the user code in a class declaration.If you know that you'll never compile a given Wiring program with Java (as is the case with Arduino) then you can go crazy using almost the full range of C++ language features, but not the standard C++ library.

author: tggzzz
author_rank: Super Contributor
timestamp: November 05, 2018, 09:49:53 am
content: Quote from: Karel on November 05, 2018, 07:23:01 am"If C++ is the answer, you ought to reframe the question"

author: Crazy_Pete
author_rank: Regular Contributor
timestamp: November 05, 2018, 12:03:31 pm
content: As i pointed out in a private message (and to the wrong person i think, i DO apologise!) Religion is also obsolete and here to stay whether we like it or not. C++ was designed as and functions as a drop in replacement for C. The arduino environment is C++ to a great extent. The compiler is the g++ compiler and the Arduino environment both includes and happily accepts code written in strict ANSI C++. Saying that Arduino uses a "Subset" of C++ is demonstrably false.The problem with learning C is that it like religion, it will train your mind towards obsolete thinking. If you are lucky enough not to be have been taught C, then forget C. Learning C++ will teach you everything you need to know about C and also give you the ability to use a higher level programming language. To say that there is no place for abstraction in hardware is a absurd. The arduino people used to say that until about 10 years when i showed them you could reduce program size by a few hundred bytes using C++ over C. I am sure that my efforts are a small part of a greater demonstration by many that convinced the Arduino people to make the Arduino environment C++. I hardly consider "It's here to stay whether you like it or not" as a positive endorsement. I can say the same thing about Herpes. (Which like religion, i am also immune to!) Of course C++ obsoletes C. I am not aware of ANYTHING you can do in C that you can't do in C++. If you choose for whatever reason not to use the OO features of C++, the increased type checking, overloading and namespaces found in C++ simply render ANSI obsolete as a matter of fact. (C++ when used as strictly a procedural language obsoletes C at the starting gate.)I knew this would turn into a typical religion versus science war, but to finish it off, exactly what can you do in C that you can't do in C++?Hilariously, the machines on which i learnt C++ are dwarfed by many of todays microcontrollers. I just purchased a half dozen ESP32 boards on the cheap from China! (Xi Xi China!!!!!) It is a 32 bit RISC machine with half a meg of STATIC RAM!!!! I can remember telling a fellow who was a certified Genius (you know they have a test for that, it is a called an IQ test.) "You know, i am really glad i learned C++, although i admit, having a machine with128K of DRAM sort of makes it cheating since that much RAM is a huge playground. I dream of one day having a computer running at 10MHz with half a meg of STATIC RAM! " He laughed and said "Not in our lifetimes." Now that unbelievable dream machine is an $8 USD dev board and people are saying "There is no room for abstraction on a platform like that". This is the ULTIMATE "HA! WHEN I WAS A BOY!" :-)Thanks to all.Peter

author: Sudo_apt-get_install_yum
author_rank: Regular Contributor
timestamp: November 05, 2018, 12:45:17 pm
content: As many before me have said: C & C++ are the most used languages in embedded programming. Are they the best, probably. Here’s is why I think it’s so.C & C++ are one of the most used languages in the world and without a doubt the most used language in embedded programming so when the next person comes to update the product and has to redo the code they are going to have an easier time doing so since they most likely already know the language.If it was written in Python it most likely would be much harder to modify for someone on the outside since it’s a less common language in embedded programming.C & C++ are also universally used when it comes to µC’s so regardless of what company you go for or type of µC, your almost guaranteed to be able to program it using C/C++But the most important thing in my opinion is how you program!An older product at work was created by an old colleague of mine. He was a C/C++ programming wiz but he was a wiz for high level software products. Like windows applications and such, these programs are designed to be "modular" so you can easily add/remove features.This is generally good because software is easily distributed and can be updated without much hassle, it is not the in the case of embedded design because much of the time you’ll never change the software on the product because most of the times it is linked to the hardware.Anyway the code was well written but not optimized for embedded use so it was really slow and didn’t perform as well as it could have.The µC in the product was a 32-bit ARM running at 32MHz and it was running horribly slow.This was later changed to an 8-bit Atmega running at 1MHz and it was kicking the ARM's ass by a long shot, both in performance and power consumption.The same guy who used the ARM also created a product using a 32-bit ARM running at 96MHz (Could be mistaken this was a while ago) and made a RTOS for it witch was WAY overkill for a product like that. It was never corrected because it would be to labor intensive but version 2 used a 16-bit micro at 8MHz, this kicked its ass as well!So the moral of the story is it’s not the language its how you use it!Or like some people say "It’s not the size that matters, its how you swing it!"

author: Crazy_Pete
author_rank: Regular Contributor
timestamp: November 05, 2018, 12:47:14 pm
content: Sigh,Sorry for feeding the trolls. I did NOT check "save a copy" of sent messages in profile so i have no idea to whom i sent that private message about C and religion. Sorry about that if it was to the wrong person. I am also sorry for feeding the trolls. I wonder if we should start a new topic or area for Object Oriented Embedded Programming? Arguing with someone who says "X cannot be done" is a far less productive action than actuallydoingX and then showing the world how it is done.Thanks to all,Crazy Pete

author: bd139
author_rank: Super Contributor
timestamp: November 05, 2018, 12:58:52 pm
content: This isn't a religious war for ref.Just a point, I've been writing C++ for about 20 years and C for about 25. On Windows, Unix and embedded systems.You are completely wrong. C++ is a different language. It's not a drop in replacement. Even Stroustrop said that.C++ has a hell of a lot more foot guns which really do bugger you pretty hard:1. Very unstable ABI2. RTTI3. Exceptions (non explicit control flow)4. Little control of stack5. Poor allocation control (try writing a C++ program that doesn't allocate)6. Name manging from templates7. Buggy as fuck compilers8. autos.9. No one who likes C++ has had to debug something someone has used more than 2 STL templates in.10. Toolchain instabilityYou can spot the problems when you look at the coding guidelines every organisation has. Everything is "don't use features X, Y, Z".It's not what can you do in C, it's what can't you do in C and how you are forced to think. And that is in terms of tangible memory, abstractions and algorithms. Every foot is carefully placed. Never do you step in shit.So you can get a 32-bit machine with a meg of RAM for $8 but you can get an 8-bit machine with 4k of RAM for $0.50 and solve the same problem.

author: tggzzz
author_rank: Super Contributor
timestamp: November 05, 2018, 01:24:28 pm
content: Quote from: Karel on November 05, 2018, 07:23:01 amto which the response was...Quote from: Crazy_Pete on November 05, 2018, 12:03:31 pmQED, I believe.

author: tggzzz
author_rank: Super Contributor
timestamp: November 05, 2018, 01:37:41 pm
content: Quote from: bd139 on November 05, 2018, 12:58:52 pmWhile I agree with your other points, those points are the real killers - especially the last.Subsetting a language is an orange flag, especially when every organisation chooses a different subset.And never forget thehttps://en.wikibooks.org/wiki/C%2B%2B_Programming/Templates/Template_Meta-Programming#History_of_TMPwhere the key, horrifying, accurate word is "discovered". Here's a first-hand account of what happened and Soustroup's reaction:https://translate.google.com/translate?sl=de&tl=en&u=http%3A%2F%2Fwww.erwin-unruh.de%2Fmeta.htm

author: Wimberleytech
author_rank: Super Contributor
timestamp: November 05, 2018, 03:21:34 pm
content: Quote from: kripton2035 on November 04, 2018, 05:05:13 pmMy first programming language was FORTRAN (more than 30 years ago!!). However, when I need to solve a problem today (not write an app to sell or give away), I use BASIC. Why?? Because LibertyBasic offers a great Windows interface that is quick and easy, it is my go to (not goto) to get an answer. Just the other day, I wrote a BASIC program that fixes the damn QFX data format that Wells Fargo has found a way to screw up!!When writing embedded stuff, I use C (for the arduino or a SiLabs micro)...because that is what Arduino and Keil provide....and...of course...Excel

author: kripton2035
author_rank: Super Contributor
timestamp: November 05, 2018, 04:14:06 pm
content: I use Xojo basic simply because it works on mac,win,linux,raspberry quite with the same source codeand on iOS with some resource, and soon android.

author: JPortici
author_rank: Super Contributor
timestamp: November 05, 2018, 04:39:12 pm
content: Quote from: Crazy_Pete on November 05, 2018, 12:03:31 pmThis is all good and everything. Too bad my architecture of choice only has a (good) C compiler.It would be nice to have other options but there is only a (good) C compiler available.Until this changes, C is going to stay

author: brucehoult
author_rank: Super Contributor
timestamp: November 06, 2018, 01:56:37 am
content: Quote from: Crazy_Pete on November 05, 2018, 12:03:31 pmNothing in the example code that comes with Arduino or on the Arduino or Wiring examples web sites uses:- multiple inheritance- templatesTo name just two C++ features.Yes, you can use those features in your own code if you know that it will only be used in the Arduino IDE with boards that use a C++ compiler.QuoteThis I *emphatically* agree with. My early experience was on Apple ][ and CP/M machines with with 32 KB to 64 KB RAM, or PDP-11 with 64 KB for an individual program.Everything was running at under 1 MIPS -- the clock could be a couple of MHz, but instructions took a number of clock cycles each. And the instructions were so awkward and the number of CPU registers so small that you needed a lot more instructions to complete any particular task than on even an AVR, let alone ARM or RISC-V or MIPS.Even the number of bytes of code it took to do anything was much bigger than now, which further wasted the limited memory.And those were the big machines, capable of running usable programming IDEs and symbolic assemblers or compilers. You can use "advanced" programming techniques and facilities on much smaller systems than that, provided that you have a bigger system to compile it on.

author: Crazy_Pete
author_rank: Regular Contributor
timestamp: November 06, 2018, 02:26:44 am
content: >Nothing in the example code that comes with Arduino or on the Arduino or Wiring examples web sites uses:So what?I probably should quit while i am ahead since "So what?" sinks that argument, but....You are utterly and absolutely sure that no third party library ANYWHERE uses Templates or Multiple Inheritance? I am sorry but that is the sort of semantic hair splitting that comes when you engage in a religious argument. The arduino IDE uses and supports C++. The claim that no embedded project uses C++ is just nonsense. The one feature of C++ that tends NOT to be implemented on MCUs is new/delete and that is simply because many mcus lack a proper memory controller. Like i said in an earlier post, the Joy of the ESP32 is that it is half a meg of STATIC RAM! It is so far advanced beyond the "DESKTOP" machines of 1990 that even C++ features like new/delete are obsolete. The C++ standard is 100s of pages long. AFAIK i am the only person who ever wrote code that uses C++ "Template Template Arguments" and it wasn't all that useful and i took it out of the code. Since nobody chooses to use that feature i guess only a subset of C++ is used on Mainframes and desktops as well.1) Show me an Ard that doesn't use a C++ compiler2) Since when is "hardware specific" not a given in MCU programming?thanksCrazy Pete

author: Crazy_Pete
author_rank: Regular Contributor
timestamp: November 06, 2018, 02:37:53 am
content: >This is all good and everything. Too bad my architecture of choice only has a (good) C compilerWhat arch has only a C compiler, i am curious because AFAIK g++ has been ported to a HUGE variety of MCUs.Also the original posters questions was (IIRC) not "What language should i use on a platform that supports only C?" It was "What language should ilearnif i am new to the field?"As these C programmers are demonstrating, once you learn C, you will have a terrible time learning C++. However if you learn C++ first you will have no trouble at all reading other people's C code. C is to C++ what religion is to science. If you learn science first you will have no trouble understanding religion. If you learn religion first your thinking will alway tend towards circular reasoning and "I belong to a community that thinks this way and we can't all be wrong" sort of thinking that you see people using to justify C.You will see C (catch the chinese pun? ;-) everywhere and you need to be able to read and understand and maintain it. You will also see C++ everywhere and will need to be able to read and maintain it. The only way to kill BOTH of those birds with ONE stone is to learn C++ first.Xi Xi :-)Crazy Pete

author: rjp
author_rank: Regular Contributor
timestamp: November 06, 2018, 02:38:27 am
content: Its a shame that nobody with serious clout has done a c+ yet - which is the useful subset of c++ that every damn modern language has run with - python,c#,java. dart etc.Bascially c structs with single inheritance that makes building core framework plugins like "Stream" easier without pointer casting.Namespacing to avoid foo_bah_wah clumsyness in libraries.then a more modern std library.

author: Nusa
author_rank: Super Contributor
timestamp: November 06, 2018, 03:04:17 am
content: Quote from: rjp on November 06, 2018, 02:38:27 amWhat's the point? It's already there in C++, just as C remains a subset of C++. You just don't use the features you don't want to use.People cloak it in C vs C++ labels, but the real "religious" argument is usually about procedural vs object oriented approaches. Both approaches have value, although the extremists in either camp may choose to argue that. Anyone who has to understand and maintain existing code better be willing to understand both.

author: Crazy_Pete
author_rank: Regular Contributor
timestamp: November 06, 2018, 03:06:35 am
content: >Its a shame that nobody with serious clout has done a c+ yetI thought that was what C# was? (Basically MS couldn't get it together to write a C++ compiler. They finally released C# as a political move to turn failure into propaganda victory.)Most people don't use multiple inheritance anyway. That was the whole idea and the reason why C++ was designed to obsolete C in the first place. If a feature isn't useful, don't use it.thanksCrazy Pete

author: rjp
author_rank: Regular Contributor
timestamp: November 06, 2018, 03:09:56 am
content: Quote from: Nusa on November 06, 2018, 03:04:17 amThe point is that nobody agrees to the subset and everyone makes their own clumsy NIH here version of the framework library.

author: Crazy_Pete
author_rank: Regular Contributor
timestamp: November 06, 2018, 03:10:48 am
content: Thanks Nusa!I couldn't have said it better myself. You need to be able to understand both procedural and object oriented programming. Understanding functional programming is even better. (Re. the post by the guy who managed to blow a C++ program outta the water by writing it in Dylan.) The honest truth is that for most small day to day tasks, procedural programming is better. (The playlist program i use to listen to music is written bash script, i don't write a C++ program everytime i wanna change the music!)The problem with LEARNING C is that it makes it nearly impossible to learn C++, whereas if you learn C++ first (Hatokays original question) you have a great background and ability in both C and C++.thanksCrazy Pete

author: rjp
author_rank: Regular Contributor
timestamp: November 06, 2018, 03:13:31 am
content: Quote from: Crazy_Pete on November 06, 2018, 03:06:35 amwell the thing is that all those features that you shouldnt use, do get used, and c++ can be a nightmare when multiple inheritance and templates are used to their fullest insanity.c# is aimed at desktops and is VM based and has a monster std lib - but yes i was dreaming of a c# style subset but aimed at micro's with efficient binary compilation,

author: rjp
author_rank: Regular Contributor
timestamp: November 06, 2018, 03:58:00 am
content: Quote from: Nusa on November 06, 2018, 03:04:17 amthe other religious argument in micro programming is prebuilt frameworks and shared code versus doing everything from scratch in isolation from first principles, this overlaps quite a bit with the c/c++ argument.

author: bsfeechannel
author_rank: Super Contributor
timestamp: November 06, 2018, 04:20:49 am
content: Quote from: Crazy_Pete on November 06, 2018, 02:37:53 amHoly crap, Batman! Bjarne really managed to brainwash an entire generation.C in large part supplanted Assembly, but that was unintentional. Dennis Ritchie never expected the success the language had.Bjarne worked, and still works, hard to supplant C, but that didn't happen. The largest cooperative project of the history of humankind, Linux, and unofficially the OS upon which the world spins, is written in C.Butthurt, Bjarne makes videos on the internet calling C obsolete, then complains about the animosities between C and C++ developers. Dennis Ritchie never said that of Assembly.One of the mistakes of C++ was exactly to have chosen that name. It is like God calling his son Satan++ instead of Jesus.Every time you say C++ you give C free publicity.

author: Crazy_Pete
author_rank: Regular Contributor
timestamp: November 06, 2018, 04:33:51 am
content: >Every time you say C++ you give C free publicity.Please don't feed the trolls :-)loveCrazy Pete

author: Crazy_Pete
author_rank: Regular Contributor
timestamp: November 06, 2018, 04:45:40 am
content: Hi Hatokay!Something i will say i regret Hatokay, is not learning functional programming. You can see by the trolling responses that nobody has come up with an intelligent answer as to why you should learn C instead of C++.When i was your age ;-) The head of CSCI was a blearly eyed insomniac schizoid who used to wander the halls half asleep red eyed with a smile on his face. (He was the ultimate programmer.) Whereas all the other teachers were praising me for learning C++, he was berating me and telling me that functional languages are the way to go.If there is anything i regret it is not listening to him. That fellow who posted about 10 lines of Dylan replacing pages and pages of C++ is right. Just as Object Oriented Programs tend to blow Procedural Programs out of the water, Functional Programs (LISP and children) tend to blow OOP out of the water. Learn C++/Asm for the low level stuff. Since you are just starting out, i would really bother to immerse yourself in something like Dylan (or other functional language). After 30 years of programming i can say a well written 1000 line C program collapses into a 100 line well written C++ program. A 100 line well written C++ program collapses into a 10 line Dylan program.I am not a Dylan Bigot, etc. I am telling you i WISH i had taken that guys advice 30 years ago and learnt functional programming as well as OOP. Exposing your mind to as many different views as possible is essential to your intellectual development later in life.Best Wishes,Crazy Pete

author: Crazy_Pete
author_rank: Regular Contributor
timestamp: November 06, 2018, 05:02:57 am
content: >well the thing is that all those features that you shouldnt use, do get used, and c++ can be a nightmare when multiple inheritance and templates are used to their fullest insanity.I didn't say I shouldn't use them, i said you shouldn't use them if you don't like them. The fact that you find it distasteful to maintain code that you never learnt to write in the first place is not an argument for not learning in the first place.THISis exactly why you should learn C++ and not learn C. If you learn C you will find it impossible to learn C++ and waste time complaining about those who can. If you learn C++ first you will not only have a more agile and open mind, but you will also be a better C programmer.And again, if yer just starting out, fer chrissakes PLEASE PLEASE learn from MY mistakes and learn Dylan!!!!!LoveCrazy Pete

author: GregDunn
author_rank: Frequent Contributor
timestamp: November 06, 2018, 05:21:39 am
content: Quote from: Crazy_Pete on November 06, 2018, 05:02:57 amThis is why, when we were essentially forced to use Java for our software, I wrote it as though it was C. I spent 16 years working with Java, and every time I declined to use the bloated, spaghetti-like coding style encouraged by Java mavens, I ended up with a simpler, easier to read program that tended to work first time. The main thing wrong with OOP is that the proponents want to write it as though everything has to be an object - and that's not the case. In many (most) cases, this just obfuscates the program and makes it harder to add to or update it. Not to mention dragging in megabytes of libraries whether you need them or not.Slapdash, lazy coding in C++ and Java is a big reason why code tended to get bigger and slower with every generation following C. In the 1980s we wrote a skeleton operating system and three shared memory multiprocessing applications for a radar controller in less than a megabyte of code - running on a 5 MHz 8086. Pretty much every "standalone" Java application I worked with 10 years later was bigger than that, despite it all being boiled down to interpreted byte code instead of compiled machine code. And needed a GHz-class CPU to execute it at a reasonable speed.

author: Crazy_Pete
author_rank: Regular Contributor
timestamp: November 06, 2018, 05:29:04 am
content: Just an aside, Java (despite the ignorance of those who wrote it) is not an OO language. The level of encapsulation in Java is the Package, not the class. Java was written by a guy who didn't understand the difference the in the first place and that has led to some weird java code.That doesn't mean Java is a "bad" language or that you shouldn't use it. In fact just as MOST programming is best done procedurally, a whole lot of code on top of that is best written using a package oriented language. OOP really shines in highly complex programs or in very small programs that must be done with a minimum of footprint (like in MCUs.)Xi XiCrazy Pete

author: FrankBuss
author_rank: Unknown
timestamp: November 06, 2018, 05:44:59 am
content: Quote from: Crazy_Pete on November 06, 2018, 05:29:04 amJava has classes, which can be derived, have methods and member variables, polymorphism etc., and Java classes encapsulates members and methods if declared private (unless you access them with reflection, but this would be similar in C++ with direct memory access). Why do you say it is not object oriented?

author: Crazy_Pete
author_rank: Regular Contributor
timestamp: November 06, 2018, 06:11:32 am
content: >Why do you say it is not object oriented?Perhaps because i am an idiot? :-) Honestly the last time i looked at Java was in a previous century. Java may have changed its standard to be an Object Oriented Language after all.The last time i looked at java, the level of encapsulation was at the package, not the class. That is a protected Java member can be seen by OTHER members of it's Package, not just by members of it's Class or it's Descendant Classes.In the semantics of Computer Science (with your permission of course, since this is a semantic argument anyway) that makes Java a package oriented language not an object oriented language. Although that is a semantic difference, it makes Java fill a real large niche. There are plenty of problems that are not complex enough to justify an object oriented language but too complex to use a procedural language. The popular term for languages like Java back in the previous century was "Object Based." Object Based languages (like Java) remain hugely popular simply because they are the best solution for a very large problem space. The sad thing is most people aren't educated enough to know the difference between Procedural - Object Based - Object Oriented - Functional Programming and don't know which tool to use.I am going to get flamed for this so i won't mention any specific libs but if you look at some of the more popular Java GUI frameworks, you will see this "Package Oriented" programming being used in a very powerful way. (In GUI programming it is easier to simply give related window frames access to each other's internals rather than writing messenger / collaborator classes to transfer that information the way you would in an OO language.)Thanks AllCrazy Pete

author: Nusa
author_rank: Super Contributor
timestamp: November 06, 2018, 06:40:00 am
content: Quote from: Crazy_Pete on November 06, 2018, 05:02:57 amYou're entitled to your opinion, but I don't agree that there's only one best path to follow. Best for you, perhaps, but not best for everyone.My own path shows my age. I was actively using assembly, Fortran, Pascal and some others before C existed, I learned C before C++ existed, and yet I had no trouble grasping the fundamentals of C++. Perhaps it's because the last 30 years of bloat hadn't been added yet, and I could deal with that as it happened rather than being overwhelmed with it all at once.As for editors, learn at least the basics of "vi". Simply because the editor is going to exist on nearly any non-windows system you walk up to, which means you can function on that system.

author: hendorog
author_rank: Super Contributor
timestamp: November 06, 2018, 06:44:00 am
content: Quote from: GregDunn on November 06, 2018, 05:21:39 amI recall working on a C program written by a old and clever fellow who of course knew C was the dogs bollocks and of course I was a complete idiot as I wanted to use more modern stuff. This guy wrote the program and a few of us were given the heady task of typing it in for him.This was a busy Friday night at a decent sized international airport and I had dropped in to drop something off or some very minor thing or other.Anyway I just happened to notice on the UI of the baggage handling controller (this guy wrote) connecting and disconnecting repeatedly to the PLC.This was bad as this program had to respond to the PLC with a destination lateral for the bag to be diverted to, and it had to do it pretty quickly.If the bag didn't get a destination then it went to a manual encode station, and since this was Friday night it was busy and that guy would get swamped pretty quickly.Being young, dumb and ignorant to the ways of the clipboard wielding twats of the world I thought I'd try and fix it.As it happened I had snuck a copy of Boundschecker on the machine and had a brainwave to set a memory breakpoint on the PLC connection byte in the data structure. Shutdown the system - it was already screwed - restarted it under Boundschecker and setup the breakpoint.Sure enough there was a memory overwrite from the prior byte and it was flipping the PLC connection byte on and off. Quickly I found the culprit in the code, fixed it and restarted. PLC connection was holding solid now and life was good. Apart from the sudden storming for the control room by 3 or 4 pissed off baggage handlers asking what the fuck I was doing and demanding to know why I was diverting all of the bags to manual encode.I muttered something about bad data and its working now, and beat a hasty retreat.So yeah, in summary, C might rock your world, but you may change your mind after being reamed by a few large baggage handlers on a Friday night.

author: Crazy_Pete
author_rank: Regular Contributor
timestamp: November 06, 2018, 07:08:58 am
content: You are entitled to your opinion too. Of course EVERY C programmer i have ever met never was able to make the jump to C++, they simply didn't know how to use the language. And everyone of them said the same thing. "Well i am proof that your path is not for everyone because i started out in C and i obviously have no trouble with C++." People who are born blind don't really know what it means to "see". :-)Honestly though i think you are on the right track. For starts the "Everything is an Object" is ridiculous and is why C++ is so powerful, everything is NOT an object.Xi XiCrazy Pete

author: FrankBuss
author_rank: Unknown
timestamp: November 06, 2018, 07:42:20 am
content: Quote from: Crazy_Pete on November 06, 2018, 06:11:32 amThis hasn't change since the first 1.0 Java Language Specification. There was always classes with private members. I know this, becauseI wrote a Java book 20 years agoYou are right, "protected" means other classes in the same package can see it as well:https://docs.oracle.com/javase/tutorial/java/javaOO/accesscontrol.htmlNote that if you don't write any modifier, it can be seen by other classes in the same package, but not by derived classes. I'm not sure if this is very useful.

author: bd139
author_rank: Super Contributor
timestamp: November 06, 2018, 08:23:46 am
content: I’ve seen some crazy shit in my time but this thread has gone full slashdot.Java not OO, C# because Microsoft couldn’t write a C++ compiler?Corrections:1. Java is and always was OO.2. Microsoft provide a pretty good C++ compiler. When they kicked off .net it was pretty good too.3. C# exists because there needed to be a higher level OO language for non systems programming.On the last point, java/c# tend to hold a lot of the non systems programming type industries together and they are the only language platforms that you can scale to the size of problem domain due to the introspection support by IDEs and analysis tools.Also java was written in C

author: Crazy_Pete
author_rank: Regular Contributor
timestamp: November 06, 2018, 08:55:22 am
content: Er you may find it "Silly" but nothing you say refutes these points in any way. No Java is not an OO language for the reasons i stated. It is an object BASED language. That is actually a strength of the language when used properly. C++ is an object ORIENTED language and that is a strength of the language when used properly. Yes Java was written in C, yes Microsoft gave up on C++ and came out with C# because their C++ compiler was such a POS. These are all facts. Have you anything other than an emotional response to refute it? OK you think it is silly, so do i.Today, 30 years after the fact, Microsoft may write a "pretty good" C++ compiler, i'll never know nor care. They obviously wrote C# because back in 2001 they couldn't even come close to a C++ compiler. As a member of the ISO C++ standards committee said 18 years ago to a microsoft rep: "What you are calling a C++ compiler simply doesn't compile C++". Then they came out with C#. Failing technically and then saying "Oh wait, we MEANT to do that, here it's a new standard" has been Microsoft's MO since day one.Good lord i cannot believe i am getting dragged down into all this simply because i offered to help my Mothers son. (Hatokay) Sheesh :-)Xi XiCrazy Pete

author: Crazy_Pete
author_rank: Regular Contributor
timestamp: November 06, 2018, 09:05:23 am
content: Correction:Your claiming it is so doesn't make it so. You claiming that your "pronouncements" are fact contrary to all available evidence makes you religious. In fact someone who "wrote a book on Java" 20 years ago just chimed in that i am correct about Java accessors. (I actually wasn't sure anymore.)Learn the difference between an object oriented language and an object based language and get back to us. I am not even criticising Java, just pointing out the difference between a philips and a slotted screwdriver. People chiming in with religious nonsense and ad-hominems doesn't change the fact. (Butt-Hurt Bjarne, really?)Who was the British female author who defined religion as "The tendency to adhere to beliefs contrary to fact for purely sentimental reasons"I am ashamed i forgot her name. (She was a Sci Fi author, oddly enough. As an aside the Sci Fi genera was created by a woman [Mary Shelly = Frankenstein] and yet is a male dominated field. How ironic. :-) )Xi XiCrazy Pete

author: tggzzz
author_rank: Super Contributor
timestamp: November 06, 2018, 09:08:44 am
content: Quote from: bd139 on November 06, 2018, 08:23:46 am... to the extent it is difficult to distinguish from trolling. At least the OP (if they are still reading) will start to learn that some people's opinions are best ignored.QuoteC# came into existence principally because MS was losing mindshare to Java. In attempting to move into the OS arena, they had to introduce the "unsafe" keyword. In avoiding HotSpot patents they opted for ahead-of-time (partial) optimisation which has to be done on every machine as part of the installation process - with obvious consequences.Why do I say that with some confidence? Because I remember being at a talk (in HPLabs) by Anders Hjelsberg shortly before C# was unleashed on the world. Everybody at the meeting was underwhelmed with Hjelsberg's responses, and I don't think anybody bothered to evaluate C# seriously. (And yes, they couldeasilyhave chosen to do so).

author: tggzzz
author_rank: Super Contributor
timestamp: November 06, 2018, 09:21:16 am
content: Quote from: Crazy_Pete on November 06, 2018, 08:55:22 amOK; you are clearly the master of words in the sense “When I use a word,” Humpty Dumpty said, in rather a scornful tone, “it means just what I choose it to mean—neither more nor less.” ... “The question is,” said Humpty Dumpty, “which is to be master—that's all.” ATTRIBUTION: LEWIS CARROLL (Charles L. Dodgson), Through the Looking-Glass, chapter 6, p. 205 (1934).If you wish tocommunicatewith others, it helps if the words have a common shared meaning. Currently your definitions are different to the common meaning.QuoteThat's completely wrong, for the reason I mentioned in my previous message.

author: GeorgeOfTheJungle
author_rank: Super Contributor
timestamp: November 06, 2018, 09:34:45 am
content: For embedded it's C, more C, with a bit of assembly occasionally.My favourite, defaultgeneral purpose language and programming environment is only a keystroke away: command-alt-i, comes with a great debugger too! Do not under estimate the power of theJava-Scripts:-)

author: Crazy_Pete
author_rank: Regular Contributor
timestamp: November 06, 2018, 10:05:07 am
content: >“When I use a word,” Humpty Dumpty said, in"Hahahah!!!!! Actually my last name is "Garner". Do you know any adult male Garners that outrank me? Then, per the treaty of Rouen, i do GET to decide what the English language means!As an historical aside, weirdly enough: The Modern English Language is based on Norman and when the Normans defeated Charlemagne at Rouen, one of the conditions was that we had the last word on how our language is spoken. (I usually only bring that up when an English Major tries to correct my spoken English. But that actually is the historical reason why English is a DESCRIPTIVE language and French is a PRESCRIPTIVE language.) In fact the Humpty Dumpty thing is your only saving grace. In common usage MOST PEOPLE when asked would say "Well Yeah, Java is an OBJECT ORIENTED language." Although technically and semantically untrue, you could argue that because English is a DESCRIPTIVE language it is proper to call Java an Object Oriented Language.See that proves i am a Norman. You are losing the argument so badly because you don't even know how to use your own weapons. (Personal Attacks and Nursery Rhymes) and i step back and say "Hark! Thou hast dropped thy sword good sir! Here, let me fetch it for thee and teach thee to swing it. There back in thine hands now, we shall resume?" :-)This is getting really funny even if way off topic.In fact, i can quote myself:"In the semantics of Computer Science (with your permission of course, since this is a semantic argument anyway) Java is a PACKAGE ORIENTED LANGUAGE"So i come out and say that it is an irrelevant and semantic argument. The only reason it is on topic is because the STRENGTHS of Object Based Languages make them a good choice for a HUGE problem domain. (Which was the OP's original question.)So i make an aside and admit it is semantics, but point out that semantics aside, Object Based Languages are valuable. And lacking any facts you have to turn to Nursery Rhymes? At least i can turn to Historical Factandadmit that i am being totally tongue in cheek in doing so. (Well at least I think its funny!) I said in actuality Java is a PACKAGE based language. Incommon usageEnglish, Java is one of a large series of OBJECT BASED languages. For certain tasks Object Based Languages are preferable. In pedantically correct English, Java is a Package Oriented Language. That is not a criticism, just a fact. There are certain tasks when that is even preferable. Java also seems to be a great teaching language. It just isn't an object oriented language because it supports encapsulation and inheritance at the PACKAGE level. Looking on the bright side, in the OLDEN DAYS, religious people used to burn us at the stake for being right. :-)Xi XiCrazy Pete

author: bd139
author_rank: Super Contributor
timestamp: November 06, 2018, 10:36:33 am
content: Java is an object-oriented language.The defining characteristics of an object-oriented language are polymorphism, inheritance and encapsulation all of which Java support and allow you to strictly enforce. There are many mechanisms in which you can build this which is probably where your understanding breaks down here. The point being that whether they are classes, prototypes or actors, it's still object-oriented by definition.Package orientation is an organisational concept rather than a language structure. This is a meta-system outside of the language implementation.I think you have your arse and your mouth confused.

author: tggzzz
author_rank: Super Contributor
timestamp: November 06, 2018, 10:45:22 am
content: Quote from: Crazy_Pete on November 06, 2018, 10:05:07 amI've not bothered to quote your rant, since it is too bizarre and rambling to merit a response.

author: tggzzz
author_rank: Super Contributor
timestamp: November 06, 2018, 10:49:44 am
content: Quote from: bd139 on November 06, 2018, 10:36:33 amOh, that's a little impolite. OTOH since I'm pretty deaf, if I could see him I would ask him to stand up.

author: bd139
author_rank: Super Contributor
timestamp: November 06, 2018, 10:51:59 am
content: I'm sure you could hear him with all that caps lockQuote from: tggzzz on November 06, 2018, 09:08:44 amThat's a fair assertion. The main problem was that they were losing Visual Basic market share to something else at the time. Pre-.Net Visual Basic sucked badly (post-.Net slightly less but still sucks). It wasn't a modern language really. Thus they needed something competitive. What with the whole J++ disaster they were looking pretty bad then. The original .Net 1.0 and 1.1 releases were pretty poor (better than Visual Basic) but the moment they stepped on the generics, without the whole boxing problem inside the JVM, with .Net 2.0 things were looking up.If they had done then what they are doing now with .Net Core, I reckon Java would be dust.Back on topic, the main point is pick the path of least resistance and go with the flow when dealing with any task or platform.

author: brucehoult
author_rank: Super Contributor
timestamp: November 06, 2018, 10:52:04 am
content: Quote from: Crazy_Pete on November 06, 2018, 05:29:04 amAccusing James Gosling of being just some guy ignorant of what OO is is ... just ... incredibly uninformed. Words fail me.I'll just say this: object-orientation and encapsulation are ABSOLUTELY ORTHOGONAL CONCEPTS.

author: bd139
author_rank: Super Contributor
timestamp: November 06, 2018, 10:55:55 am
content: Yes.Just a hilarious reference here:http://www.stroustrup.com/1995_Java_whitepaper.pdfNote the domain.

author: brucehoult
author_rank: Super Contributor
timestamp: November 06, 2018, 11:02:14 am
content: Quote from: Crazy_Pete on November 06, 2018, 02:26:44 amSay what? Your post was already well into "wrong" and "either didn't read or didn't understand what I wrote" territory. But this isn't even wrong.New&delete (along with the underlying malloc&free, which they are just a type-safe wrapper around) have *nothing whatsoever* to do with a memory controller, proper or otherwise.Your other posts have since established you as a nutter so I'm not going to reply further to you.

author: Howardlong
author_rank: Super Contributor
timestamp: November 06, 2018, 12:16:06 pm
content: Quote from: brucehoult on November 06, 2018, 11:02:14 amI tend to agree, we've been using malloc/free and similar long before integrated memory controllers or even MMUs became a thing, let alone ubiquitous. Think of all those DOS real mode applications, including Windows 3.x in real mode, so in effect anything that ran on the original PC and PC/XT.

author: bd139
author_rank: Super Contributor
timestamp: November 06, 2018, 01:03:00 pm
content: It's even way older than that as well:alloc:https://github.com/dspinellis/unix-history-repo/blob/92376cead83f002b6c03f26e4b17a8fbf92662b3/s4.s#L3free:https://github.com/dspinellis/unix-history-repo/blob/92376cead83f002b6c03f26e4b17a8fbf92662b3/s4.s#L31And that's pre-C (PDP-7 by the looks)

author: bsfeechannel
author_rank: Super Contributor
timestamp: November 06, 2018, 01:04:18 pm
content: Quote from: Crazy_Pete on November 06, 2018, 04:33:51 amI thought YOU were trolling. That's why my sarcastic reply. However, if you're really serious about your concepts, you have a lot to learn.Just for the record. I learned C. Then I learned C++. I had absolutely no difficulty with C++ because of that. I encourage everyone to learn both languages. In whatever order they like.C and C++ are different languages, created in different circumstances for different purposes in different times. In common, both are great and influential. Each in its own way.And religion is a (fascinating) object of study of science that involves archaeology, geography, history, sociology, psychology, anthropology, philosophy, political science, linguistics, semiotics, etc.