Best Programming Language

For other topics related to the FreeBASIC project or its community.
sancho2
Posts: 547
Joined: May 17, 2015 6:41

Re: Best Programming Language

Postby sancho2 » Feb 02, 2017 21:38

Boris the Old wrote:An easy way to avoid writing declares is to use a simple utility program to do it for you.

I wrote the following tool when I first got started with FB. It is an .exe that I added as a TOOL in FBEdit. Then I gave it a shortcut key of 'u'.
So I use it by hilighting the sub/function definition line, then COPY it to the clipboard, then ALT + T + U and the declare is placed in the clipboard. Then you just paste it where you want it.
You can also go the other way and take the declare line, hilight/COPY it, and ALT + T + U to put the sub/function declaration into the clipboard.
I use it all the time and can't live without it.
I was going to expand on it but never did. I wanted to mark the location in the bas file where the declares would go, with something like:

Code: Select all

'-------------------------------
' Declares:
'-------------------------------

Then the program would just drop the new Declare at the end of the list. This functionality is more suited to an addin though.


My code here comes complete with incorrect handling of array parameters, incorrect handling of type declares and probably some other issues I don't remember. I want to also mention that it is Windows only, and the clipboard handling routine was taken from a search for "clip board" of posts in this forum.

Code: Select all

'===================================================================================================
' MethodStubs
'===================================================================================================
#Include "windows.bi"

Declare Sub CreateDeclare(clipText As String)
Declare Function get_clipboard () As String
Declare Sub set_clipboard (Byref x As String)
Declare Sub CreateProcedure(txt As String)
Declare Sub HandleClipboardText()

Function get_clipboard () As String
  Dim As Zstring Ptr s_ptr
  Dim As HANDLE hglb
  Dim As String s = ""

  If (IsClipboardFormatAvailable(CF_TEXT) = 0) Then Return ""

  If OpenClipboard( NULL ) <> 0 Then
    hglb = GetClipboardData(cf_text)
    s_ptr = GlobalLock(hglb)
    If (s_ptr <> NULL) Then
      s = *s_ptr
      GlobalUnlock(hglb)
    End If
    CloseClipboard()
  End If

  Return s
End Function

Sub set_clipboard (Byref x As String)
  Dim As HANDLE hText = NULL
  Dim As Ubyte Ptr clipmem = NULL
  Dim As Integer n = Len(x)

  If n > 0 Then
    hText = GlobalAlloc(GMEM_MOVEABLE Or GMEM_DDESHARE, n + 1)
    Sleep 15
    If (hText) Then
      clipmem = GlobalLock(hText)
      If clipmem Then
        CopyMemory(clipmem, Strptr(x), n)
      Else
        hText = NULL
      End If
      If GlobalUnlock(hText) Then
        hText = NULL
      End If
    End If
    If (hText) Then
      If OpenClipboard(NULL) Then
        Sleep 15
        If EmptyClipboard() Then
          Sleep 15
          If SetClipboardData(CF_TEXT, hText) Then
            Sleep 15
          End If
        End If
        CloseClipboard()
      End If
    End If
  End If
End Sub
'Screenres 800, 600, 32
Sub CreateDeclare(clipText As String)
   '
   Dim As String s
   Dim As Integer x, y, n
   
   s = "Declare " + clipText
   set_clipboard(s)
   
End Sub
Sub CreateProcedure(txt As String)
   '
   Dim As String s
   
   s = Trim(Mid(txt, 9))
   set_clipboard(s)
End Sub
Sub HandleClipboardText()
   '
   Dim txt As String
   
   txt = get_clipboard()
   txt = Trim(txt, Any " " + Chr(9))
   If LCase(Left(txt, 4)) = "sub " Then
      ' create a declare statement for the clipboard
      CreateDeclare(txt)
   EndIf
   If LCase(Left(txt, 9)) = "function " Then
      ' create a declare statement for the clipboard
      CreateDeclare(txt)
   EndIf
   If LCase(Left(txt, 8)) = "declare " Then
      ' create proc stub from declare statement
      CreateProcedure(txt)
   EndIf
End Sub
HandleClipboardText()
'Screenres 800, 600, 32
'Declare Sub HandleClipboardText()
'sleep

This would be a most welcome addition to the two new IDE's Poseidon, and WinFBE.
PaulSquires
Posts: 879
Joined: Jul 14, 2005 23:41

Re: Best Programming Language

Postby PaulSquires » Feb 03, 2017 1:45

sancho2 wrote:
Boris the Old wrote:An easy way to avoid writing declares is to use a simple utility program to do it for you.


This would be a most welcome addition to the two new IDE's Poseidon, and WinFBE.


I have already implemented something like this in WinFBE. Check out my post at viewtopic.php?f=8&t=25215&p=228684#p228684

A new File Menu option to "Save Declares File". Auto generates a Declare file for all Sub/Functions that you can #Include into your project. It does not generate sub/functions found in TYPE structures. I need to test it for OVERLOAD functions but everything else should be okay.
Boris the Old
Posts: 139
Joined: Feb 04, 2011 20:34
Location: Ontario, Canada

