Open Side Menu Go to the Top
Register
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

04-06-2018 , 09:29 AM
Quote:
Originally Posted by _dave_
I am a huge fan of Visual Studio Code (which is a different thing than Visual Studio).

One thing I love about Linux is the highlight / middle click alternative copy/paste buffer. Rarely see this mentioned but it's a huge productivity booster for me.
Yea it's visual studio code that I use to run and debug tests.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-06-2018 , 10:08 AM
Quote:
Originally Posted by Larry Legend
Am I wrong in thinking sublime is basically the same as atom?
No, except many people experience lag/memory issues using atom

Quote:
I also basically never have lag/memory issues in atom.
Atom looks nicer imo, and it's open source so I'd use that in your case.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-06-2018 , 10:30 AM
I was reviewing a PR from a junior dev and this made me think of jmakin's crazy codestyle requirements...

Code:
public class SomeObject {
  public SomeObject() {
    initSomeObject();
  }

  private void initSomeObject() {
    // 7 lines of init logic here...
  }

  // rest of the class...
}
initSomeObject() isn't called anywhere else in the class.

** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-06-2018 , 11:01 AM
I basically know nothing about non javascript but doesn't java/other languages have some form of linting where it would say "hey you declared a variable/method but its never used. dumbass."?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-06-2018 , 11:24 AM
huh? It's used once, in the constructor.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-06-2018 , 11:31 AM
Does it have to do with SomeObject () being public and the method to init being private, and some intentions of private/public separation?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-06-2018 , 11:48 AM
Its obviously dopey looking when theres one method, but thats a pretty standard practice. Imagine 3 of those vs 25 lines of code in the constructor and you come in fresh trying to see what its doing.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-06-2018 , 11:50 AM
The reason this is bad is because initSomeObject is completely redundant. It wraps the complete constructor logic for no reason, and its only used once.

It's basically doing this:
Code:
function sum(a, b) {
  return sumUpAandB(a, b)
}

function sumUpAandB(a, b) {
  return a + b;
}
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-06-2018 , 11:53 AM
that's exactly the kind of function i've been writing, but even worse:

i want to prompt a user for a certain input string in C. so I write a function, prompt_input().

then I realize it's only 3 lines and the function that calls prompt_input() isn't going to make the line requirement. But, I want to store that data in a struct. So i just store the data in the prompt_input() function, which is terrible design.

which leads me to rename the function "prompt_and_store_input()" which is slightly better but now basically the function is not really useable again except in very specific cases but that was the easiest way to write the code given the line requirement. it's also bad design because i think any basic function that asks for something and returns a value shouldn't do "other" things like store data at the same time.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-06-2018 , 11:55 AM
why not have prompt_input() return a pointer to a new struct containing the results?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-06-2018 , 11:58 AM
that's a good idea. i guess this class is a good exercise overall in making me actually think about code structure. i'd rather just write a basic prompt_input() function that can be reused throughout the whole program, and have a function like "insert_data()" that calls prompt_input and stores the data. but the insert_data() function I'm writing needs to prompt 3 times for 3 different things and I just can't hit that 5 lines.

binary search in 5 lines isn't easy either for how i need to implement it.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-06-2018 , 11:59 AM
Quote:
Originally Posted by _dave_
I am a huge fan of Visual Studio Code (which is a different thing than Visual Studio).

One thing I love about Linux is the highlight / middle click alternative copy/paste buffer. Rarely see this mentioned but it's a huge productivity booster for me.
vs code plus git bash is pretty awesome and has a very low barrier to get started with ways to majorly improve.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-06-2018 , 12:03 PM
Quote:
Originally Posted by Larry Legend
Yea it's visual studio code that I use to run and debug tests.
run tests in bash and debug with the chrome debugger
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-06-2018 , 12:28 PM
For 99% of stuff I run tests from the command line and use the chrome debugger, but visual studio code seems to have a much more feature rich test running suite for the times when you are writing a lot of tests and reviewing tests.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-06-2018 , 01:31 PM
In other news my react project is nearly being deployed so now I'm working on Backbone/Dojo/Cujo/kitchen sink object oriented project.

It's interesting to go from working on new stuff to a 7 year old codebase.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-06-2018 , 01:46 PM
Quote:
Originally Posted by saw7988
I generally side with the stance that your time spent thinking/planning/reading code >>>>> typing code so usually vim isn't going to be worth it purely from a time/productivity perspective.
Even if you ignore the speed advantage, vim makes text editing less tedious, which in itself is a major productivity boost.

Consider something primitive like copying and pasting a line in vim: `yyp`, which is 3 keystrokes (or 2.5 if you consider a repeated keystroke on the index and middle fingers as 1.5 keystrokes). Compare this to non-Unix editors like Sublime or Notepad++ where you'd have to use all sorts key presses of Ctrl and Shift and repeated smashing of the arrow keys, or worse use the mouse.

Sent from my SAMSUNG-SM-G925A using Tapatalk
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-06-2018 , 01:49 PM
what? with nothing selected copying a whole line in vsc/sublime is control+c, control+v. And you'll get incredibly more powerful autocompletion at the very least.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-06-2018 , 02:07 PM
officially employed as a software engineer

woop woop
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-06-2018 , 02:14 PM
Noice jmakin!
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-06-2018 , 02:25 PM
Quote:
Originally Posted by jmakin
officially employed as a software engineer

woop woop
congrats!
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-06-2018 , 02:42 PM
Quote:
Originally Posted by jmakin
that's a good idea. i guess this class is a good exercise overall in making me actually think about code structure. i'd rather just write a basic prompt_input() function that can be reused throughout the whole program, and have a function like "insert_data()" that calls prompt_input and stores the data. but the insert_data() function I'm writing needs to prompt 3 times for 3 different things and I just can't hit that 5 lines.

binary search in 5 lines isn't easy either for how i need to implement it.
Why not have generic "prompt_input" that returns a string and then a "prompt_for_X" that calls your "prompt_input" function 3 times and returns the struct of that data?

I still think forcing people to think about different ways of structuring code/functions is useful* - even if its a silly artificial model that you're forced to use. I think to benefit though you have to try to meet the spirit of the requirements and not just the hard and fast rule.


* I'm certainly skeptical that its useful enough for all the pain/effort it causes students. So its probably a low efficiency teaching tactic... but hell that's a good chunk of formal education.


Edit: Also, congrats!
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-06-2018 , 04:15 PM
or it will crystallize terrible habits
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-06-2018 , 04:53 PM
Quote:
Originally Posted by Victor
or it will crystallize terrible habits
I don't actually believe this is true.
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-06-2018 , 08:36 PM
Quote:
Originally Posted by Grue
what? with nothing selected copying a whole line in vsc/sublime is control+c, control+v. And you'll get incredibly more powerful autocompletion at the very least.
Oh didn't know you could do that in Sublime. But that was a very trivial example.

Sent from my SAMSUNG-SM-G925A using Tapatalk
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote
04-06-2018 , 08:46 PM
atom/sublime seem interchangeable. does atom have those "purchase me" pop ups?
** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD ** Quote

      
m