Can you guys give me some programming language advice?

About programming and getting involved with Linux Mint development
Post Reply
BrunoMiranda
Level 4
Level 4
Posts: 345
Joined: Thu Jun 24, 2010 2:22 pm

Can you guys give me some programming language advice?

Post by BrunoMiranda »

Hi guys.

I could use some help regarding what programming language to focus on. My purpose is just to play around and automate a thing or two every once in a while.

I've been using bash (on xed) and for simple things it just works.
Now I've been trying to add some GUI menus and tried zenity but I've found it frustrating and the documentation is very incomplete, it's hard just to even find all parameters for each kind of menu.
Further research sent me to yad, it's more complete than zenity but I'm having some of the same frustrations and difficulties.
I also find bash not very user friendly for syntax and debugging.

So, choices, choices...
Should I lean some other language, like Python scripting?
It seems to be easy to learn and work with, but for what I want to, won't the learning curve and time investment be too much for just simple things every once in a while? Plus it seems I have to learn Python first before Python scripting, plus having to learn Glade for GUI integration and an IDE. But I would gain from a simpler code and easiness of troubleshooting.
Wouldn't this be too much investment just for a simple every once in a while use?
Also, not coding regularly makes me have the need to check code examples just to learn back again how the basic syntax is.

Or should invest the time I would use to learn Python (and all around it) and stick with bash and become more experienced in it?

My programming background and struggles:
I've studied some IT and some basic programming eons ago. I've learned some Delphi, C and Visual Basic at the time but I never had a good programming teacher and this was before the time of using the internet for help and code examples. I ended up not learning how to code properly and ended up working as a professional doing some system administration on Windows (and a bit on Linux) but that was more than a decade ago.
So basically I know how to program (the logic and etc.), just don't "speak the languages" properly.

My main struggle is that I'm a bit dyslexic and I have some minor signs of ADHD, I get distracted easily and it's very easy to let some minor thing escape and keep on missing on it for a long time, draining my energy, focus and patience.
Bash is nice because it's based on the commands from the Terminal I use every day, so that's something easier to enter my mechanical memory and practice. But also all the pipings and "characters" and regular expressions (which I don't speak :) ) can easily make by brain cells short circuit. I copy text from the internet and get it to work but I don't always understand its syntax (something I would gain from Python).
And if I ever want to do some bigger and more complex project, I don't think bash seems to be the answer.

There are plenty of courses on YouTube that should get me going. It's just a matter of deciding and focusing on that path.

So what advice can you give me, guys? For a not on top hobby investment for every once in a while, and for the possible return from my time and effort investment, what should I focus on?
Should I stick with bash and dive deeper into it? What can you advise me regarding GUI programming?
Or should I learn Python (or some other language)? And what about an IDE and the GUI integration?

Many many thanks, oh wise ones!
Bye for now,
Bruno


(Always backup before you screw up :)
twerq
Level 2
Level 2
Posts: 80
Joined: Sun Jul 05, 2020 10:55 am

Re: Can you guys give me some programming language advice?

Post by twerq »

You mentioned Zenity already. Looks like the right tool for your task. So just master it.
And there are Python wrapper for zenity. So you can migrate to pythonish way anytime with your developed zenity experience.
User avatar
xenopeek
Level 25
Level 25
Posts: 27593
Joined: Wed Jul 06, 2011 3:58 am
Location: The Netherlands

Re: Can you guys give me some programming language advice?

Post by xenopeek »

Python is a much bigger language than Bash but it's more readable I think. I'll echo that zenity/yad and the like are cumbersome but making UIs with Python and a widget toolkit like GTK is much more involved. Maybe sitting down with zenity/yad and wrangling commands till you have it doing what you need is a better investment of your time for your needs.

Simpler automation or where I don't care about performance I do with Bash and generally that works fine for me. As you say because you use the same commands on the terminal so it's easy to try out some commands on the terminal to figure out what to use. For more complex automation or where I care about performance I've been using Python. You can also run Python from the terminal to try it out interactively. There's no difference between Python and Python scripting BTW. Python is a scripting language. I used to do everything in Bash and yes it can be a lot with pipes and subshells. My need for Python developed as I needed to do more complex things like serving output to the web browser or working with file formats like JSON and TOML. That's also doable from Bash with some additional utilities (and lots of pipes :)) but it's easier to do in Python I found, and more performant.

I think Bash and Python are both good choices. It depends on your likes and needs. Any programming language will require some study to learn and lots of practice to get comfortable with. It sounds like you could use some more time with Bash. Maybe get a handle on pipes and regular expressions.

For Bash once I started writing more complex script I read the Bash manpage front to back once, just to know what all was possible with it (so I knew the terms to search for when looking for some example) and Greg's Bash Guide and Bash FAQ have been very useful to get more practical with Bash. For Python I read a couple of books and then lots of practice.

To debunk one myth: no matter how experienced the programmer, they all look up examples online :)
Image
User avatar
TheyLive
Level 4
Level 4
Posts: 253
Joined: Wed Jun 03, 2020 1:47 pm
Location: Russia
Contact:

Re: Can you guys give me some programming language advice?

Post by TheyLive »

BrunoMiranda wrote:
Thu Sep 29, 2022 6:25 pm
I've learned some Delphi...
...
And what about an IDE and the GUI integration?
And what are you waiting for?
https://www.lazarus-ide.org
Goodly Mint - Browser addon for this forum
User avatar
deck_luck
Level 6
Level 6
Posts: 1373
Joined: Mon May 27, 2019 6:57 pm
Location: R-4808 North

Re: Can you guys give me some programming language advice?

Post by deck_luck »

Which programming language to use really depends on what you are try to accomplish. If you are trying to automate command line tasks then I would encourage you to learn bash. Anyone serious about learning Linux/System Administration should learn bash. Just like anything worth learning it requires your time and effort to study.

Using zenity and yad is a good way to augment bash with an elementary (GUI) Graphical User Interface. They are much easier to learn than trying to learn a full blown language like Python or C++. You can find various tutorial by using a web search. Likewise, youtube has some good tutorials.

Also, you might consider using a curses-like menu system instead of a GUI. The dmenu utility can be useful to create a text based menu query.

The Great Books to explain all of the commands - (SOLVED bash book and link references might helpful.
🐧Linux Mint 19 XFCE 💡Give a friend a fish, and you feed them for a day. Teach a friend how to fish, and you feed them for a lifetime. ✝️ Proverbs 4:7 Wisdom is the principal thing; therefore get wisdom: and with all thy getting get understanding.
dave0808
Level 5
Level 5
Posts: 642
Joined: Sat May 16, 2015 1:02 pm

Re: Can you guys give me some programming language advice?

Post by dave0808 »

BrunoMiranda wrote:
Thu Sep 29, 2022 6:25 pm
My main struggle is that I'm a bit dyslexic and I have some minor signs of ADHD, I get distracted easily and it's very easy to let some minor thing escape and keep on missing on it for a long time, draining my energy, focus and patience.
Hey, as a career software developer, working for software development companies, with a bunch of developers of all abilities, I can safely say that we all get this problem of missing something completely minor, spending hours, days even, trying to debug the issue and losing energy, focus, and patience. I've seen grown men hurl their mouse across the office in a pique of anger.

The solution is always talking over the issue with a peer. Sometimes just the talking about it brings the solution to mind. Sometimes, the other person can ask the simplest question, and the solution pops up. Sometimes, they just point out the blinding obvious and we feel foolish.

I risk making light of your condition, but it seems that on this aspect, you are not alone.

As for which language - like spoken languages, unless you use it regularly, you'll lose ability over time. So for what you describe, I would stick with bash.
User avatar
AndyMH
Level 20
Level 20
Posts: 10778
Joined: Fri Mar 04, 2016 5:23 pm
Location: Wiltshire

Re: Can you guys give me some programming language advice?

Post by AndyMH »

If you have done a bit of delphi then you will be comfortable with lazarus (pascal). Download and install the deb files from lazarus. Relatively straightforward to get a GUI app up and running. I use it a lot.

But, depending on what you want to do it may be a hammer to crack an egg.
Homebrew i5-8400+GTX1080 Cinnamon 19.0, 4 x Thinkpad T430 Cinnamon 20.1, 2 x i7-3632 , i5-3320, i5-3210, Thinkpad T60 19.0 Mate
jmorris84
Level 3
Level 3
Posts: 185
Joined: Mon Mar 19, 2012 6:40 pm

Re: Can you guys give me some programming language advice?

Post by jmorris84 »

You said you want to automate things, so assuming you mean on your local machine, I would keep learning bash scripting. Start with simple scripts to learn basic syntax and formatting and just work your way up from there.

I bet you could find a nice beginners lesson for bash and any other language you want to learn on Udemy. It is my "go to" resource whenever I am looking to jump into something for the first time or just want a basic refresher on certain material.
billyswong
Level 4
Level 4
Posts: 350
Joined: Wed Aug 14, 2019 1:02 am

Re: Can you guys give me some programming language advice?

Post by billyswong »

AndyMH wrote:
Fri Sep 30, 2022 7:02 am
If you have done a bit of delphi then you will be comfortable with lazarus (pascal). Download and install the deb files from lazarus. Relatively straightforward to get a GUI app up and running. I use it a lot.

But, depending on what you want to do it may be a hammer to crack an egg.
Lazarus is also available in built-in Software Manager. Not necessarily the latest compared to upstream but it will be updated automatically for security fixes etc in the future like other software in Linux Mint.
BrunoMiranda
Level 4
Level 4
Posts: 345
Joined: Thu Jun 24, 2010 2:22 pm

Re: Can you guys give me some programming language advice?

Post by BrunoMiranda »

Thank you so much for your replies, guys!

So...
For those mentioning Delphi, I've literally used it last millennium (circa 1997 or so)! I just can't remember anything whatsoever regarding it :lol:
Yeah yeah those Windows 98 times when we used to delete Windows system files and then reboot the computer making it failing to boot when we just didn't want to be in class coding anylonger! :roll: (I still remember those 4 hours long coding classes with a lousy teacher nicknamed The B.S.-tter [we found out that was his university times nickname] because he was always claiming grandiose lies about him)
Sure it wouldn't be the 1st time I looked at it, but I'm sure things now must be very different than they were back then!
So... I truly appreciate your hints but I personally don't think Delphi makes any sense to my nowadays.

What I want is the occasional automation script with a basic GUI application.
I think I'll stick with Zenity for the Yes / No windows and for anything a little more complex I'll use Yad, and use Bash to code it. At least I'm not on the starting line with it, like I would be with Python.
Not saying I won't try Python in the future, but there are other priorities in my life I need to focus instead of learning another programming language.

Regarding Bash, I already have some little programs so I can always reuse my code and refer back to it when needed, since time between projects can be so long I can't even remember a simple if...
I comment everything so I can make it easier to understand the next time I visit some old code. "Pay now, enjoy later!"

Yes, all those pipings sure twist my brain in a tight knot... But if I ever need help... Hi guys! :wink:
I will actually need some help and later open a new topic about it. I grabbed some code from a website to manage the output of yt-dlp but even half an hour trying to hammer it dealing with those regular expressions, I just could not make it work. And there was an explanation for that piece of code but I just couldn't deal with it! If pipings twist my brain, regular expressions make me feel old, dumb and borderline to having a seizure! :shock:

Thank you for that bash reference book, The Linux Command Line by William Shotts seems awesome and I've downloaded it for further reference. I need to upload it to my tablet...
I also have downloaded a bash course from YouTube. Now it's Learn, practice, forget, learn again, forget again, sigh, learn again, forget again, desperate and sigh again... :|

So yeah I'll stick to bash.
Many thanks again for your comments and sharing your wisdom and experience with me. I truly appreciate it guys since coding is my greatest I.T. weakness!


By the way, and in this context: While researching about this I've found that you could use glade to create GUIs to be coded in Bash. But this seems to be from ages ago and not working, since one tool they mention seems to be from an obsolete GTK version that I can't find on Synaptic.
Then I found references to Glade2script. Its description reads:
Glade2script allows a script (Bash, Python or other) to display and interact with a GUI (created with Glade).
but I just couldn't find any example on how to integrate it with Bash script.
Glade seems to be excellent in doing GUIs. I like clean tidy applications and Zenity and Yad can solve the problem but don't allow me to tidy things in order to create a cleaner and more intuitive visual application.

So is there anyone who knows how to do it and point me to some simple practical example I could start learning, please?
Once again, thanks!
Bye for now,
Bruno


(Always backup before you screw up :)
Post Reply

Return to “Programming & Development”