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.
 
  • Post
  • Reply
Bruegels Fuckbooks
Sep 14, 2004

Now, listen - I know the two of you are very different from each other in a lot of ways, but you have to understand that as far as Grandpa's concerned, you're both pieces of shit! Yeah. I can prove it mathematically.

Votlook posted:

I work at a small company with a few other devs, the CEO just informed us that the CTO (my direct manager) will be devoting all his time on completely rewriting our core product completely on his own, and no longer manage the dev team.

I should start sending out resumes, right?

either that or he should start sending out his resume. it's unlikely that a commercial product can be completely rewritten by one dude in a short period of time, and you also have to contend with second system effect - he may have shot his mouth off in a meeting about the quality of his developers and said he could do it better, and ceo called his bluff.

Adbot
ADBOT LOVES YOU

Maluco Marinero
Jan 18, 2001

Damn that's a
fine elephant.

Rocko Bonaparte posted:

Can any of the vim brokebrains explain their general text editing thought process? It's a serious question. The impression I got from vim was to think of the individual characters positionally in space and exploit vim's character navigation to get exactly where you want to go from where you started in as few keystrokes as possible.

Do the fundamental difference I think is vim brokebrains of which I am one, think of text editing in terms of relative positions rather than absolute positions a lot of the time.

Keep in mind I might get some of these wrong because they live in muscle memory half the time.

Change every after this character until the end of the line (C)
Insert at the start of the line (I)
Insert here (i)
Start a new line (o)
Start a new line before this one (O)
Change until the quote mark (ct”)
Delete this line (dd)
Delete the next three lines (d3d)
Do what I did last time (.)

This relative thinking can become pretty powerful when you start building macros on the fly with (@) followed by any letter. You can bind a macro to any letter. For example:

key: value1
key2: value2
key3: value3

can become

“key”: value1,
“key2”: value2,
“key3”: value3,

With

I”<ESC>ea”<ESC>A,<ESC>w

Recorded to a macro, which translates to:

Macro recording start, we’re using the letter d (qd)

Insert “ at the start of the line. (I”<ESC>)
Go the end of the next word. (e)
Append “ where the cursor is. (a”<ESC>)
Append , at the end of the line. (A,<ESC>)
Go to the next word (w)

Macro recording end (q)

This has you on the next line ready to repeat the macro as many times as you like. (20@d) repeat macro ‘d’ 20 times.

Because we edit with this relative thinking all drat day, writing stuff like this can be trivial compared to a regex, this was a less complex case but there are plenty more complex line macros that are way easier to do with vim than regex.

I’ve probably talked enough on this for now, but in my mind the benefit for vim is that the movement and editing commands map quite precisely to what it is you want to do. Without a pointer you’re doing stuff like:

Search for string (/string)
Next search hit (n)
Go to line 35 (35G)
Go to end of file (gg)
Go to start of file (G)

I think this is the thing that attracts people to vim despite the learning curve. Once you have powered through, it is an extraordinarily precise editing model in terms what you think and what you do, partially because of how specific all the movements are. Instead of using the mouse to do many different commands, the keyboard has a wide range of combinations that all map to muscle memory to eventually make the editing process a very intuitive and fast thing.

I had the benefit of learning vim over a period where I didn’t need to be productive though, because boy howdy will learning to crawl in Vim not be good for your productivity.

The muscle memory thing is I think a core reason people don’t switch from vim. Most emulations either are a little off or a little slow, and both play hell with the rhythm of your muscle memory. It’s probably not so bad these days, but my Vim editor config has so much investment into it that I’m in no hurry to switch, as Id have to flog out a decent vim like config for any editor I switch to.

Ghost of Reagan Past
Oct 7, 2003

rock and roll fun

Taffer posted:

Can anyone explain to me why anyone uses vim for any reason? If you're doing normal coding why would you not use an IDE or at least a good editor like sublime? Even when I'm in CLI I use nano, because gently caress vim and all its byzantine nonsense.
I'm trying to debug something I can't reproduce on my local development environment. So I could either spend hours trying to make a lovely local development environment reproduce a bug, or I could go in to a development server and begin mucking around with the code there. I could use nano but vim is more full-featured.

