Recent

Author Topic: What makes you productive in FP/Laz?  (Read 976 times)

LeadGuit

  • New Member
  • *
  • Posts: 24
What makes you productive in FP/Laz?
« on: March 23, 2021, 10:32:18 pm »
Since I'm a new guy to FP/Laz, I find it difficult to orientate myself a bit. It's my first foray into GUI land in a proper fashion and with a RAD (I vaguely remember doing VB many, many moons ago).

So, the question simply is - those.who churn out small or big programs, GUI or not - what makes you productive?

I don't mean "productivity", but more - what knowledge or.skills do.yiu rely on to keep coding? I come from a strong python background - so for me it's essential to know the essential packages to use and a quick Google yields a nice readthedocs documentation to quickly see what, where and how. I also have a ton of small snippets for the usual things, and custom packages to wrap the complex stuff.

What do you guys have in your arsenal? Do you use the 4 component workflow to work with a DB, or do you write it in Pascal (if it's a GUI)? How do you decide when to stop searching for a component and "code it out"? What's your way of going from googling to actual problem solving?

I hope that is not too broad - the reason for the question is to look around to get a nice grip on it all, and seeing where "FP/Laz is the right tool for the job". It's a little.intimidating - as usual in such situations - where I have no idea what the difference between the four different comboboxes from different component packages is, and half of them say "port from delphi" implying you already know the API. I e.g. looked up a sqlitedB example, and saw the Pascal code - cool, now where do the components fit in, I can't see a reference to them? Do I need them? What? Do I keep trying to find where I link component a from package Y with component B from package X or do I have to write a handler? How far can drag-drop-low+code go? Or - as said - what makes you productive and brings you to the right decisions ;-)

Ok, long Post, sorry guys. I see a lot of either very specialized questions or full beginner tutorials (or homework - in every language you look you see homework). It's hard to come by a good set of examples for people who program in a different language. Like "let's build a web scraper that crawls these URLs, extracts stuff via Xpath and puts it into Elasticsearch" or "let's create a naive Bayes classifier for text using the newsgroups Corpus with a nice GUI to see our training accuracy"

So yeah - what makes.yiunwrite faster/cleaner/better in FP/Laz Vs other languages? What resources do you have bookmarked or references?
« Last Edit: March 23, 2021, 10:35:27 pm by LeadGuit »
Lazarus 2.0.12, FPC 3.2.0. Win 10

Computational Linguist by day, Film/TV Composer by night.

MarkMLl

  • Hero Member
  • *****
  • Posts: 2508
Re: What makes you productive in FP/Laz?
« Reply #1 on: March 23, 2021, 10:40:58 pm »
I'd suggest that the biggest aids to productivity are decent type- and range-checking and a well-integrated debugger.

For my sins, one of the things I'm looking at is a Python program with embedded browser as UI and some backend logic errors... and none of the developers can actually say how to build it in debuggable form.

MarkMLl
Turbo Pascal v1 on CCP/M-86, multitasking with LAN and graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1441
  • Former Delphi 1-7, 10.2 user
Re: What makes you productive in FP/Laz?
« Reply #2 on: March 24, 2021, 06:19:14 am »
Lazarus 2.1 r65061 FPC 3.3.1 r49223 macOS 10.14.6 Xcode 11.3.1
Lazarus 2.1 r65070 FPC 3.3.1 r49223 macOS 11.2.3 aarch64 Xcode 12.4
Lazarus 2.1 r61574 FPC 3.3.1 r42318 FreeBSD 12.1 amd64 VMware VM
Lazarus 2.1 r61574 FPC 3.0.4 Ubuntu 20.04 Parallels VM
Lazarus 2.0.10 FPC 3.2.0 Win10 Parallels VM

dbannon

  • Hero Member
  • *****
  • Posts: 1373
    • tomboy-ng, a rewrite of the classic Tomboy
