Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Locked thread
Bloody
Mar 3, 2013

Funk In Shoe posted:

LIke I wasn't even aware until right now that there's apparently a difference in naming schemes for stuff where you either call a variable e.g. "myAge" or "my_age" but then you have to stick with that naming scheme? I've always just stored variables as whatever, like, "who cares" - some of my things have literally variables just called "n1" or "blalabla2_new" etc, all jumbled together.

are you a phd/postdoc/professor?

Adbot
ADBOT LOVES YOU

oh no blimp issue
Feb 23, 2011

MALE SHOEGAZE posted:

haha oh man that's exactly how i did things in vbasic when I was learning

:psyduck:

Funk In Shoe
Apr 20, 2008

Waiting in line, Mr. Haydon told me it is a wheel not meant for lovers but for infants, lifting people and letting them swing, putting the world on display from up high

Bloody posted:

are you a phd/postdoc/professor?

Yes

Bloody
Mar 3, 2013

working as intended, then

leftist heap
Feb 28, 2013

Fun Shoe
lots of or most CS programs don't really teach you how to code well anyway don't worry about that. most of a CS department faculty writes horrendous code.

pointers
Sep 4, 2008

Funk In Shoe posted:

Thanks - I just plowed through "Learn python in a day and learn it well" and most of what it covered I already knew, just from playing around with delphi as a kid. I think a large part of my concern is -- as you say -- that I have never been taught in "best practice" or "proper ways" of doing stuff and while I can make stuff kind of sort of work, I have the distinct feeling that if anybody with a CS degree were to ever take a look at my coding they'd have several kinds of stroke.
poo poo dude, i have a cs degree and i think that. companies (mostly) dont give a poo poo, that's why there are code reviews, just make poo poo work

Symbolic Butt
Mar 22, 2009

(_!_)
Buglord

coffeetable posted:

if you do decide on python, Think Python is a) free b) reasonably short c) very good for new programmers. then chase that with a more comprehensive book

seconding Think Python because it's great

also there's lots of moocs like coursera that use python, I unironically think you can get a pretty decent computer science foundation doing a bunch of them

that's p much what I did lmao

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

to be fair i was 11 and googling how to program never occurred to me. i just learned by reading the tutorials provided with the pirated very of vbasic my uncle gave me

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
also dude your code works and is providing value to people. that's more than many programmers can claim.

Funk In Shoe
Apr 20, 2008

Waiting in line, Mr. Haydon told me it is a wheel not meant for lovers but for infants, lifting people and letting them swing, putting the world on display from up high

MALE SHOEGAZE posted:

also dude your code works and is providing value to people. that's more than many programmers can claim.

true but otoh, my code is so horrible I can barely tell what its doing most of the time myself.

The sample below is the only function I ever commented, because I had to because whenever I would open it up I would be confused about wtf was even going on.

Its called by a timer every 3 seconds to let the robots be in a sort of idle state where they make minimal/randomized changes to all their motor/servo positions to keep everything looking alive. The caveat was that when I first did this, I almost broke one of the machines when it randomly first whipped its "head/neck" tilt servo to position 0 and then instantly all the way to, like, around position 180. So I had to figure out a way to make that particular servo move in increments between random positions.... and Im dumb as hell so it took me like two days.

Also when I wrote it I attached it to a Button (Tform1.button1click) and guess I was so excited I finally got it to work that I didnt bother make it a proper function. So now its just a timer that calls the button1click every 3 seconds whenever the robots are idle....


code:
// Idle loop, picks 9 actuator positions and incrementally approaches the neck position(+/- 5 angle every 25 miliseconds)
//this is rather than just change neck join instantly
// to avoid neck joint instantly jerking to new position which will end up shaking our machinery loose over time

procedure TForm1.Button1Click(Sender: TObject);
var

  s : string;
  eyeint, eyeup, eyeint2,eyeup2: integer;