You might say: why not fix your local development environment situation???

To which I say: lol

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Taffer posted:

Can anyone explain to me why anyone uses vim for any reason? If you're doing normal coding why would you not use an IDE or at least a good editor like sublime? Even when I'm in CLI I use nano, because gently caress vim and all its byzantine nonsense.

Two reasons:

Because I have spent a long time learning it and can do what I need very, very, very quickly in it.

Because I have spent a long time using it and and so using non-vim (even with "vim plugins") means I am constantly doing vim commands that don't work and so I go much slower. Since I can do what I need to do in vim 99.9999% of the time, I just keep using it.


Rocko Bonaparte posted:

Can any of the vim brokebrains explain their general text editing thought process? It's a serious question. The impression I got from vim was to think of the individual characters positionally in space and exploit vim's character navigation to get exactly where you want to go from where you started in as few keystrokes as possible.

I don't really think about it any more. Once you've used it enough, it just happens. Like when I learned the guitar, I had to think about where to put my fingers for a 'C' chord, but after lots of practice, my fingers just go there. Same with vim (or any IDE): cursor needs to go there... it's there. The "problem" with vim is that it's probably a lot more work than most IDEs to get to that point.

The process is generally "I know my 'hjkl' movement. Man, this sucks going all the way there.. I wonder if there's a faster way? Oh, now I know the 'eb' commands. Okay, doing this other thing is slow.. I wonder if there's a faster way? Oh now I know..." for a looooong time.

Pixelboy
Sep 13, 2005

Now, I know what you're thinking...

Taffer posted:

If you're going to alter naming for local vars why not use hungarian notation instead, seeing as it's something of a real convention already?

It's really not, and Microsoft hasn't used it for years.

Pixelboy
Sep 13, 2005

Now, I know what you're thinking...

Skandranon posted:

I was just going to say Pity, but yeah, Cocaine as well.

I am going to create two new JS frameworks today using these names

Taffer
Oct 15, 2010


Pixelboy posted:

It's really not, and Microsoft hasn't used it for years.

Don't mistake that statement as support for it. Personally I dislike it a lot and never use it, but if you're going to use a separate naming convention for local and global vars at least use one that people will recognize, not your own special one that is different than all the others for no reason.

Doom Mathematic
Sep 2, 2008

Pixelboy posted:

I am going to create two new JS frameworks today using these names

https://www.npmjs.com/package/cocaine

Looks like pity hasn't been taken, though.

baquerd
Jul 2, 2007

by FactsAreUseless

Pixelboy posted:

It's really not, and Microsoft hasn't used it for years.

Also, if you can't see the definition of a local var from anywhere in its entire scope, your function is almost certainly too big.

Pixelboy
Sep 13, 2005

Now, I know what you're thinking...

Doom Mathematic posted:

https://www.npmjs.com/package/cocaine

Looks like pity hasn't been taken, though.

If I'm going to be working in JS, can I name something selfloathing?

Pixelboy
Sep 13, 2005

Now, I know what you're thinking...

baquerd posted:

Also, if you can't see the definition of a local var from anywhere in its entire scope, your function is almost certainly too big.

I'm not sure function overall function length has anything to do with var/auto -- think about some rando function that returns some rando type in the middle of your code block.

Another reason to use a modern IDE, I suppose.

Edison was a dick
Apr 3, 2010

direct current :roboluv: only
I use vim for programming because I learnt it as the highest common factor text-editor for the systems I'll be using, and I end up hopping between technologies often enough that it's not worth learning the IDE for that specific technology and generic IDEs suck.

geeves
Sep 16, 2004

Pixelboy posted:

If I'm going to be working in JS, can I name something selfloathing?

As long as it doesn't interfere with my blog for 2018: Fear and Loathing at JS Conf 2018

I'll shoot myself when Crockford declares victory over Java and demand that my ashes are shot out of a docker container.