Re: Best Programming Language

Postby Boris the Old » Feb 03, 2017 4:24

@Paul

Do you get the feeling that we're all re-inventing the same wheel? :-)

Rod
figosdev
Posts: 18
Joined: Jan 06, 2017 7:24

Re: Best Programming Language

Postby figosdev » Feb 05, 2017 3:47

Boris wrote:what I'm trying to say is that it's probably best for programmers to build up their own "toolkit" of useful stuff.


i think its a great idea, and thanks for the reply. if you ever feel like "rambling" more often, id be happy to invite you to a few forums where youd be welcome to. seems like theyre happy for you to do it here, though-- as am i.
Rickmeister
Posts: 18
Joined: Mar 23, 2013 1:03

Re: Best Programming Language

Postby Rickmeister » Feb 15, 2017 20:59

4 votes on FreeBASIC, 5 on Brainf**k.

Internet polls tells you the fact! Really! BF syntax is really nice and less error-prone then FB;s..
BasicCoder2
Posts: 3558
Joined: Jan 01, 2009 7:03
Location: Australia

Re: Best Programming Language

Postby BasicCoder2 » Feb 15, 2017 22:10

Rickmeister wrote:4 votes on FreeBASIC, 5 on Brainf**k.
Internet polls tells you the fact! Really! BF syntax is really nice and less error-prone then FB;s..


And 56 Don't Recommend BF.

And whereas BF is difficult to comprehend the BASIC language was designed to be easy to comprehend.

Probably I wouldn't recommend FreeBasic for a beginner simply because they would have to learn another language if they wanted to become professionals. FreeBasic will teach lower level programming better than some of the more modern languages but so will C and it can lead onto C++ or other programs used by professionals. Then again some say you should being with OOP from the get go.

.
Rickmeister
Posts: 18
Joined: Mar 23, 2013 1:03

Re: Best Programming Language

Postby Rickmeister » Feb 17, 2017 21:22

Another amazing internet truth is that irony never is appreciated..
BasicCoder2
Posts: 3558
Joined: Jan 01, 2009 7:03
Location: Australia

Re: Best Programming Language

Postby BasicCoder2 » Feb 17, 2017 23:51

It is appreciated but not always detected.
On problem with text is a lack of emotional content in a voiced statement not to mention facial expressions and body posture.
.
ike
Posts: 387
Joined: Jan 17, 2011 18:59

Re: Best Programming Language

Postby ike » Mar 10, 2017 23:56

I dunno what is best but I know what is worst: JAVA.

And if you see statistics 30% of all jobs out there is JAVA, J2EE and other crappy stuff. This world is crazy!
JohnK
Posts: 279
Joined: Sep 01, 2005 5:20
Location: Earth, usually
Contact:

Re: Best Programming Language

Postby JohnK » Mar 11, 2017 20:04

The "best" language is job-specific. JAVA, JavaScript (and its ilk), Python, etc are very popular languages right now not because of performance but because of distributed internet applications.

The "cloud" is really raining hard on our stand-alone desktop, optimized assembly-injected programming because large groups are requiring the internet for all their interconnected programs running all sorts of different platforms. I just recently reviewed several cutting-edge medical image graphics viewers. All have the end-user running in a web browser like IE, Chrome, Firefox, using HTML 5. Talk about language-interpreter hell!

Think about it. You are an IT professional in charge of 100's many 1000's of computers. Now comes 3 updates a year -- all the end-users just need to update their web-browser software, while the admin has to update a single server. All security updates are now much simpler too. Stand-alone computer programs can compete with this. It is just too much to update code for 3+ platforms, then install the new updates on tons of end-user computers.

FreeBasic is perfect for what you need it for. I use it for my specialized programs that need no GUI, need to be developed quickly in BASIC code, run fast, and that very few people need to install. After working with Visual Studio, I really appreciate simpler compilers!!!!
sean_vn
Posts: 283
Joined: Aug 06, 2012 8:26

Re: Best Programming Language

Postby sean_vn » Mar 12, 2017 12:40

If you use Java according to the strong dogma that surrounds it, it isn't any fun. If you use it as a low level language it is rather nicely defined. Anyway I want to buy Jetson TX2: http://www.nvidia.com/object/embedded-systems-dev-kits-modules.html
but I'm not going to get that one past the spouse. If they ever drop below the $200 range I would certainly try to get 2.
nada
Posts: 1
Joined: Apr 07, 2017 12:16

Re: Best Programming Language

Postby nada » Apr 07, 2017 12:52

There has been some rant here about other programming languages, that I felt compelled to register and comment.

1. There is no 'best' programming language overall. You would first have to define measurable criteria to compare all programming languages, which are quite a lot.

2. There might be a 'best-suited' programming language for a specific use-case.

