Win a copy of Functional Design and Architecture this week in the Functional programming forum!

Burk Hufnagel

Ranch Hand
+ Follow
since Oct 01, 2001
Cows and Likes
Cows
Total received
3
In last 30 days
0
Total given
0
Likes
Total received
20
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Burk Hufnagel

Thank you! I'm looking forward to reading it.
Special thanks to the authors for their help with my performance issues. I'm still working on it, but your advice has helped me in making headway.
D & D,

Another newbie question -- I'm working on an inherited (from another developer) browser app that has a data entry form that can be used to either create a new request or edit an existing one. It uses the antd library for the various fields and I've been asked to modify the code so that when the user is editing an existing request, the Save button is disabled unless one or more of the fields has been changed.  This makes sense but I'm concerned about keeping track of whether or not anything has changed.  When the user is editing an existing request, I have access to the original data returned by a web service, so I could make use of each field's onChange method and compare it's current value with the original, but I'm hoping there's a better way. Any suggestions?

Thanks,
Burk
I'll definitely look into the testing library and profiler.

In the meantime, I found that several of the components had another class declared in the same file, but outside of the component, and it was the same code copy/pasted into those files. So, I created a separate file for it and imported it instead. The class constructors are still being called multiple times, but it did reduce the overall codebase size and means I only have to make changes in one place if there's an error in that code.

The other thing I found is that even though the constructors are called multiple times, the class methods that call external web services are only being called once. It's like it creates an instance and starts to use it, but keeps creating copies that remain unused, until the component gets the data it needs so it can be rendered. Does that make any sense to you?

Thanks in advance,
Burk
I'm relatively new to React and the application that's having issues, but I can tell you that App does not declare any components within itself. This is a web app using the antd library so App sets up the basic layout of the pate. It imports several classes like Header, Footer, Sider, and Content then declares an onCollapse method to open or close the Sider (which contains a menu) and ends with the return method that sets up the layout for the page.

Looking at the console log, I can see that when I select some of the pages from the menu the constructor only runs once, but on others, it runs multiple times. I'll check the code to see if the pages where it runs multiple times contain other class definitions.

Thanks for the info - it may help solve this mystery and improve the app's performance,
Burk
Hello David and Dawn,
I'm working on an inherited React application that's behaving oddly, and I'm hoping you can help me with it. When the app runs, it seems to call the constructor for each object three times. I'm new to React, so I did some research and found references to StrictMode -- and sure enough, the index.tsx file had the same code I see in your book:

So I removed the React.StrictMode tag around the <App/> tag, and rebuilt the app, but it still calls constructors three times. I searched the code and don't see any other places where React.StrictMode is being used so I'm wondering if there's anything else that might cause this kind of behavior?

Thanks for any help you can offer on this,
Burk
Mark,
This looks like a very interesting book. Is there anything in it that is specifically for programmers or software architects, or addresses a problem we tend to have?

Thanks,
Burk
9 months ago
Mark,
Welcome to the Ranch. It's a sunny place for shady people... or something like that.  
9 months ago

Himanshu Ahuja wrote:Yes and if there are any tools available to do so


There are plenty of tools out there, like SpotBugs (successor to FindBugs) and SonarQube (with plugins), and most IDE's will support setting up coding standards and showing you when your code doesn't follow them.
2 years ago

corey haines wrote:Hi!

I think a lot of that depends on the constraints and people's familiarity with TDD. Most people that I ran into came to a coderetreat with the expectation that it was "a chance to practice or learn TDD," so they at least tried. Personally I always emphasized that a coderetreat is a great time to try new things, since the goal isn't to finish the implementation, nor even to get anywhere at all. If a single test is written, but it is a great test, then that session should be considered successful.

-Corey



Thank you for the response. I was hoping to leverage your experience and get a feel for TDD adoption around the globe. Based on what I've seen in Atlanta, GA, USA, it seems that TDD still isn't common (less than 50% use it) and that many senior developers don't want to try it because... fill in the blank -- while younger developers at least seem open to the idea, give it a shot and mostly find it valuable.
2 years ago

Liutauras Vilda wrote:I guess quite usual answer is when current implementation no longer works with new requirements. So really there is no quality evolution with an existing functionality. Which is of course sad.


But if the code no longer meets the requirements that means the new version behaves differently than the original code, so the change doesn't qualify as a refactoring. Right?
2 years ago

Liutauras Vilda wrote:Burk, have a cow for quality question. Let's wait and see what author has to say about that.


It's been a while since I last visited. I had to look up the significance of receiving a cow. Thank you. I appreciate it.
2 years ago

Campbell Ritchie wrote:Or whether they believe that getting the app working implies they have written good code


I've seen that a lot with experienced developers, but when I ask them how often they refactor their code, the smiles go away...
2 years ago
Corey,
I'm also wondering if you've noticed any correlation between the use of TDD and the quality of the code people produce, or whether they manage to get the game working at the end of the allotted time.

Thanks,
Burk
2 years ago
Corey,
In the excerpt, there are several examples of test people write while working on getting their programs to work. Based on what you've seen, do most of the participants follow some form of TDD? Have you seen a difference between less experienced developers and more experienced developers regarding TDD usage?

Thanks,
Burk
2 years ago
Welcome Alex and Jason. I hope your time here is fun and fruitful.
Burk
PS Hi Jeanne!
3 years ago