« first day (1022 days earlier)      last day (2158 days later) » 
00:00 - 17:0017:00 - 00:00

5:10 PM
@Comintern Only to people who are sufficiently advanced themselves.
Guns weren't magic to Europeans, but they sure where to the indigenous peoples Cortes met.
 
The vast majority of what I see discussed in here is black magic...
2
 
*were
 
Kaz
@Comintern I always cite this (when reading between the lines) as a brilliant example of why most bosses love people who can develop things quickly and efficiently in a spreadsheet.
IMO, VBA's only killer problem is that it doesn't scale. (along any kind of metric. LoC, Complexity, Requirements, Auditing etc.)
But this also means that you can provide an awful lot of value to individuals and small groups in very little time by building 80% of a complete solution in VBA, and letting them handle the rest of the 20% in a spreadsheet.
 
Remy's Law of Requirements Gathering: no matter what the actual requirements, what your users really want is for you to implement Excel.
 
^
Pays my bills. A large part of my job is normalizing that crap after 5 or 10 years.
 
Kaz
5:21 PM
@Mat'sMug I literally learnt VBA as a byproduct of "How do I automate this spreadsheet?"
 
@Kaz I think that's most anyone that hated repeating things in Excel.
 
@Kaz I started with IBM Reflection VBA - building UserForms to handle data input instead of using the Easytrieve "forms".
 
Kaz
I googled something like "how to automate spreadsheet", found out about VBA, ordered "Excel VBA for Dummies", read it cover to cover over 2 days, started automating spreadsheets.
Took about 12 months before I was any good at it though ^^
 
@Kaz wait what's the rest of the story?!
@Kaz /s/12 months/4-5 CR Q&A's/ ;-)
 
Kaz
@Mat'sMug Coincidentally, I found CR about 11 months in ^^
@Mat'sMug Apparently, that's all there is. I do like dailyWTF, but I split their VBA stories roughly 50/50 into: "Yes, that really is ****** up", and "This is being disparaging about software that isn't new and shiny and "conforms to best practices" but that actually solves real problems for real problem that creates real value".
 
5:28 PM
user image
5
^ That's my favorite.
 
LOL!!
 
@Comintern ... Why does that hurt just a little too much?
 
Kaz
One of the best examples of Spreadsheets Done Right I've ever seen in real life was when I spent a week in BlackRock's London HQ as a spring internship during my degree. (BlackRock manages some $5 Trillion of investments). They have an entire department of people in the Analytics division whose sole job is to build spreadsheets-to-order for other people in other departments.
 
6:35 PM
Public Sub SubWithManyParameters(p1 As Range, _
                                 p2 As Range, _
                                 p3 As String, _
                                 p4 As Range, _
                                 p5 As String, _
                                 Optional ByVal p6 As Long = 1, _
                                 Optional ByVal p7 As Long = 2, _
                                 Optional ByVal p8 As Double = 0.1)
    'Code that does stuff
End Sub
Is there any taboo with that? ^
 
yup ... that's too many. ..
some of these are most probably related or the scope of your Sub is ill-defined
if they are related: pack them together into a custom object,
the solution for the other one should be obvious :)
 
I'm trying to rewrite it but can't seem to make it pretty.
It was Dim and Seting all the values but I'm trying to de-couple it to make it more generic.
 
what exactly are you doing in that sub?
and where is it called from?
 
It's called 2 different ways. One via a calling sub that's accessed by one button, part of a sequence of calls, and another is by a button than only does the Sub itself.
 
6:41 PM
It sets a default value for a cell. then Increments that cell until it p2<>p3 and p4<>p5
 
soo ... you're doing two different things??
and you're using Ranges as variables?
why are you passing the expected values as Strings, btw?
 
The ranges are variables because they have formulas in them. The p3,p5 strings are the values the p2,p4 cells need to become (respectively) as they iterate through.
 