Concerning Java:
While there are some things I personally would criticize, like
+ performance is below-average (theoretically it should be much higher, there has been some discussion about this topic for example on stack overflow, but in practice it's as below-average as it can get in my experience)
+ it is quite verbose compared to i.e. python, ruby etc
saying "Java is the worst programming language" is simply not true. Java is a mature, solid and stable language. Although its not my favorite programming language, I can understand its popularity. Its excelling traits are its OO-features and Exception-handling imo.

Concerning FreeBasic:
This is a freebasic.net hosted forum, so obviously posts here might tend to be a bit pro-freebasic, so to everyone reading this topic considering learning freebasic as a first programming language, please consider:
+ freebasic is not among the most popular programming languages. If you are a hobby developer and freebasic is probably the only language you are going to learn, go ahead and learn it. But if you plan on learning more languages, I wouldn't recommend freebasic as a first language, because:
+ freebasic has quite different syntax and semantics than most other popular languages (so learning it won't make learning other languages much easier) except maybe Visual Basic, which leads to my next point:
+ freebasic isn't even the most popular basic Visual basic is the only commonly used Basic derivative left today.
+ there is no sophisticated IDE for freebasic None that even has clever code-completion or static code analysis. There are pros and cons for using an IDE as a beginner, but as soon as you have been working with a good IDE, like IntelliJ's IDEs, Eclipse, Visual Studio etc, they are valuable points you could even add to your CV.
+ freebasic's object oriented features are not sophisticated at all And if you want to really learn a language, at least learn a mature object-oriented or functional one. Why:
+ freebasic is not even the fastest procedual language C is a bit faster than freebasic, plus it is more feature rich and more popular.

Being popular is quite important for a programming language. There are vital benifits:
+ bigger community ->
+ better support
+ more people working on its codebase
+ better chances finding a job with it
Tourist Trap
Posts: 2880
Joined: Jun 02, 2015 16:24

Re: Best Programming Language

Postby Tourist Trap » May 13, 2017 14:40

nada wrote:+ better chances finding a job with it

It's quite a paradox that you end with this criterium. If you want to get a job in programming, in my opinion, you really have to take courses at some school, to learn, not a programming language for itself, but one or many programming languages to get some practice of the theory you should learn at school (algorithms, computer structure etc...).

Once you got the real basics, which are not depending a lot of a language, you can make your choice depending on what you want exactly to do. For learning purpose, Freebasic is a very good choice. You have generally some good one to one translation between C and FB regarding to many things, you can inject ASM code in it, you can do OOP, or just find some cool oldies written in Basic in the past and adapt it.

Besides that I would recommend Python, because it is a scripting language of a lot of open-source mainstream softwares like Blender or Gimp. But if you want to work in banking area, it seems that you should seriously consider learning COBOL... So of course, all of that will be a matter of what you want finally to do.

Is there any good choice before you have mastered your first language? I don't think so unfortunately. And here FB seems a very good choice.
Boris the Old
Posts: 139
Joined: Feb 04, 2011 20:34
Location: Ontario, Canada

Re: Best Programming Language

Postby Boris the Old » May 13, 2017 16:00

In my experience, the concept of what makes a "best" language has nothing to do with how fast, sophisticated, or popular it is, but rather on what users consider to be a good application.

For example, I have customers still using DOS COBOL/ASM applications that I wrote over 30 years ago. They don't care that they run in a DOS box on a Win7 system. These are major business applications that have not crashed or revealed a bug since they were first installed. And I'm still getting requests to add new features.

I've had 55 years of writing software, in many different languages, for operating systems, telecommunications systems, and business applications. During that time there has been an on-going discussion of what language is best -- and it's all pointless. A language is used because it does the job according to the requirements of an IT department or a customer, not because it somehow gives the programmer a greater status.

I use FreeBasic because it is cross platform, has many low level features such as pointers, has simple OOP features with low overhead, has a macro facility, and has a simple but powerful syntax. It does what I need it to do -- write applications that I'm proud of and that provide me with a lifestyle to which I've become accustomed.

Rod
Z4usV
Posts: 1
Joined: May 14, 2017 12:59
Location: Amsterdam
Contact:

Re: Best Programming Language

Postby Z4usV » May 14, 2017 14:34

BASIC the best programming language. Read what a famous informaticiam said

Edsger Dijkstra (1930-2002)

(EWD498: How do we tell truths that might hurt? [1975])
"It is practically impossible to teach good programming to students that have had a prior exposure to BASIC:
as potential programmers they are mentally mutilated beyond hope of regeneration."

(EWD898: The threats to computing science. [1984])
"I think of the company advertising "Thought Processors" or the college pretending that learning BASIC suffices or
at least helps, whereas the teaching of BASIC should be rated as a criminal offence: it mutilates the mind beyond recovery."

(both quotes from Wikiquote in English)

Of course FreeBASIC is far more advanced than the interpreters those days, but still there are better languages e.g. Perl
.If it has to be easy FreeBASIC is not a bad option at all for a beginner. However I have to agree with Dijkstra turning someone who began with any dialect of BASIC turning to a great developer in any other computer language will be a "helluva" job.

Return to “Community Discussion”

Who is online

Users browsing this forum: No registered users and 4 guests