begin
   //Check laptop name to set Eye-movement range for Robot. If its D05977, its controlling T2 and needs a higher eye angle due to misaligned eye actuators
   if name = 'D05977' then         begin    //guess its T2, higher eye motor settings
   eyeup :=  randomrange(100, 250)-250;
   end ;
   if name = 'D03725'     then begin        //guess its T1, higher eye motor settings
    eyeup :=  randomrange(0, 150)-250;
    end;
    //end laptopname/eyeup factor check
      s := '';
  i2 := RandomRange(1,200)-100;
   eyeint := randomrange(0, 230)-130;
  // Start loop by assessing whether the new neck position is bigger or smaller than the new one
  if i2 > previoushit    then begin; //if new random neck actuator position bigger, add it to the old one
  for i := previoushit to i2 do
  begin

  sleep(25);
    s := s + IntToStr(i) + ' ';

//send move string TCP to robots 9 actuators (format M0 0 0 0 0 0 0 0 0)
 ClientSocket1.Socket.SendText('M'+ inttostr(eyeint) +' '+ inttostr(eyeint) +' '+ inttostr(eyeup)+' ' + inttostr(randomrange(-30,30))+' '+inttostr(i+5)+' '+ inttostr(randomrange(-50,-30))+' '+ inttostr(randomrange(-10,10))+' 0 0');
              if shape1.Brush.color = clgreen then

            previoushit := i;

   end;   end;
  // Start loop by assessing whether the new neck position is bigger or smaller than the new one
     if i2 < previoushit then begin; //if new random actuator position is smaller, subtract in increments until new actuator position is reached
  for i := previoushit downto i2 do
  begin
  sleep(25);
    s := s + IntToStr(i) + ' ';

//send move string TCP to robots 9 actuators (format M0 0 0 0 0 0 0 0 0)
 ClientSocket1.Socket.SendText('M'+ inttostr(eyeint) +' '+ inttostr(eyeint) +' '+ inttostr(eyeup)+' ' + inttostr(randomrange(-30,30))+' '+inttostr(i+5)+' '+ inttostr(randomrange(-50,-30))+' '+ inttostr(randomrange(-10,10))+' 0 0');

    end;
   previoushit := i;
//For REDACTED if you have a problem with this and im not around, please give me a call at REDACTED or hit me up at REDACTED
    end;       end;
so, in short and in summary, my coding is horrible;



edit: holy lol, reading my own post I just noticed this

code:
" if shape1.Brush.color = clgreen then

            previoushit := i;
I have no idea - literally no idea, why this "if" statement is in there or why I base anything off the brush color of a square shape on a form??? I just took it out.

Funk In Shoe fucked around with this message at 18:37 on Sep 18, 2015

Hunter2 Thompson
Feb 3, 2005

Ramrod XTreme
You're clearly smart, so don't doubt yourself. I didn't have a problem understanding the code you posted, even if it was pretty disorganized. IMO most "good" programming is really just knowing the art of keeping things tidy and easy to understand at first-read. It's a craft and takes time to learn, but it's not difficult to do. Focus on this for maybe 8-10 hours of practice and you'll improve a ton.

Start writing and using functions to automate things you do often. The calls ClientSocket1.Socket.SendText are good candidates for this. Give them helpful names which describe what they do, but not how they do it.

That's all, good luck!

Blinkz0rz
May 27, 2001

MY CONTEMPT FOR MY OWN EMPLOYEES IS ONLY MATCHED BY MY LOVE FOR TOM BRADY'S SWEATY MAGA BALLS
waiting on a call back to talk salary. any suggestions for negotiating?

pepito sanchez
Apr 3, 2004
I'm not mexican
i never did anything meaningful with python but the amount of learning resources, the ease of use and syntax, and the number of libraries and their applications are huge. data analysis, sciency things, embedded systems of all kinds too. so if you're really wanting to sink your teeth into a new programming language like you are i'd go with it. python really looks to me like it's so popular because it's pretty much been shaped into something that a professional from any field with minimal or no programming knowledge could do meaningful things with in a very short amount of time. i wouldn't even buy a book. videos and books and wikis are just a search engine query away.

NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt


so that is why a couple of my coworkers have this annoying habit of declaring all local variables at the start of a method instead of putting them in context. They both have a Delphi background, but I had never actually seen delphi so I never made the connection.

Hunter2 Thompson
Feb 3, 2005

Ramrod XTreme

Blinkz0rz posted:

waiting on a call back to talk salary. any suggestions for negotiating?

If they give you a number you're happy with, say "I'm excited to start, but was thinking <5-10k> more since my *expertise in something* will bring you a lot of value". If they give you a number you don't like, say "I'm excited to work for you, but the typical pay is <a number you like + 5-10k>, but since I can bring your company a lot of value with my *expertise in something*, I was thinking more like <5-10k on top of that>".

Don't give a number first, if most experienced negotiators are to believed.

Illusive Fuck Man
Jul 5, 2004
RIP John McCain feel better xoxo 💋 🙏
Taco Defender

all this stuff you're talking about reminds me of when I was like 10 and some high schooler was teaching me visual basic 6.0. He never got around to teaching me about loops so I just didn't know they existed. Whenever I wanted something to happen repeatedly, I'd add another 'timer' thing to the program and put what I wanted in there. My frogger game had like 40 of those timers because I added one for each car on the road, etc. it was pretty bad.

Hunter2 Thompson
Feb 3, 2005

Ramrod XTreme

NihilCredo posted:

so that is why a couple of my coworkers have this annoying habit of declaring all local variables at the start of a method instead of putting them in context. They both have a Delphi background, but I had never actually seen delphi so I never made the connection.

I always thought that was a prehistoric C thing from when compilers weren't smart enough to figure out how far to move the stack pointer on their own.

Funk In Shoe
Apr 20, 2008

Waiting in line, Mr. Haydon told me it is a wheel not meant for lovers but for infants, lifting people and letting them swing, putting the world on display from up high

Illusive gently caress Man posted:

all this stuff you're talking about reminds me of when I was like 10 and some high schooler was teaching me visual basic 6.0. He never got around to teaching me about loops so I just didn't know they existed. Whenever I wanted something to happen repeatedly, I'd add another 'timer' thing to the program and put what I wanted in there. My frogger game had like 40 of those timers because I added one for each car on the road, etc. it was pretty bad.

Haha - I never really got past being 10 and using timers for everything. It's a huge embarrassment. Also loops and while stuff is hard. Some of my things have like, 3-4 different timers all turning each other on and off. Its a mess.


NihilCredo posted:

so that is why a couple of my coworkers have this annoying habit of declaring all local variables at the start of a method instead of putting them in context. They both have a Delphi background, but I had never actually seen delphi so I never made the connection.

See this is why I am afraid that I might be doing myself a disservice by just doing Delphi stuff. I keep getting the feeling that its somehow antiquated or wrong and whenever I look at other languages they just look weird.

ullerrm
Dec 31, 2012

Oh, the network slogan is true -- "watch FOX and be damned for all eternity!"

meatpotato posted:

I always thought that was a prehistoric C thing from when compilers weren't smart enough to figure out how far to move the stack pointer on their own.

Sorta. The original ANSI C language spec said that declarations had to be at the top of the current block/scope. But it's easy enough for a compiler -- even a prehistoric one -- to scan an entire function at a time and find all the declarations, and then behave as if they were at the top. (After all, C doesn't have constructors, so ordering doesn't really matter; you just need to figure out how many bytes you're putting on your stack.)

So, most compilers of the 90s would let you get away with declaring them anywhere, as long as they were declared before use.

Funk In Shoe posted:

See this is why I am afraid that I might be doing myself a disservice by just doing Delphi stuff. I keep getting the feeling that its somehow antiquated or wrong and whenever I look at other languages they just look weird.