I can effectively remove the 2 string parameters but kept them as it's presently being used.
 
why do you have three optional parameters then, when they aren't used?
 
6:45 PM
That would just make any sheet that uses this Class.method tied to those values.
They optional are used for an initial value and then the step values.
 
rule of thumb: if you can remove a parameter... DO IT!
 
@Mat'sMug And use Remove Parameters to do it!
 
@IvenBach why isn't there an initialValue and a stepValue parameter then?
 
6:46 PM
@Mat'sMug even if it means making everything that may use it require the same values?
 
YAGNI
 
^
You Ain't Gonna Need It
 
If you don't need it now then it's not needed
 
Ok
 
soo ... leave it out :)
 
6:47 PM
Make it a Const as part of the Sub?
 
I used to do that myself a lot and my code got significantly better when I stopped overthinking it :)
 
that seems reasonable
 
Ok.
I tend to overthink things...
 
If more than 3-4 params are needed, it may be time to refactor?
 
usually yes...
 
1. doing things wrong, the wrong way
2. doing things right, the wrong way
3. doing things right, the right way
 
many even say that more than two are suspicious.
it's easier to reason about methods with less parameters
 
so ... the best is no params, then comes one, then two and three should get you thinking
 
6:51 PM
more parameters usually implies more execution paths, which means higher cyclomatic complexity, which means code doing too many things
 
same applies for ctors, ususally with the notable exception of dumb immutable data holders
not that VBA had ctors
 
It was originally parameterless, but that tied it always to 1 sheet and I already know it has to accept other sheets soon.
 
so give it a Worksheet parameter :)
 
@Mat'sMug I'm just shoving labels onto unlabelled stuff right now ... some issues are extremely long and confusing :/
 
6:53 PM
Then it'd tie the cells to be in the exact same location, and that caused problems previously... People shifted cells around...
 
@Vogel612 thanks for that!
@Vogel612 did you notice you can now assign issues to a project's "triage queue" from the issue itself?
 
Thanks again for the nuggets of knowledge. My code is improving, slow and steady.
 
I think this might have something to do with the feature request I did :)
 
yup, I really like that
it's a tad annoying that it needs to go through triage first and status changes don't automatically carry over, but eh ...
it's not JIRA and it doesn't need to be :)
 
> Can this be reproduced in the current release(s)?
> IMO the inspection meta sufficiently explains this... closing for now. Specific wording improvements of the meta are welcome 👍
 
7:04 PM
Does RD place a constraint on Public for unit tests? They can be private without any problems, right?
 
they have to be callable by Application.Run, so they need to be Public
 
Ok.
 
but RD specifies Option Private Module when creating a test module, so RD tests aren't exposed as macros
 
And they can't take ByRef parameters for the same reason. :rolleyes:
 
lol
 
7:13 PM
This has nothing to do with using Variant data types. The OP's literals will both be promoted to Double, as will the result of a / b prior to being passed to Int. You're actually doing a narrowing cast when you assign to Single, and the only reason it works is because you're lowering the precision of the calculation. — Comintern 7 secs ago
People don't get floating point numbers.
 
among many other things...
@JohnnyForbes the point is that between maintaining a 338-character regex and a String.split call, I pick the String.split eyes closed. Always write code as if the next person to take it over was a psycho axe-murderer that knows where you live. — Mat's Mug 1 min ago
^ @IvenBach another nugget right here
 
7:39 PM
@Mat'sMug I am that person that's taking over the code though...
The problem is I don't know where the person lives.
 
LOL
 
I'm trying to wrap my head around stuff that has 0 (zero) documentation and nobody really knows what it's doing.
I now understand why it's better to have it be maintainable & readable & slow. Then optimize it and keep it neat & tidy. Rather than it's FUGLY like mah sistuh but run's like none othur.
 
7:58 PM
@Mat'sMug I prefer a 2x4.
 