qsvui
Aug 23, 2003
some crazy thing
I use Vim because I like modal editing. And no, I don't care what other editor you're using, it does not do Vim emulation well.

I will concede however, that I do not use the vi mode in bash.

qsvui fucked around with this message at 03:23 on Jan 3, 2018

Bongo Bill
Jan 17, 2012

I learned enough vim to be able to quickly navigate and edit text from a terminal when I must. I like the idea of composable editor commands, but anything that supports multiple cursors has all the power I've ever really wanted from an editor and then some.

leper khan
Dec 28, 2010
Honest to god thinks Half Life 2 is a bad game. But at least he likes Monster Hunter.

Rocko Bonaparte posted:

Can any of the vim brokebrains explain their general text editing thought process? It's a serious question. The impression I got from vim was to think of the individual characters positionally in space and exploit vim's character navigation to get exactly where you want to go from where you started in as few keystrokes as possible.

Verb modifier target. Change inside parens. Find 3 quotes.

Mostly agree with maluco marinero. Would point out modifiers that can be placed between the verb and the object; like ‘i’nside, ‘a’round, and ‘t’o. Also navigation around blocks using ‘{‘ and ‘}’ etc. I like the way vim handles folds as well. Also being able to navigate a diff tool using all the same <3 vimdiff.

For navigation on a line, I’ll often just use <number>f<char I’m looking at>. If I’m lazy I’ll drop the number and mash ; til I get what I want. Marks are also extremely useful. Also ctrl+o to jump to previous navigation (makes getting back after jumping to some function definition easy).

I’ve also grown accustomed to a lot of the features most of the vi emulation modes fail to capture. Like recording a macro and executing it over a search string across all open buffers. I’ve.. needed to do that more than I’d care to admit, but this isn’t the horrors thread.

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!
What did you all use before vim? I feel like I had used DOS edit way too much as a kid, and the Borland tool suite did nothing to help. I then flop into college, the UNIX intro book basically gave us a choice between vi and emacs. I struggled with both, but vi made me want to punch stuff. The rest is history.

Maluco Marinero
Jan 18, 2001

