10 Replies - 491 Views - Last Post: 10 January 2018 - 02:51 AM

#1 bobsmith76   User is offline

  • D.I.C Head

Reputation: 9
  • View blog
  • Posts: 211
  • Joined: 14-February 17

has anyone written this software?

Posted 09 January 2018 - 11:57 AM

Suppose you're writing some code. Wouldn't it be great if for each line of code you knew what other lines the code depended on? For example, suppose you make a change in line 100 but if you make a change in line 100 then you must also change lines 33, 45, and 77. You would have to run through a set of inputs and then the software would make a dataset of all the dependent lines. I'm not quite sure how this software would be written but one possible way would be to change each line one by one and then keep tabs on at which line an error was first thrown. It might take a long time for this software to output its data but I think such software would be enormously useful for debugging. Does anyone know if such software has been written?

Is This A Good Question/Topic? 0
  • +

Replies To: has anyone written this software?

#2 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 14093
  • View blog
  • Posts: 56,466
  • Joined: 12-June 08

Re: has anyone written this software?

Posted 09 January 2018 - 11:59 AM

Yes. Visual Studios has 'find references' baked in.. various other IDEs did as well.
Was This Post Helpful? 0
  • +
  • -

#3 ndc85430   User is offline

  • I think you'll find it's "Dr"
  • member icon

Reputation: 825
  • View blog
  • Posts: 3,337
  • Joined: 13-June 14

Re: has anyone written this software?

Posted 09 January 2018 - 12:07 PM

You should also have tests that check that the behaviour is correct. If you make changes that aren't supposed to change behaviour, the tests should still pass. If there is a change in behaviour, then you add new tests or update (or remove in some cases) existing ones.
Was This Post Helpful? 0
  • +
  • -

#4 bobsmith76   User is offline

  • D.I.C Head

Reputation: 9
  • View blog
  • Posts: 211
  • Joined: 14-February 17

Re: has anyone written this software?

Posted 09 January 2018 - 12:42 PM

View Postmodi123_1, on 09 January 2018 - 11:59 AM, said:

Yes. Visual Studios has 'find references' baked in.. various other IDEs did as well.


Do you know if Pycharm has this? If so, what is it called? Also you used the word 'did'. Does this mean that these IDEs are no longer available? Lastly, what is the name of this feature so that I can do some Google searches?

View Postndc85430, on 09 January 2018 - 12:07 PM, said:

You should also have tests that check that the behaviour is correct. If you make changes that aren't supposed to change behaviour, the tests should still pass. If there is a change in behaviour, then you add new tests or update (or remove in some cases) existing ones.


Trust me, without testing I would be a basketcase. My tests only take 5 seconds to run, so in some refactoring cases I am literally running that test with the change of each line. When I am writing a new function however which is just an add-on to the code, I only test after the function is done being written.

This post has been edited by bobsmith76: 09 January 2018 - 12:41 PM

Was This Post Helpful? 0
  • +
  • -

#5 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 14093
  • View blog
  • Posts: 56,466
  • Joined: 12-June 08

Re: has anyone written this software?

Posted 09 January 2018 - 01:01 PM

You would have to investigate pycharm. I've never used it.

Did.. do.. did when I last looked.. most likely should..
Was This Post Helpful? 0
  • +
  • -

#6 bobsmith76   User is offline

  • D.I.C Head

Reputation: 9
  • View blog
  • Posts: 211
  • Joined: 14-February 17

Re: has anyone written this software?

Posted 09 January 2018 - 01:38 PM

View Postmodi123_1, on 09 January 2018 - 01:01 PM, said:

You would have to investigate pycharm. I've never used it.

Did.. do.. did when I last looked.. most likely should..


What about the name of this feature so that I can do a keyword search?
Was This Post Helpful? 0
  • +
  • -

#7 no2pencil   User is offline

  • Professor Snuggly Pants
  • member icon

Reputation: 6642
  • View blog
  • Posts: 30,931
  • Joined: 10-May 07

Re: has anyone written this software?

Posted 09 January 2018 - 01:39 PM

View Postbobsmith76, on 09 January 2018 - 01:57 PM, said:

Wouldn't it be great if for each line of code you knew what other lines the code depended on?

No. Seems like wasted overhead to me.
Was This Post Helpful? 0
  • +
  • -

#8 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 14093
  • View blog
  • Posts: 56,466
  • Joined: 12-June 08

Re: has anyone written this software?

Posted 09 January 2018 - 01:41 PM

"Find all references" / "Find References".
Was This Post Helpful? 0
  • +
  • -

#9 Skydiver   User is offline

  • Code herder
  • member icon

Reputation: 6216
  • View blog
  • Posts: 21,456
  • Joined: 05-May 12

Re: has anyone written this software?

Posted 09 January 2018 - 04:38 PM

Also Visual Studio's CodeLens keeps a live number count of how many things reference a method, property, or variable. In addition it knows how to talk to source control to know who changed what when, as well as talk to unit testing tools to know when it was last successfully tested.

Posted Image

Posted Image
Was This Post Helpful? 0
  • +
  • -

#10 jon.kiparsky   User is offline

  • Beginner
  • member icon


Reputation: 11071
  • View blog
  • Posts: 18,909
  • Joined: 19-March 11

Re: has anyone written this software?

Posted 09 January 2018 - 05:19 PM

View Postno2pencil, on 09 January 2018 - 03:39 PM, said:

Seems like wasted overhead to me.


I tend to agree with this. I'd rather rely on a good knowledge of the codebase plus strong test coverage.
Was This Post Helpful? 0
  • +
  • -

#11 andrewsw   User is offline

  • blow up my boots
  • member icon

Reputation: 6551
  • View blog
  • Posts: 26,559
  • Joined: 12-December 12

Re: has anyone written this software?

Posted 10 January 2018 - 02:51 AM

View Postbobsmith76, on 09 January 2018 - 06:57 PM, said:

Suppose you're writing some code. Wouldn't it be great if for each line of code you knew what other lines the code depended on?

It is this code dependency that SOLID principles strive to reduce and avoid. See also high cohesion, loose coupling

As has been mentioned already, frequent or continuous testing also reduces the occurrence of surprises!?

Quote

Since the 1990s, Continuous test-driven development has been used to provide programmers rapid feedback on whether the code they added a) functioned properly and b ) unintentionally changed or broke existing functionality. This testing, which was a key component of Extreme Programming, involves automatically executing unit tests (and sometimes acceptance tests or smoke tests) as part of the automated build, often many times a day.

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1