Delphi is antiquated. But I wouldn't call it "wrong" -- it's just another language. (I'd be very concerned for my future career if it was the only language I knew, though.)

Blinkz0rz
May 27, 2001

MY CONTEMPT FOR MY OWN EMPLOYEES IS ONLY MATCHED BY MY LOVE FOR TOM BRADY'S SWEATY MAGA BALLS

meatpotato posted:

If they give you a number you're happy with, say "I'm excited to start, but was thinking <5-10k> more since my *expertise in something* will bring you a lot of value". If they give you a number you don't like, say "I'm excited to work for you, but the typical pay is <a number you like + 5-10k>, but since I can bring your company a lot of value with my *expertise in something*, I was thinking more like <5-10k on top of that>".

Don't give a number first, if most experienced negotiators are to believed.

that's exactly what i did. just negotiated a cool six and a half figgies plus 10% bonus per quarter plus stock options

Bloody
Mar 3, 2013

Blinkz0rz posted:

that's exactly what i did. just negotiated a cool six and a half figgies plus 10% bonus per quarter plus stock options



:stare: take me with you

eschaton
Mar 7, 2007

Don't you just hate when you wind up in a store with people who are in a socioeconomic class that is pretty obviously about two levels lower than your own?

meatpotato posted:

I always thought that was a prehistoric C thing from when compilers weren't smart enough to figure out how far to move the stack pointer on their own.

it was, though it wasn't for that reason, it was more so they didn't have to make their symbol table for a function quite as dynamic as it could be

i.e. a shortcut that was probably appropriate on 16-bit systems with tens to hundreds of kilobytes of memory and hundreds of kilobytes to several megabytes of storage

same reason most symbols were limited to 8 characters in C: compactness of data structures in the compiler, linker, etc. actually mattered at the time

eschaton
Mar 7, 2007

Don't you just hate when you wind up in a store with people who are in a socioeconomic class that is pretty obviously about two levels lower than your own?

ullerrm posted:

Sorta. The original ANSI C language spec said that declarations had to be at the top of the current block/scope. But it's easy enough for a compiler -- even a prehistoric one -- to scan an entire function at a time and find all the declarations, and then behave as if they were at the top. (After all, C doesn't have constructors, so ordering doesn't really matter; you just need to figure out how many bytes you're putting on your stack.)

So, most compilers of the 90s would let you get away with declaring them anywhere, as long as they were declared before use.

you and I have different definitions of "prehistoric," that stuff in C originated in the 1970s, UNIX on 32-bit hardware with a megabyte or two of memory wasn't even a thing until 1980 or so

quote:

Delphi is antiquated. But I wouldn't call it "wrong" -- it's just another language. (I'd be very concerned for my future career if it was the only language I knew, though.)

I'd also suggest that Delphi isn't even really dead since you can still use it to target modern platforms (iOS, Android, .NET) and there's another vendor that makes their own interoperable stuff (RemObjects with Oxygene)

also to the Delphi user: your code really isn't that bad for your level of experience and honestly you should be able to pick up C# pretty easily, since it's basically "C-flavored Delphi"

I'd actually recommend you focus on that as your second language (rather than Python), because is relative familiarity will make it easier but it'll still help you figure out what's common to all programming (besides pain), just like learning a second language makes learning your third easier even if your second is Spanish and your third (say) Japanese

Hunter2 Thompson
Feb 3, 2005

Ramrod XTreme

Blinkz0rz posted:

that's exactly what i did. just negotiated a cool six and a half figgies plus 10% bonus per quarter plus stock options



NICE

Symbolic Butt
Mar 22, 2009

(_!_)
Buglord
this thread is becoming the true Current Job Status thread

Blinkz0rz
May 27, 2001

MY CONTEMPT FOR MY OWN EMPLOYEES IS ONLY MATCHED BY MY LOVE FOR TOM BRADY'S SWEATY MAGA BALLS
Your Current Programming Job is a Piece Of poo poo

Soricidus
Oct 21, 2010
freedom-hating statist shill

more like dICK posted:

use a buffer. use nio

what exactly is the benefit of this, over using the straightforward language construct that does exactly what I need?

like, all my code has is a huge fixed-length table of floats that needs efficient random access lookups. that's exactly what an array is. how is this improved by wrapping the array in another class that was intended for a different purpose and provides no extra functionality that's useful for my code?

Funk In Shoe
Apr 20, 2008

Waiting in line, Mr. Haydon told me it is a wheel not meant for lovers but for infants, lifting people and letting them swing, putting the world on display from up high

ullerrm posted:

Delphi is antiquated. But I wouldn't call it "wrong" -- it's just another language. (I'd be very concerned for my future career if it was the only language I knew, though.)

I'm not that concerned about my future career (I'm in a completely different field and just branching out due to an interest in these things) - it's not like I have any sort of credentials that could ever land me a programming job anyway, and heaven forbid I ever end up in a situation where I would need to pursue one.... Still, I feel like I am actively limiting my own development and learning by sticking to a language nobody uses.

(secondary question: how come nobody is using it? Embarcaderos Delphi XE8 seems like a really neat tool for developing stuff that works on both android, mac and windows? I'm sure theres something about it being clunky or slow or hard to implement in large organizations or something, but to me, it just seems kinda neat? Is it something to do with the fact that its a language thats really limited in the sense that you have to actually buy and pay for the particular software suite to use it?

Soricidus
Oct 21, 2010
freedom-hating statist shill
it's a niche language with a name that people associate with the 1990s and basically no mindshare. at that point it doesn't matter how good or bad it is, it's going to struggle to gain users and the single commercial source just adds another barrier.

CPColin
Sep 9, 2003

Big ol' smile.

Soricidus posted:

what exactly is the benefit of this, over using the straightforward language construct that does exactly what I need?

like, all my code has is a huge fixed-length table of floats that needs efficient random access lookups. that's exactly what an array is. how is this improved by wrapping the array in another class that was intended for a different purpose and provides no extra functionality that's useful for my code?

It's not.

coffeetable
Feb 5, 2006

TELL ME AGAIN HOW GREAT BRITAIN WOULD BE IF IT WAS RULED BY THE MERCILESS JACKBOOT OF PRINCE CHARLES

YES I DO TALK TO PLANTS ACTUALLY

Funk In Shoe posted:

(secondary question: how come nobody is using it?
non-free => small community => poo poo ecosystem

much (most?) of the value of a language is in its ecosystem

Vanadium
Jan 8, 2005

I was gonna say I hate how Delphi makes you declare all variables for a function in a block at the beginning of the function, because it means people just duplicate verbose or expensive expressions like five times instead of scrolling aaaaall the way up, adding a new variable, and scrolling aaaaall the way to where they were in the function

but i just realized what our actual problem is

Luigi Thirty
Apr 30, 2006

Emergency confection port.

coffeetable posted:

non-free => small community => poo poo ecosystem

much (most?) of the value of a language is in its ecosystem

And that's why Microsoft is cool again.

Funk In Shoe
Apr 20, 2008

Waiting in line, Mr. Haydon told me it is a wheel not meant for lovers but for infants, lifting people and letting them swing, putting the world on display from up high

coffeetable posted:

non-free => small community => poo poo ecosystem

much (most?) of the value of a language is in its ecosystem

This makes sense. Kinda makes me wish I'd happened on one of the more popular languages back when my brain was still malleable enough to learn new things.

Toady
Jan 12, 2009

FL Studio is written in Delphi

sarehu
Apr 20, 2007

(call/cc call/cc)

Toady posted:

FL Studio is written in Delphi

Amazing.

AWWNAW
Dec 30, 2008

variables should be declared as close to their usage as possible

makes refactoring easier and feels good

The Belgian
Oct 28, 2008
https://www.youtube.com/watch?v=v9DeX5njbXM

eschaton
Mar 7, 2007

Don't you just hate when you wind up in a store with people who are in a socioeconomic class that is pretty obviously about two levels lower than your own?

Toady posted:

FL Studio is written in Delphi

there's supposedly at least one DAW vendor who was seriously considering Haiku

digital audio workstation developers are weird

Adbot
ADBOT LOVES YOU

Funk In Shoe
Apr 20, 2008

Waiting in line, Mr. Haydon told me it is a wheel not meant for lovers but for infants, lifting people and letting them swing, putting the world on display from up high

I read somewhere that the early versions of Skype were written in Delphi, too :)

  • Locked thread