8:23 PM
The perfect place to post that kind of question, stackoverflow.com/questions/43008361/….
 
We'd love to help. What's the question? Please read Minimal, Complete, and Verifiable example and edit your question accordingly. — Mat's Mug 59 secs ago
 
Welcome to SO. As it stands, this question really isn't answerable in a question and answer format. I'd take a look at how to ask, and then edit your question to include (at very least) a specific problem, attempts you made to code against the problem, and a description of your data (if relevant). — Comintern 1 min ago
Do I really type that slow, or are my updates lagging today?
 
8:45 PM
[Hosch250/Rubberduck] Hosch250 pushed commit bb61120a to RemoveParamsRewriter: Reinstate the variable/const rewriter info finders
[Hosch250/Rubberduck] Hosch250 pushed commit df6123b5 to RemoveParamsRewriter: Fix ChangeProcedureToFunctionQuickFix
[Hosch250/Rubberduck] Hosch250 pushed commit 80749e78 to RemoveParamsRewriter: Fix Reorder Parameters
> Also clean up the argument list definition in the grammar and fix a few places that relied on the old syntax tree. Also tweak the ModuleRewriter.
[rubberduck-vba/Rubberduck] build for commit 80749e78 on unknown branch: AppVeyor build succeeded
 
I really need to git 50 rep on SO to add comments.
 
Don't merge that yet.
I just remembered that a few Debug.Assert's are failing in the live build.
Hopefully nothing serious.
 
9:00 PM
@Hosch250 Famous last words?
 
OK, it isn't happening anymore.
 
TTQW
 
Don't know what was up before.
 
@IvenBach :D
 
[rubberduck-vba/Rubberduck] build for commit cf6921a5 on unknown branch: AppVeyor build succeeded
 
9:04 PM
@IvenBach No, famous first words.
Everything seems to work. Consider it merge-ready.
I guess I'll have to tackle reorder soon.
I'll leave the inspection quick fixes until Mat gets the inspections refactoring done and I get started on the quick fix refactoring.
I'll move the quick fixes over to C# 6 at the same time.
@Mat'sMug You should move the inspections over while you are doing the big rewrite too.
Nothing quite like killing two birds with one stone.
 
@Hosch250 the actual inspection implementations... you know, at this point it wouldn't even be hard to put them into their own assembly - and get ninject to inspect the whole install directory for other assemblies that might contain IInspection implementations...
 
@Mat'sMug Might as well get started on the plug-in architecture.
 
9:52 PM
On Error GoTo 0 'Avoid using <---- WTF?
 
I'd already rejected it I think.
 
I think the edit was to existing content
i.e. the avoid using was already live
 
That example is kind of f%cked up to begin with. It doesn't do anything. 2 error handlers? Exit Sub all over the place?
 
10:09 PM
'Sup chat? No loading of Documentation comments?
> You can't throw both errors - there can be only one active handler at any given time. The example is contrived to begin with - if you have a procedure that requires multiple error handlers, you need to refactor. In a topic about "Best Practices", the example is already a fail. Resuming to an Exit Sub instruction is just silly, and Resume is unstructure flow control. If "unpredictable flow of control" is to be avoided, Resume makes it worse.
– Comintern 34 secs ago
 
10:23 PM
Gosh... looks like we need to step in and edit that whole topic...
 
I presume @Comintern is already on it?
lol
 
Not yet, it's kind of a cesspit right now though.
 
10:36 PM
error handling best practice in the tag should point users to the error handling topic in the tag, and maybe have some small section that is specific to error handling in Excel, like using CVErr and handling ODBCErrors.
 
^^
I do have a fairly strong urge not to care any more. I've pretty much switched to anti-vandalism mode as far as Documentation is concerned.
 
IKR? My last experience with massive edits toggled me into the same mode
 
