« first day (2009 days earlier)      last day (1171 days later) » 
00:00 - 18:0018:00 - 00:00

12:01 AM
RELOAD!
[Phrancis/AdventOfCode2019] 3 commits. 55 additions. 111 deletions.
[Zomis/AdventOfCode] 5 commits. 407 additions. 31 deletions.
[Minesweeper] Games Played: 92, Bombs Used: 58, Moves Performed: 12299, New Users: 14
 
 
2 hours later…
1:41 AM
I'm just wondering - given that Shell32 is a POS API, and there are time where you need to use Object in place of the explicit objects because late-bound calls will work where early-bound calls won't. Thus, I have two variables; FolderView As Shell32.ShellFolderView and FolderViewObject As Object. The question is - would you have preferred something like FolderViewLateBound over FolderViewObject?
 
 
1 hour later…
2:59 AM
Evidently Microsoft has decided there's not enough WTFs:
 
 
2 hours later…
5:11 AM
> Microsoft: Urge to create WTFs/min rising.
 
5:42 AM
Expert beginner being promoted to leadership can lead to unqualified leadership.
> never consider your education complete or your opinion above questioning regardless of your title, your years of experience, your awards and accomplishments, or anything else that isn’t rational argumentation or evidence. Retaining a healthy degree of humility, constantly striving for improvement, and valuing objective metrics above subjective considerations ...
^ I get that vibe from all the contributors here.
 
0
Q: VBA More effective way of data trimming

lalalisaMy code consists of split, Mid,Left,Right and replace functions which is used to trim my data into a more neat manner, however it's too long and inefficient, it takes too much time to go through all this because i have up to thousand of files that will go through this. Can anyone advice me on ho...

 
 
3 hours later…
8:25 AM
Night pond.
 
 
3 hours later…
11:44 AM
0
Q: Chess Game: Part 1- Creating the Layout

TinManAfter working on the project for 15 hours of I had my layout set 1 row and 1 column per square, no problem. Then I decided that I needed each square to have multiple rows. I would have never guessed that it would take almost 6 hours to work this out. The Reason That I Changed the Layout I h...

 
12:13 PM
 
1:32 PM
Hey @MathieuGuindon, I've been looking at your battleship VBA game. It's quite something! I'm trying to use some of the techniques in a development I'm doing at the mo but I'm a little bit stumped on how to do something. Say you wanted to be able to create a new IPlayer based on an IPlayer you'd already created, but with a few small differences. How would you go about that?
 
Create a new interface implementation :)
 
What do you mean? (sorry)
 
@CallumDA I actually went pretty lazy with IPlayer.. there should be an IPlayerFactory injected into the class that's creating the players ..the coupling is hurting testability there. So yeah, there'd be an IPlayerFactory interface exposing whatever methods are needed to create any IPlayer.
The pattern is abstract factory
Currently the logic for that factory is basically to create a HumanPlayer unless an argument is supplied for the difficulty/strategy, in which case an AIPlayer is returned
AI players are all the same, they only differ by which strategy they Play with
 
@IvenBach will read mat's blog this morning at work after i get a couple tasks done then start figuring out breakpoints. thanks for the hotkey! i really, really hate using a mouse
 
I think I understand, thanks :)
 
1:43 PM
=)
 
@CallumDA Sorry, was elsewhere for a bit. Looks like Mat got you?
I was thinking just the exact implementation of the class, not providing it to callers too, etc.
 
@Hosch250 the hard part is that you cannot extend an interface
/inherit
So you can't have an IFooPlayer : IPlayer
 
Yeah thanks Hosch -- honestly really appreciate your help guys. I'm conscious I only come here with questions so feel free to tell me to take my questions elsewhere!
 
Nah, we all come with questions :)
 
@CallumDA huh, no problem at all! come here anytime with any questions!
 
1:47 PM
:D
 
One thing I need to de-tangle, is the "who's turn is it" logic. The way I have it now makes it very hard to introduce e.g. "salvo mode", where you'd pick more than just 1 grid location at once.
@CallumDA not sure what version is on GitHub, ...make sure the GameSheet doesn't have frozen panes (set the ScrollArea instead), the frozen panes are causing high CPU usage for some reason. Excel bug.
 