Re: What makes you productive in FP/Laz?
« Reply #3 on: March 24, 2021, 07:14:13 am »
Install the package Cody into the IDE, its https://wiki.freepascal.org/Cody#Unit_.2F_Identifier_Dictionary is a real time saver IMHO.

Davo
Lazarus 2, Linux (and reluctantly Win10, OSX)
My Project - https://github.com/tomboy-notes/tomboy-ng

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 9271
  • FPC developer.
Re: What makes you productive in FP/Laz?
« Reply #4 on: March 24, 2021, 11:03:24 am »
I like that you can make many kinds of applications in a productive manner, and in general have a low amount of hybrid code.

IOW if I pull in some library or component (say network, or barcode), usually it is all in the same language as I'm working in, and not some header to a library in a foreign language.

You can browse the source with lazarus and drill down into the smallest of runtime library details, and except for a few thousand lines of architecture specific assembler, it is all written in itself. Even the compiler sources and all used tools are.
« Last Edit: March 27, 2021, 01:51:16 pm by marcov »

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 7087
  • Debugger - SynEdit - and more
    • wiki
Re: What makes you productive in FP/Laz?
« Reply #5 on: March 24, 2021, 03:45:43 pm »
Lets see...

First, using the tools available, in this case the IDE. I strongly recommend to read this page
   https://wiki.lazarus.freepascal.org/Lazarus_IDE_Tools

And maybe also https://wiki.lazarus.freepascal.org/New_IDE_features_since


Quote
so for me it's essential to know the essential packages to use and a quick Google yields a nice readthedocs documentation to quickly see what, where and how. I also have a ton of small snippets for the usual things, and custom packages to wrap the complex stuff.

I am not sure what is the best way to explore existing packages.
Places to look:
* https://wiki.freepascal.org/FCL / The packages dir in the Fpc source directory, and then google package names that are of interrest
* The packages included in Lazarus: Menu Packages > Install packages / Unfortunately many of them lack a good description
* The online package manager. Menu Packages
* there must be a page about "generics", which are highly re-useable.
* https://wiki.lazarus.freepascal.org/Main_Page / Scroll down and check if there is a "Wiki Portal" that may cover what you need
* And the rest of the internet.

For snippets check out Code Templates https://wiki.lazarus.freepascal.org/IDE_Window:_Code_Templates

For your own snippets, watch https://forum.lazarus.freepascal.org/index.php/topic,53783

You can add your own packages too. Sorry no link, search the wiki.

Quote
How far can drag-drop-low+code go?
I mainly write back-end code. So I hardly use any drag-drop stuff.

There are various design patterns on how to combine drag/drop with other code.
https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller
https://stackoverflow.com/questions/141912/alternatives-to-the-mvc



Quote
How do you decide when to stop searching for a component and "code it out"? What's your way of going from googling to actual problem solving?
When google does not turn up an answer, posting a concrete problem to the forum and/or mail list.
« Last Edit: March 24, 2021, 03:52:04 pm by Martin_fr »

Zvoni

  • Hero Member
  • *****
  • Posts: 548
Re: What makes you productive in FP/Laz?
« Reply #6 on: March 24, 2021, 03:58:31 pm »
I like that you can make many kinds of applications in a productive manner, and in general have a low amount of hybrid code.

IOW if I pull in some library or component (say network, or barcode), usually it is all in the same language as I'm working in, and not some header to a library in a foreign language.

I feel you!
It's like reading a document in your native language, when suddenly mid-paragraph you would have to switch to suaheli
One System to rule them all, One IDE to find them,
One Code to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------
People call me crazy, because i'm jumping out of perfectly fine aircraft

engkin

  • Hero Member
  • *****
  • Posts: 2692
Re: What makes you productive in FP/Laz?
« Reply #7 on: March 24, 2021, 04:49:30 pm »
It's like reading a document in your native language, when suddenly mid-paragraph you would have to switch to suaheli

You got me curious, my search led me to Swahili, is.that what you meant?
The language is written using Arabic script or Roman script. "Jambo" is hello in Swahili.

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 9271
  • FPC developer.