Christ.
> It was never "broken" to begin with. This is how cargo cult programming begins - some unsubstantiated anecdotal description of "this happened to me once, so it's always a good idea", and then people assume that because they saw it online that it must be true. TBH, the example should probably just be deleted - the VBA tag's documentation is much clearer and more accurate.
– Comintern just now
 
10:53 PM
Down to two broken Reorder tests--optional param ones.
 
And that finishes the refactorings.
Except Extract Interface, I guess.
@Mat'sMug Extract Interface doesn't use the rewriter because we are creating a module.
Is that OK, or what should we do here?
 
[rubberduck-vba/Rubberduck] build for commit d16f5db5 on unknown branch: AppVeyor build succeeded
> This doesn't seem to be much of an issue anymore. The inspections select the right range, and the refactorings, which now use the rewriter as of #2928, all work.
 
11:09 PM
@Hosch250 we don't need to parse an empty module just to add tokens do we? Just come up with a string and create a module with it
 
@Mat'sMug That's what I do.
 
Cool
 
That one still needs a double-parse, though, because it calls Implement Interface immediately afterward, which needs the new declarations.
This rewriter stuff is awesome.
2
So, what next?
Reworking the IsBuiltIn?
 
@Hosch250 why would it need the new declarations?
 
Well, simply because that's how I wrote it?
If you just want me to add the new content to the existing modules now, that's fine by me.
That's how I wanted to do it in the first place, but you said to reused Implement Interface.
 
11:24 PM
Gah, whatever.. idea being to avoid duplicating the functionality
but let's avoid reparsing whenever possible
 
11:35 PM
 
@Hosch250 glad you like it! How would you go about increasing the abstraction level, to make a nice rewriter API that's easy to use for new fixes and refactorings?
Or is the abstraction level good enough as it is?
 
@Mat'sMug any chance to perhaps explain how much technical debt this assumption may be if true when mentioned "let's avoid reparsing whenever possible"
 
@PeterMTaylor oh, the next release will pretty much eliminate all extraneous parses =)
 
11:41 PM
👍🏻
 
^^ two white squares with an X
@ThunderFrame wait so they're there and fire and can be handled??
 
oops - wait, formats got fubared
 
> Joel Spolsky liked your tweet
@spolsky @selectall also ignores the devs that can't be bothered to formulate a proper answerable question and blame the "mean" community 😒
 
but Image does have 2 hidden events: Click and DblClick
the image above is just the IControl events extended to each built-in/custom control
the VBE doesn't show the Image.Click or Image.DblClick events in the codepane dropdowns, unless and until you enter the signature yourself.
the events do fire
 
What's the default handler when you dblclick an image control in the designer?
 
11:50 PM
Image1_BeforeDragOver <----- WTF?
^ that's the default!?
 
How the hell does the VBE pick an event...
First in alphabetical order???
No, that would be AfterXxxxx
<~ puzzled
 
Click if it's available, otherwise first alphabetical?
 
There's no AfterXxxx to pick from?
 
not for Image
 
How about textboxes then
 
11:55 PM
Change
 
Makes me wonder if there's a concept of "default event" somewhere
 
hmm, maybe there is some logic around the most likely useful event.
seems Image doesn't have any "most likely useful" events
 
IKR
BTW:
> Total Downloads 10,510
> Rubberduck.Setup.2.0.13.0.exe (5.83 MiB) - Downloaded 346 times.
Last updated on 2017-03-12
 
@Mat'sMug There's definitely some special handling of MSForms controls with regard to which members are extended/available
prepares information overload
 
Wah!
 
11:58 PM
@Mat'sMug Wouldn't default events just be the member of the source interface with a DISPID of 0?
 
@ThunderFrame this needs to go in the wiki's research section =)
@Comintern that's what I was thinking, but can't prove it ATM
 
@Mat'sMug yep - I'll tidy up the XLSX and upload it
 
00:00 - 17:0017:00 - 00:00

« first day (1022 days earlier)      last day (2158 days later) »