Ah yes, I do have the version with frozen panes
So my actual model is with discount curves, I have a Curves class with a Create function, and and ICurve interface. The curves class receives a discount curve, from which it calculates thing like forward curve, spot curve, etc.. just simple maths. ICurve exposes each of these curves. I now want to be able to create a new ICurve based on and existing one but with a simple addition to one of the curves and hence recalculation of the other curves. Will a curve factory achieve this?
 
2:18 PM
I think I've worked it out. Might be one for you guys to tear apart on CR !
 
@MathieuGuindon i've got like 30 more things to look at after the first 2 sections of this Userform1.Show blog, with 90% of the blog page length to get through...
almost all realted to terminology
 
2:34 PM
just finished the article and my only real take away is that i have no idea wtf i'm doing
i actually feel more discouraged having read that ='/
found someone in the comments with the same issue... now to read your post about "vba oop factory"
 
2:46 PM
@CallumDA I'd probably just have a factory method (a function) to return an ICurve, taking an ICurve parameter to copy the data from
@Cyril sorry to hear... would love a summary of what terms you're struggling with - I'd edit some definitions in (or make a new article with them)
 
Pretty much every technical term in the blog. That has historically been my issue. "Workbooks().Sheets().Cells().Value="Blah"" to me has an object Workbooks().Sheets().Cells() whose property, .Value, is being manipulated to read "Blah". That is my very gross understanding of what those words, when put together, do... now you as a person with training and expertise could go into a lengthy ordeal about each of those parts, which would probably be over my head.
 
@MathieuGuindon Boom! that's exactly what I came up with too!
 
i read "enum" and due to my background, it means enumeration which means a count (wrt microbial enumeration where you count the number of yeast/mold colonies); i can only assume that's what it means, but with a technical document, I still need to go back and read up what that term means to ensure im' following the intent
i appreciate the breakdown for what a default instance is, though i've never seen "VB_PredeclaredId" in my life, nor have i seen anyone try to set userform=nothing, so that is kind of over my head, or at least something i take at face value because i wouldn't have thought that appropriate in the first place
 
Enums do have numbers hidden away in them
 
Being lost isn't uncommon, but in trying to understand what was read and getting to this line:
*But please, please don’t Show the default instance.*
That's what really made me stop and be like... how bad at this am i? I feel like I use the default instance at all times. That's the window that pops up when i add a UserForm to VBA, yes? I typically add controls to that default isntance, rename it with F4, and then program each control.
 
3:01 PM
They are a nice way of naming your numbers, if you like
 
i feel like i didn't get the real takeaway points from the article
@MathieuGuindon most of the terms have microsoft pages; just have to look each up and chase the rabbit hole for understanding the components of what is on that specific page
@CallumDA In trying to read docs.microsoft.com/en-us/office/vba/language/reference/… I believe that Enum in this case is a fancy name for a collection of related variables that represent the status of a property? at the top of the article, it states "can accept positive or negative numbers" but then the example isn't about numbers, so the initial statement leaves me confused.
 
it's a set of related named constants with a numeric value
 
It's better to see it used to understand how it works, I'll whip together a quick example
 
Public Enum DialogResult
    Unknown = 0
    Ok = 1
    Cancel = 2
End Enum
 
@MathieuGuindon I guess i'm getting lost in the example on the microsoft page... "&HE1E4FF& " doesn't look like a number or having a numeric value, unless you consider a charcter in the string being a number
 
3:09 PM
&H makes it a hex literal
i.e. it's a Long :)
 
Type ?&HE1E4FF& into the immediate window
You get 14804223
 
copy; not very familiar with hexadecimal
 
@Cyril that's the designer. think of the form as a definition of what a UserForm1 is - exactly like any other class is a blueprint for an object of that class type: normally when you make a class and you want to use it, you need to create an instance of it. You do that with the New keyword.
Set foo = New Something
the Something class isn't an object, foo is
(actually foo is just a pointer to an object)
 
a declaration to quickly find an object, hence foo is "set" to represent an object... yes?
 
yes - from that point on you can access the object foo is referring to, presumably through its Something interface
 
3:14 PM
i really hope that's right, as that's almost verbatim what i told someone lol
 
what interface the object is accessible from depends on how foo is declared
 
so stepping back, the default instance =/= designer
 
e.g. if you do Dim foo As Object, every member call will be late-bound. If you do Dim foo As Something, you access all the members of Something. If the Something class implements some IWhatever interface, then you could do Dim foo As IWhatever, and you would then access the object through its IWhatever interface
@Cyril yes
key point being, you can't access an object if there's no instance of that object
 
@MathieuGuindon copy
 
the VB_PredeclaredId attribute messes with that
internally, VBA keeps an "id" for every object pointer in memory
a predeclared ID basically makes VBA pre-declare an "id" for an object
the identifier name associated with this automagic id, is the name of the class itself
 
3:19 PM
we're using the term "class" while typing, and in reading and talking about it, i always see class and type as interchangeable. "dim X as Y" where Y = class/type and X = descriptor variable. was about to google and start reading ot make sure i understand the term, but figure i can ask the expert my low level question ^_^
 
so if your form class is named UserForm1, you get a free, global-scope UserForm1 object variable - and that variable is the default instance.
@Cyril indeed - a class is a type
"type" essentially refers to anything you can put after the As keyword in a declaration
 
@MathieuGuindon So when I change the "(Name)" in my userform properties, i'm redefining the name of that memory allocation, but that space is taken regardless of the name
 
if i change the name, it's still the default instance?
 
3:22 PM
I usually consider "type" more broad than class. You have Integer, Long, Date -- those are data types, but they don't represent a class. Some may refer to those as "primitive data type".. Worksheet, Recordset, and so forth are object types; they represent a object, but a Worksheet variable is not the same kind as Recordset variable. They all have a class behind it that describe how the object should be shaped -- what methods, properties, etc. it should have.
 
2 mins ago, by Mathieu Guindon
"type" essentially refers to anything you can put after the As keyword in a declaration
@Cyril so whenever you work with this "free" object variable automatically named after the class/form module, you are working with the default instance. My claim is that this instance needs to remain stateless if you're going to be writing object-oriented code :)
in other words, when you want to show an instance of a form, New it up and show that instance, not the default one
 
Did we define what "state" is?
 
@this going back to grade school elementary, Class Iff Type, but Type can refer to data or classes (not sure if other "types" exist beyond those two)
 
hm, I don't think so
 
May be good to explain what "state" means
 
3:25 PM
yeah
 
@CallumDA You've got a long way to go in the question asking department before you start to catch up with me or @IvenBach
 
@MathieuGuindon that last sentence really helped to put this all in perspective
 
so, in most all cases I use UF_Name.Show vbModeless, as I only want one instance to ever be open. I once used With New UF_Name // .Show vbModeless and it allowed the user to make infinite forms show up (we decorated their screen with the colors)
 
For @Cyril 's benefit: state is basically what a instance has in its various properties. For example, you could define a Private Something As String, expose it via properties on the class. You create two variables of same types. The first variable's Something would not be the same as the second variable's Something. It's much more broad but hpefully that gives the gist.
 
3:28 PM
also, a form's state includes whatever values its controls might be holding
 
@this I was understanding "State" as a boolean; are you saying that it has more facets?
it is either state visible or state invisible
 
it's basically the sum of all its privately held data
A stateless object means that it has no private data that is unique to this particular variable. As soon as you define a Private x As y, this class is now stateful
 
@Cyril you know when I do Private this As TSomething? A good alternative name for this could be state
 
ok... pardon my generalization, but i will generalize to hopefully move my head forward... "state" refers to every current aspect of an object; the number of aspects varies based on the type. the current state versus future state may be difference
 
3:31 PM
(keep in mind that module level variables aren't necessarily the only way to have state. A userform is stateful because it comes with a bunch of properties and some method that is tied to the particular instance.
If you've ever had the experience where you did UserForm1.Show then later had Set UF1 = New UserForm1, you may have found that they didn't have the same results (e.g. one might be visible, other is not visible --- that's all down to each having their own state).
 
@MathieuGuindon i believe i'm following, now, particularly with your next "yes" after my re-cap of understanding
 
Hence why Mat says that the default instance should not be treated as a stateful instance (but VBA will let you do it, that's the bad part)
 
so, a "stateless form instance" would be an instance of the form where you don't allow data to be held in private variables, or in properties of its controls
 
From another angle, the state of an object is like a game save. When you save your game, every detail of the game is written to disk so when you load it, the game is right back in the exact same state as when you saved it. If you have 2 game saves, you have 2 objects, each with their own state.
 
@FreeMan That's a good analogy!
 
3:34 PM
If you and your superspouse are both playing the same game and you're both using the default game save, one of you will be overwriting the others state and an argument will ensue.
You don't want your code arguing with itself.
therefore you each New up a new game save and neither of you uses the default state/save.
 
but when you do UserForm1.Show, you're showing the default instance to the user, and everything the user does with the controls (supply TextBox.Text, OptionButton.Value, etc.) is altering the state of the default instance.
and the problem with that state, is that it's essentially global
 
So taking thsi conversation and applying it to a sentence in Mat's blog:
"If the default instance is ever unloaded or set to Nothing, its internal state gets reset, and automatically reinitialized as soon as the default instance is invoked again."
The default instance, the designed form and it's pre-assigned memory, will be changed from state 0 (default) to state 1 (initialized) on load, which is why UF=Nothing makes no difference?
 
^ which means superspouse is writing over your game save and agriness will ensue
 
because anyone anywhere has access to the default instance of any form
@Cyril you know how you can declare an object variable As New Something?
that's basically what a predeclared ID does
Dim c As New Collection
Set c = Nothing
Debug.Print c Is Nothing '<~ false!
 
@this Yay! thanks Light bulbs go off when you're trying to explain something to someone else.
 
3:38 PM
see, when you use a default instance, the creation and destruction of that object is out of your hands and into VBA's
 
as i'm on my list of "stupid" questions, i previously understood a "new" object as redimming the object, e.g., it needs to fully-reinitialize when referenced the first time
 
I think that is a true statement.
 
so i can have infiniate "new" objects based on the default object; if i only want one object to exist, using "new" could be hurtful?
 
@Cyril you'd think so, but no
2 mins ago, by Mathieu Guindon
Dim c As New Collection
Set c = Nothing
Debug.Print c Is Nothing '<~ false!
 
But not that one --- As New X only applies when you've destroyed it then subsequently access it.
 
3:40 PM
after Set c = Nothing, c is effectively Nothing
 
^
at the line Set c = Nothing, it is destroyed. but you can never see that it's Nothing because the act of accessing the c itself, it auto renews itself.
 
^^
and an object with a Predeclared ID behaves the same way
 
You can do it "manually" with this code:
Public Function c As VBA.Collection
  Static x As VBA.Collection

  If x Is Nothing Then
    Set x = New VBA.Collection
  End If

  Set c = x
End Function
 
Set UF_Name = Nothing sets the (in this example) object with visible state to nothing, but because you used "UF_Name" which has default-allocated memory to it, you're just setting the object to hidden state?
 
That's exactly the same behvaior as Dim c As New VBA.Collection
 
3:43 PM
substitute Set SomeForm = Nothing with clicking the red "X" button
user clicks the "X" button, form instance is destroyed
 
@MathieuGuindon huh?
 
UserForm1.Show '<~ default instance shown (modal)
Debug.Print UserForm1.TextBox1.Text
^ if the user closed the form by clicking the "X" button, the instance was destroyed before the .Show member call returned
so even if you entered "hello" in TextBox1, Debug.Print outputs an empty string
and this is very bug-prone and surprising behavior, because if the object was destroyed and you're accessing it, you have all rights to expect error 91
 
@MathieuGuindon Example, Form is open and visible; there is no Cancel button to Me.Hide, only the "X" to set the window to Cancel=True. That's a good thing, right?
 
yep
that way when the form is closed, the instance is still "alive"
(assuming there's a way to close the form!)
note I haven't really touched on modeless forms yet -- handling those demands a serious paradigm shift
modal dialogs are simpler
 
Only by the virtue that you can only interact with one at a given moment.
 
3:51 PM
@MathieuGuindon in another post (not one of your blog posts), i was reading that "Me.Hide" or "Unload Me" have drawbacks, and if you want Excel to handle the memory with it's pre-programmed logic, have the only option to Exit be the "X" in the upper right. I feel like that's relevant here, but to your pre-amble, would not support OOP.
 
But, I think you can stack them up (e.g. open one modal form, which then opens another modal form. You can access both forms that way even though the 2nd form is eating up the focus)
 
I was reading your memory leak article the other day and wondering if I'd ever been writing code like without realising. What's the best way to check those things?
 
@Cyril that's basically embracing the self-destructing, global-scope nature of forms...
 
@this Really? Access as a user or access from the code?
 
@CallumDA That's about userforms.
The behavior of userforms and Access forms are opposite
By default, userform are modal. Access form are not unless you pass in acDialog
 
3:53 PM
I only said "access" because you did -- I'm still talking about Excel (which we all are, right?)
 
as a verb, not as a noun.
 
@MathieuGuindon I guess this is like Ben stopping to define "State"... what is Modal? Without building a form while we have the discussion, I feel like I'm not appropriately understanding. I don't think i've ever made a UF that wasn't "UF_Name.Show vbModeless" which I am under the impression is not Modal.
 
@CallumDA you know how when execution starts, form designers close? and when execution ends, the form designers reopen? if you have a memory leak, the designer won't reopen
 
@this accessing, not MSAccess'ing lol
 
(Access also has PopUp and Modal properties which complicates the picture, too but for direct comparison to UserForm, acDialog is most appropriate one to use for comparison with modal UserForm)
:-D
 
3:55 PM
@this yeah -- I was wondering if when you say "access" you are saying a user can be updating both at the same time, or if you are saying you can write code that still "accesses" the form without focus
I didn't realise users could update two modal forms at once
 
not as an user, no, but via code, yes.
 
@Cyril indeed that isn't a modal form. a modal form prevents the user from interacting with anything else on screen - until the form is closed
 
you could have a button on form 2 that modifies something on the form 1, even though the user can't interact with form 1 because form 2 has the focus.
 
but yes, a modal dialog can very well pop another modal dialog; then you need to close that dialog before you can access the previous one
 
Also, please note that I'm appreciative of you all taking the time to help break this down for my understanding. I hadn't realized how little I knew or understood prior to reading that blog post. @this @MathieuGuindon
 
3:56 PM
The modality aspect makes it much simpler to program against since you only need to worry about that one form but it's not going ot help you write good OOP coode.
 
IMO it's easier to write good OOP code with a modal dialog vs a modeless one
 
Woo, I passed my test!
3
 
@MathieuGuindon ok, so my takeaway for Modal is "sole focus"
 
Nice!
 
@Hosch250 Congratulations!
 
3:57 PM
914 points, and needed 700.
 
modeless makes everything asynchronous / event-driven, which is much harder to wrap one's head around I think
@Hosch250 congrats!
@Cyril exactly!
 
@MathieuGuindon So i learned on the hard one thus can't get my head to understand basics, haha
like knowing FDA regulations, so you're overcomplicating EPA productss
 
Funny, because in all books about Access programming, it's usually always "you should use so and so events - events make it much easier to do y, z"
 
@Hosch250 Jolly well done old bean What what....
 
and it's rare to have only one Access form in scope, to boot.
 
4:00 PM
@this sure but how many of these books explain anything whatsoever about events?
"hey look it's easy! pick one from the dropdown, done!"
 
Hmm. I need to look at that book again. I think at one point we discuss in general what order you can expect events to fire but caution it's not a hard and fast rule since it's asynchrnous in nature
grabs the 2010 APR
 
@MathieuGuindon i'm almost tempted to share one of my "simple" userforms just to have you pick it apart like a true code review... as i'm the person at this site with the most VBA experience, people come to me for that, which good or bad has an outcome which either simplifies procedures or compartmentalizes them
 
do it!
 
so back to the original intent. I think i understand what the default instance is, related to a modal format. that modal format is surprisingly key to my misunderstanding as i don't think i've ever designed one (i want the form to mvoe and be able to test while I design, so always vbModeless)
 
not sure I follow the reasoning
you want a modeless form when the user should be allowed to e.g. use Excel while the form is displayed
 
4:05 PM
@MathieuGuindon vbmodeless let's me interact with the workbooks
 
yes
i am saying that in every case where I have built a userform, interacting with the workbooks has been part of my intent, hence i have never designed a modal form
 
Answer --- 2013 APR doesn't. That's not a surprise when I thumb through the index because the focus was shifted to web app. However, 2007 APR does have a lenghty VBA chapter, including explanation of events, how it's async, order of firing, etc.
 
and i added (which didn't help the convo) that when i am testing I also interact with the workbooks
 
@this WithEvents?
 
4:08 PM
wow...
48
Q: Company changed everyone's titles to weird obscure names

QCV EditorI'm a QCV Editor. That doesn't stand for anything, it's just my initials. It's my new title at my company, sent out this week in an email about addressing the high turnover problem. Every software engineer here now has a unique acronym and term like "editor", "maintainer", "janitor", "operator", ...

 
yes in 2 places, according to the index for 2007 APR
 
@Hosch250 I don't think anyone here expected otherwise. Congrats!
 
Thanks :)
 
@this sad that it's 12 years old though :(
 
and for reference: 2007 APR
Yes.
I thought I had 2010 APR but I don't have it right here
it might be somewhere else. I think it's more sadder that 2007 is more useful than 2013.
 
4:11 PM
^
 
Understandably, the publisher wanted it to have new content, rather than rehashing same old, so 2013 had 2/3 of book on web apps. Oops Microsoft took it down! Ha ha! Dead trees, everybody!
 
@Cyril interesting... the vast, overwhelming majority of the time, when I make a userform it's for collecting some user inputs that I need before I can continue to do whatever it is that my code needs to do - hence, modal.
 
@FreeMan I was consulting for a company that did that when they were being liquidated. Depending on the company's long-term status (open or closed), the person's title may or may not be of relevance; the particular contact references are of more consequence.
 
I suppose modeless forms are useful when what the form is doing is closely related to whatever is happening on some worksheet
 
yeah, i've got weird intentions...
when i first ran into you, i had literally just started VBA to manipulate data I was exporting from inventory management systems to support my role in Quality. In the past few years I've worked in a more Sales focused role and they have so. many. spreadsheets. i started working wiht userforms in the latter realm, so users are typically working with 2+ workbooks, 2+ sheets in the same workbook, or 2+ tables on the same sheet. lots of set f = columns(1).find(val) going on...
 
4:18 PM
spins up a Windows XP VM --- feels old
 
i keep moving tangentially. back to re-reading the blog post again with new understanding.
unlike you folks with formal training, everything i read gets related to what i've tried, and when i don't have the experience, it leads to these questions which i don't usually put into this chat, but go down rabbit-holes in reading... then bring to SO when i can't resolve it with what i read, LOL
@MathieuGuindon i'm very much tempted to take you up on that... what format would you prefer?
 
@Cyril What are you talking about, formal training?
 
@Hosch250 schooling? having read a book on the topic and understood the book
 
I didn't learn programming from school :)
I don't think any of us did.
@Cyril OK, books are great.
 
just edited... literally thinking of you haha
 
4:24 PM
But, I didn't start reading books until I was already pretty good. The web has lots of good (and bad!) information.
 
i guess i kind of psych myself out. i went into reading a blog post thinking i was sufficient at what i do, then got laid on my ass. that's particularly why i don't search out books on the topic. i've been "reading" this intro to sql book for like 9 months and am only 4 pages in
 
Rome wasn't built in a day
 
i can put together simple scripts and generally get done what i need done... but fuck if i know the technical terms, and man do i get hung-up on language choices (even in speaking... really pisses off some coworkers)
 
@Cyril Embrace the feeling :)
 
I had to put together a tool with a load of modeless userforms to allow users to easily find and update data from a SQL database. There are some good answers on SO about MVC (pretty sure written by @MathieuGuindon) that helped me a lot.
 
4:31 PM
what would you suggest as a starting place? Not even sure if a general book would be good or jump into a specific language.
Someone once told me a great place to start is a book on Assembly, because if you're going to learn the basics, learn the basics... that left me a bit scarred.
 
Gets more complicated when you throw the user out to the worksheet but you still want the userforms to be waiting for you in the background
 
Pick a language. For you, I'd suggest VBA/Excel.
I started with C++. The book I used is really great, but I don't read it much anymore since I switched to C#.
Pick something you need/want to use and don't know very well.
Don't just learn something for the sake of learning, learn something that will actually help you.
 
TBH, I don't think what you learn in Assembly is very translatable.
 
^
I don't know assembly.
 
Heck, even if you're just doing C, a line of C could be actually several Assembly instructions
 
4:33 PM
I mean, I've used some variants of assembly in college. I can kind of read some of it.
 
@Hosch250 So if I'm targeting moving to a more standard C-managed language than VBA, would I still want to start with VBA/Excel to at least learn the terms?
 
Never actually written a program in it--not even Hello World.
 
and then add in the fact that the compiler will optimize the instructions so you could have some very different represenation of same logic in Assembly.
 
Have friends wanting me to learn PHP and C# as those are marketable powerhouses
 
Don't learn PHP.
C# is good. C++ isn't bad, but has a higher barrier to entry.
 
4:34 PM
@Cyril I'm all about hotkeys to increase productivity. myexcelmoments.wordpress.com/2018/09/14/vba-ide-hotkeys may be something you'll benefit from.
 
 
^ Knew that was coming.
 
^ That's what PHP is.
 
So, my process is: 1) start playing with the language. Write something (anything) in it.
Write a few things. Decide if you want to keep going.
 
@this I'm so not a double clawed hammer... I resent that comparison.
 
4:35 PM
1) smoke the manual. 2) write a fizzbuzz.
 
i currently do a bit in PHP with handling data from DBs... i like the simplicity of the associative array structure
 
Once you can read the main syntax, then look for something more complex; preferably an OSS project to at least read.
 
OSS?
 
#FunFact: Dropbox is horrid on Windows XP's last version of Chrome
@IvenBach LOL
 
@this use a VM for vista and it's better
 
4:37 PM
Keep writing things. Once you feel you could write anything and understand basically 100% of the articles and are looking up specific problems instead general tutorials, get a book on it. Manning is great; Apress has some really good ones too.
Not as much experience with Apress. Avoid O'Reilly unless you want to be a permanent 13yo.
 
@Cyril if I had a Vista....
 
At that point, you can also get a job in it.
Don't get a "learn X" book--go for the "X In Depth" type ones.
 
@Cyril Open Source Software, e.g. Rubberduck :)
 
the issue with "learn X" is that it's basically read-once book.
 
@this lol, was kind of poking fun... i've not had much success in loading anything web-based recently with XP; the joke was to use the next iteration of the OS, which is slightly funny as many people hated vista
 
4:39 PM
The first, oh, maybe 10-20% is the hardest--learning the language-specific syntax and all the paradigm-specific terms.
The rest is just experience.
 
The book that's more reference-ish usually get much better re-use, IME.
 
And going into niche details.
 
@Cyril I know. That's pretty much why I don't have a Vista VM. :-D
 
@this Exactly. And the "learn X" ones all have equivalents online, so don't waste your money.
 
googles ".pdf learn vba"
 
4:41 PM
VBA may or may not be a great one to start with, because a lot of tutorials don't teach modern development practices.
Mat's blog and Chip Pearson's blog are the best, so I've heard.
 
first thing i get is a workshop from columbia u (pdf of a presentation) and it covers high level things that i am familiar with and have used, not using any overtly technical terms... i think that's what got me into this entire conversation haha
 
FWIW, while Chip's great, his materials is not very OOP
Unfortunately, I think 95% of VBA materials are stuck in the old way of doing things
 
@this pardon my ignorance, but isn't VBA not truly OOP, despite many people trying to set it up to be? if that's the case, then maybe that data is right where it needs to be?
 
VBA doesn't support all aspects of OOP but it can be.
Besides, it's not really just OOP - you want SOLID, too
 
actually, as i type that, i am wondering how hurtful it would be to focus on newer practives if the majority of what is found will be obsolete... and how would i know it's obsolete?
 
4:46 PM
basically you want to write code that are: 1) easy to refactor, 2) easy to test, 3) easy to understand.
The traditional way of doing things does not really contribute to any 3 of those.
 
ok
 
e.g. in most Access books: "Use events to do your validation logic!", while OOP would be to decouple your validation logic from the presentation.
 
@IvenBach thanks for that link; was skimming and have already found a few ones i was not aware and will be used regularly
 
@Cyril Dim oRng As Range is a pretty strong sign ;-)
 
@MathieuGuindon i don't actually see what's wrong with that.
 
4:49 PM
It's using hungarian notation.
 
dim rng as range // set rng = .range(.cells(r,c),.cells(lr,lc)).value
 
@Cyril I feel like you're where I was at when I first discovered this pond. Please stick with it. It does get better.
 
plus disemvoweling
 
or should it read "disboweling"?
everyone tells you to use HN because that you'll know what it's.
.... until you encounter a Dim oRng As String
(believe me, I've seen that too many times....)
 
4:50 PM
and SheetName As Worksheet
and sh As String
 
dim sh_name as string, though? is that one at least okay?
 
barely but because of the underscores.
I hate underscores.
Why do you have to punish my pinkies like so?!?
 
if you want underscores in identifiers, write python
 
^
 
i know i use lots of underscores to keep that shit clean, though i have historically used just single letters when i get moving... i = long, z = string, r = long, c = long...
 
4:51 PM
camelCaseIsTheStandard
AndUsePascalCaseForMemberAndTypeNames
 
@MathieuGuindon that's a language i was told never to learn; re-hased quote "python isn't a fucking language; it's a fucking snake and never think otherwise"
 
haha
it's got its fanbase
 
he probably dropped the f work more times in that sentence... he's also one of two of my irl friend who program for a living
he is php primarily, other guy is primarily c#
 
Python is far better than PHP.
 
@Cyril blogs and sites where you see these, typically have a gigantic table of prefixes to use depending on whether the identifier is a variable, a constant, a parameter, a local variable, a function, a class, ....and then some add more encoding schemes for accessibility.. and somehow they all seem to hate vowels.
 
4:54 PM
IME, PHP guys are usually not good programmers.
 
@MathieuGuindon @this i've reread the article and it honestly makes so much more sense... thank you, both (article: rubberduckvba.wordpress.com/2017/10/25/userform1-show)
 
Not to say anything about your friend, but most of them don't follow best practices, or even understand why there are best practices.
 
They are like "if it works in prod, it's good."
 
I almost wish to read a PHP dev mock a VBA dev
it's the same general mindset
except PHP is more dangerous
 
4:56 PM
@this ok, i just googled HR and understand why that's shitty... didn't realize the "o" was supposed to represent "object". i guess if people kept it as standard that'd be useful, but that'd be a bitch to enforce
 
Did you read Joel's article?
 
^^^^^^^^^^^^^^
 
This should be a mandatory reading for those who are being seduced by the siren call of HN
 
@Hosch250 i hear you there; not sure if he's following industry best practices, but i do know that he is adamant when we're all coding together to use a particular set of best practices... though some of them feel wrong as they don't align with what i've read/seen lol. i helped develop the movement patterns for a game a few of us were developing, inherently JS, so used appropriate syntax and he flipped shit
 
@Cyril At least he's consistent.
 
4:59 PM
@this surprisingly, I have read that
that's the guy that only got for "F"s from Gates, right?
i remember reading a few things by him, and the one that is most memorable is the one about setting up Dates for VBA
@Hosch250 true... for better or worse haha
i almost never use capitalization anymore having worked with his company for a collaborative project... i still handle most of their VBA work, though (not that much of it, but still get a few bucks here and there)
 
Consider reading Clean Code.
Or, just hang around in here for 3 years or so, and you won't need to.
 
@MathieuGuindon now to read about class modules because i've never actually used one
 
I actually never got more than about 20 chapters in since it was all review. Mat learned me good.
 
@Hosch250 chip's book?
 
Bob Martin's.
Don't get the Clean Coder or the other Clean one. It's the Clean Code one.
 
5:04 PM
oh; i remember reading abotu it on chip's page, thought it was his book. my bad
 
Yep.
Although, pretty sure that version is pirated :)
Doesn't bother me.
 
@Hosch250 well then, i must say "ARRRRRRRRRRRRRRR"
scandinavia is really big on the kick for QOL>GDP and they're starting to support free book references. i wonder if this would be on their list of freebies. at least then we know one person bought the copy to share with their country... could "borrow" that
 
Nice.
 
reading some of these articles and book introductions, and thinking back to this pond... why does everyone use "foo"?
i thought it was a gimmick like "fubar", but i see it a lot of places
 
It's just that.
foo/bar and fizz/buzz are two commonly used gimmicks.
 
5:13 PM
i'd not seen fizzbuzz before mat used it earlier... i thought it meant to write a shitty article, like buzzfeed with having only fizzle. GTK
 
LOL
that's funny
 
@MathieuGuindon [1) smoke the manual. 2) write a fizzbuzz.] first time i've ever seen it used
re-reading Joel's article and got to the example about encoding and got a good chuckle as i attemtped to write a function to encode to just see what I could f up... that's how i learned about byte arrays and that has led to a couple very fun "tricks" to get crap done
 
115
Q: Down with FizzBuzz... LOL

Mathieu GuindonThis post is the result of reading through and following the LOLCODE Specification 1.2 ("smoking the manual", right?), and writing and executing my code on compileonline.com. My "hello world" was going to be a fizzbuzz. I like it because it nicely illustrates the basics of a language - variables...

 
00:00 - 18:0018:00 - 00:00

« first day (2009 days earlier)      last day (1171 days later) »