Re: What makes you productive in FP/Laz?
« Reply #8 on: March 24, 2021, 05:53:14 pm »
"Jambo" is hello in Swahili.

And it is also an airline company in Kenya :)

But yeah, Jambo is the first Swahili that you hear.
« Last Edit: March 24, 2021, 06:00:36 pm by marcov »

engkin

  • Hero Member
  • *****
  • Posts: 2692
Re: What makes you productive in FP/Laz?
« Reply #9 on: March 24, 2021, 06:07:58 pm »
"Jambo" is hello in Swahili.

And it is also an airline company in Kenya :)

But yeah, Jambo is the first Swahili that you hear.

It makes sense, but it is "Jambojet" or "JamboJet".
« Last Edit: March 24, 2021, 06:10:32 pm by engkin »

LeadGuit

  • New Member
  • *
  • Posts: 24
Re: What makes you productive in FP/Laz?
« Reply #10 on: March 24, 2021, 09:15:39 pm »
Nice suggestions!

Yeah, one part in Python that at times annoys me is that a lot of stuff I use is usually a C binding, or coded C with a wrapper (looking at you lxml). At my main dayjob I do a ton of web scraping and linguistic annotations on that - I coded some parts in Go simply for easy concurrency etc. But having all in the same language is very nice

What is great for my productivity in Py is mainly - tons and tons of packages, which more often than not are simply stuff packed into a reusable form to use it easily.
What I'm currently eying at is creating a FP version of a nice script I made for work, which eases stuff. Automate the boring parts you know ;-) so, SSH tunnel, MySQL connection, scp data transfer, a bunch of HTTP gets/posts and remotely running a php script which resides on another server. I wonder if that is doable with a similar degree of elegance.
I guess that's one downside of trying out a less "en vogue" language - there are not really 15 Medium posts, 20 YT videos and god-knows-what-else to look stuff up. It feels kind of the golang community in a way - "What web framework to use" and you get "None, standard library has all you need, code your own router, it's easy".

As far as I have seen, and correct me if I'm wrong, I have the impression that with FP it's more a question of really getting to know e.g. fphttpclient inside out, rather then "Py style" know 20 http client libs for different uses (like library A has nice get syntax, library B is awesome for JSON etc). Which - in a way - feels like a higher initial learning curve, but ultimate higher productivity due to limited choices. We're doing http? Grab this or that. Much faster and easier to pick apart months down the road. I think  :D
Lazarus 2.0.12, FPC 3.2.0. Win 10

Computational Linguist by day, Film/TV Composer by night.

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 9271
  • FPC developer.
Re: What makes you productive in FP/Laz?
« Reply #11 on: March 24, 2021, 09:34:03 pm »
It makes sense, but it is "Jambojet" or "JamboJet".

To be honest, I most watched the Kilimanjaro when I flew with them :-) (Nairobi - Mombasa/Diani)

Leledumbo

  • Hero Member
  • *****
  • Posts: 8326
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: What makes you productive in FP/Laz?
« Reply #12 on: March 27, 2021, 10:42:35 am »
No. 1 is familiarity. Not only with the language but also the runtime library and even 3rd party packages. Whenever I have something in mind to make, I know FPC/Lazarus has what I need and I only need to think my own part. i.e. for making web apps, fpWeb is available. For lower level networking but still high level language support, fcl-net gets it. To support many image formats, fpImage is there. To play with encryption DCPCrypt is available. And so on.

I don't really bookmark anything, usually I either google or just dig in the sources (FPC's packages folder is a treasure island with very little documentation, so the code is my source to know how things work).

I used to be obsessed with ORM to work with DB, previously with DBAware controls, but these days thin layer over handcoded SQL queries actually work best. They're fast with very little magic overhead and the usage is still just like ordinary objects, no backend details leaked to layers above. DBAware control is still recommened if you're working with standard GUI components, my work these days are mostly web based hence handcoding is more maintainable. Or maybe when I master pas2js and similar components are available for it.

 

TinyPortal © 2005-2018