Damn that's a
fine elephant.
I tried very hard to use this when I got started developing (6 years ago seriously, although I've been dabbling all my life) - https://www.activestate.com/komodo-ide

This was starting from a Windows standpoint. At some point I gravitated towards vim, maybe because I spent a lot of time without a mouse set up, not really sure. At either rate I was hobbyist (my real job was working on a boat) so I could afford to burn productivity, and before I knew it I was too brokebrained to appreciate anything other than vim.

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Rocko Bonaparte posted:

What did you all use before vim? I feel like I had used DOS edit way too much as a kid, and the Borland tool suite did nothing to help. I then flop into college, the UNIX intro book basically gave us a choice between vi and emacs. I struggled with both, but vi made me want to punch stuff. The rest is history.

I split my time between using jEdit and being SSHed into things and using vim, so I started off using it, and then once I had enough time with it, I stopped using anything else.

Phobeste
Apr 9, 2006

never, like, count out Touchdown Tom, man
Somebody appears to have started talking about vim so I’d like to just say that emacs is the light and the way

qsvui
Aug 23, 2003
some crazy thing

Rocko Bonaparte posted:

What did you all use before vim? I feel like I had used DOS edit way too much as a kid, and the Borland tool suite did nothing to help. I then flop into college, the UNIX intro book basically gave us a choice between vi and emacs. I struggled with both, but vi made me want to punch stuff. The rest is history.

I used Sublime Text but found I was mashing chords way too often. Also, their plugins at the time were a bit lacking.

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!

qsvui posted:

Sublime Text.

I have to say that I'm surprised to see this mentioned by so many people. Like, in the vi/emacs battle of all time, the winner is Sublime.

geeves
Sep 16, 2004

Rocko Bonaparte posted:

I have to say that I'm surprised to see this mentioned by so many people. Like, in the vi/emacs battle of all time, the winner is Sublime.

Sublime users after I teach them what IntelliJ does: I've been wasting my time doing this crap?

ChickenWing
Jul 22, 2010

:v:

Sublime is great but god help you if you use it as an IDE when you have a Jetbrains option available.

duz
Jul 11, 2005

Come on Ilhan, lets go bag us a shitpost


Phobeste posted:

Somebody appears to have started talking about vim so I’d like to just say that emacs is the light and the way

Sorry, we're talking about text editors here.

Achmed Jones
Oct 16, 2004



Rocko Bonaparte posted:

What did you all use before vim?

Visual C++ for Windows stuff, but in Linux it was pretty much all pico/nano. All my Linux experience before college was just editing config files and doing exercises from O’Reilly books so it seemed fine but then vim and emacs were a big step up. I ended up caring much more about linux and unix programming, so yeah here we are.

Embarrassingly, I used pico/nano on a research project I was part of in college. The PI was like “dude, stop, your hard tabs are awful” so I did.

Don’t get me wrong, if I ever end up doing java or C/C++ or w/e professionally I’ll go hard for whatever IDE my team uses. But I do security at a Rails shop, so neither my prs into the apps nor my pocs demand that I go full IDE. Like, I’m sure you can make vim into a wannabe-IDE but ain’t no way I’m gonna deal with that at this point (I no longer take pleasure in janitoring my dotfiles as an end in itself). Vim is the text editor that I love, but if I need IDE functionality I’ll just use the right tool. Of course, I might not be the best judge of when an IDE is necessary, what with having a vim-hammer and all.

pigdog
Apr 23, 2004

by Smythe

Rocko Bonaparte posted:

What did you all use before vim? I feel like I had used DOS edit way too much as a kid, and the Borland tool suite did nothing to help. I then flop into college, the UNIX intro book basically gave us a choice between vi and emacs. I struggled with both, but vi made me want to punch stuff. The rest is history.

My high school's computer class had old Unix terminals with poor terminal emulation for arrow keys, so vi was the best usable editor. Also, Nethack. It's also universally available in near any unix-like OS and usable over whatever SSH client, so it's useful to know in that regard.

Reasons to use it for serious work seem mostly about legacy force of habit though. I get using keyboard over mouse, but at least Jetbrains IDEs are surprisingly usable without needing to touch the mouse at all.

leper khan
Dec 28, 2010
Honest to god thinks Half Life 2 is a bad game. But at least he likes Monster Hunter.

Phobeste posted:

Somebody appears to have started talking about vim so I’d like to just say that emacs is the light and the way

You will never convert the darkness in my heart. Hail Satan.

Volmarias
Dec 31, 2002

EMAIL... THE INTERNET... SEARCH ENGINES...
I couldn't live without a full IDE for development; past a certain point it just becomes too handy and the feature set is impossible to reproduce without statically analyzing the code. For example, finding every call to a certain method in your codebase, especially when many classes or interfaces have a method with that name, automatic refactoring, hover for documentation, etc.

That said, I'm marginally proficient in VIM for simple text editing/viewing/searching, though I've learned to lean on Sublime more and more.

leper khan
Dec 28, 2010
Honest to god thinks Half Life 2 is a bad game. But at least he likes Monster Hunter.

Volmarias posted:

I couldn't live without a full IDE for development; past a certain point it just becomes too handy and the feature set is impossible to reproduce without statically analyzing the code. For example, finding every call to a certain method in your codebase, especially when many classes or interfaces have a method with that name, automatic refactoring, hover for documentation, etc.

That said, I'm marginally proficient in VIM for simple text editing/viewing/searching, though I've learned to lean on Sublime more and more.

The trick is to run an ide headless and pipe all that info to vim. Thankfully other people have already done that work.

C#
jaba

Volmarias
Dec 31, 2002

EMAIL... THE INTERNET... SEARCH ENGINES...
... no, thanks.

Phobeste
Apr 9, 2006

never, like, count out Touchdown Tom, man

leper khan posted:

You will never convert the darkness in my heart. Hail Satan.

my friend, we're so open and inclusive we even have evil-mode. You too can be saved!

MisterZimbu
Mar 13, 2006

leper khan posted:

The trick is to run an ide headless and pipe all that info to vim. Thankfully other people have already done that work.

C#
jaba

I'll admit I stared at the OmniSharp page for 5 minutes before I forced myself to close the tab because if it stayed open any longer I'd end up with this installed.

MisterZimbu fucked around with this message at 17:30 on Jan 4, 2018

AskYourself
May 23, 2005
Donut is for Homer as Asking yourself is to ...
I never bothered to learned vi or vim and when it's the default editor I always check stack overflow on how to change it so I never really had a need.
I must admit that looking at someone that's proficient with vi is a little like watching a hacker movie.

When I don't need an IDE I use Notepad++, it has regex find and replace and lots of plugins.

fantastic in plastic
Jun 15, 2007

The Socialist Workers Party's newspaper proved to be a tough sell to downtown businessmen.
I exclusively write code in MS Word.

Skandranon
Sep 6, 2008
fucking stupid, dont listen to me

fantastic in plastic posted:

I exclusively write code in MS Word.

The additional formatting capabilities provide a much more solid foundation for creating easily read and maintainable code. I don't know why more people don't write code this way.

Volguus
Mar 3, 2009

Skandranon posted:

The additional formatting capabilities provide a much more solid foundation for creating easily read and maintainable code. I don't know why more people don't write code this way.

Plus it makes it easy to obfuscate code, simply by using a symbols font. Genius.

RussianBear
Sep 14, 2003

I am become death, the destroyer of worlds

Portland Sucks posted:

I know I'm butting up against some egos. We're talking about a bunch of electrical engineers mostly who are in their 50s and taught themselves to code in FORTRAN that are writing python scripts and C# now. Typical conversations are in the format of (ask a yes/no question about a section of code) -> (receive 30 minute extremely defensive justification for why it's bad and he didn't have a choice at the time but could totally do it better now if he had the time).


Rocko Bonaparte posted:

And there it is. I refuse to claim it as a career, but my current job is definitely dealing with REEWDASOC people (Random Electrical Engineer Who Did A Semester Of C) loving everything up. I'm a living Zamboni machine for that crap. Now let me crack these knuckles...

Anyways, some of them do turn around.

I'm an electrical engineer and I realize my code would make software engineers weep. Are there any resources that you can recommend? I want to be one of the ones that turns around.

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!

RussianBear posted:

I'm an electrical engineer and I realize my code would make software engineers weep. Are there any resources that you can recommend? I want to be one of the ones that turns around.

To be honest, if you're reading this thread and nodding along then you're probably fine. The issue is far less of electrical engineers being bad but the hubris that seems to come from acing some really rudimentary programming course. Then they decide software is simple and the people that struggle with it are idiots.

I feel like I'd be dismissive to recommend whole books in general so I can point you to some particular design patterns and topics if there's a specific activity you're doing. The rest of this thread will likely then jump right in too. Assuming you're writing software within or just in proximity of an electrical engineering discipline, then I have some free advice on stuff like:
1. Equipment control wrappers
2. Coordinating experiments
3. Elevated shell scripting ("elevated" as in "slightly more sophisticated than a few lines of bash or bat" instead of "running as Admin/root")
4. Data collection and dispersal

There are some other things but I've had to rehabilitate a lot of EEs on those particular topics. What has tended to work is an inverted approach where I show some of the hippy structuring stuff first to show that there's a whole other world out there and the general discipline of development tends to follow from that. This is opposed to trying to lay a lot of groundwork before getting into the stuff that really helps out.

Adbot
ADBOT LOVES YOU

Bongo Bill
Jan 17, 2012

For someone who's already got engineering discipline of some sort, I'd say this: If you learn how to write a good unit test, and by extension how to write code that it's possible to write a good unit test around, then you will have been exposed to enough ideas that you can learn anything else you need to know.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply