Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Rob Reed
    @robreed_twitter

    I deleted the earlier post and am replacing it with this one. It's essentially the same I just corrected a few swapped words that made it more confusing than it needs to be.

    So let's deal with the easiest stuff first.

    A function is a code block that can be invoked as a single unit either immediately or very often called later from outside of the function. It's a mechanism by which we can define a sequence of statements and associated data and then use and reuse that sequence.

    A method is just a function that is part of an object. So a function is a function that is not part of any object.

    Also a variable outside of an object is a variable and inside an object is referred to as a property.

    Same things, different contexts.

    Objects are nothing more than a collection of properties and methods. In fact it's even simpler than that. Objects are collections of key/value pairs called properties. Some of those properties are functions, and when they are, they're referred to as methods.

    How do functions differ from objects?

    Well I've already given a bit of the answer. A function is a single executable or callable block of code whereas an object is a collection of properties including potentially multiple methods (functions attached to objects).

    Now here's where it is as simple or confusing as you want to make it.

    Everything in Javascript is an object.

    Even what would appear to be basic datatypes are objects - numbers, strings, booleans – all objects. And yes functions are objects.

    To convince yourself you could create a function using a constructor like:

    var exFunction = new Function ([param1, param2, …, paramN,] CODE GOES HERE)

    (So somewhere there is a Function prototype and when we create a new Function we are creating an instance of the class based on that prototype.)

    Now you will never see this done or virtually never for technical reasons that are unimportant to this discussion. The point is that functions are objects because everything in Javascript is implemented as an object. You can think of functions as objects if it's helpful or you can just think of them as functions. As I said you will probably never want to create a function using the Function constructor.

    Should you be using objects or using functions? It depends on what it is that you're trying to model. If just a basic sequence of steps then you can just deal with functions. If it's something that can be considered a single thing composed of a bunch of parts then an object is a better way to think of it. You could think of a microwave oven as just a series of functions but there are also properties too, right? It makes sense to represent a microwave oven as an object, not a loose collection of functions.

    Now as for Perl, whereas Javascript is inherently object oriented, Perl is not (at least not Perl 5.x). But people do use it for object oriented programming either by adhering to established conventions that mimic objects or using an object framework. (There's more than one.)

    Sadly, this is the reason I'd hesitate to use Perl as a language to teach people to program formally. Although having said that, it's great to use for the same reason, and the argument could be made I think that avoiding objects at first is a good way to focus on other issues related to thinking like a programmer - execution flow, logic etc.

    Anyway, unless you specifically tack on an object layer there is no talk of methods and properties in Perl but there are a lot of functions.

    Back to JavaScript…

    It does seem like there is a lot of function related trickery going on in Javascript. One of the places they frequently pop up is what is referred to as an "IIFE" or Immediately-Invoked Function Expression.

    This can involve actually using the function as part of a larger expression (such as when assigning it to a variable OR wrapping a function in a pair of parenthesis so that the interpreter doesn't see it and treat it as a function declaration but instead a function expression.

    Continued next…

    Javascript (unlike Perl) has function scope but not block scope. By using function expressions we can protect the data inside the function from being accessed outside accidentally and so avoid naming collisions and other confusion. We can also maintain a semblance of data privacy.

    This is not not a little tricky. :) We can keep discussing it. I consider everything to be a continuing conversation. It will definitely be handy for you to understand this stuff. Looking it up quickly I found this readable write up https://javascriptweblog.wordpress.com/2010/07/06/function-declarations-vs-function-expressions/.

    I also found this slightly less readable write up that people seem to like: http://benalman.com/news/2010/11/immediately-invoked-function-expression/

    I didn't immediately see anything egregiously wrong with either one of them.

    I hope this helps!

    Steven Rosenberg
    @passthejoe
    So the data is inside the function, but the output of that function is available to other parts of the program?
    Steven Rosenberg
    @passthejoe
    I am looking at how this is done in actual code. One of the things that is baffling for my procedurally oriented mind is seeing functions that depend on code written below them.
    Rob Reed
    @robreed_twitter
    I'll use some examples when I have a min.
    Rob Reed
    @robreed_twitter
    Actually this is seeming like an article to me. So maybe I'll think about writing one but I'll answer you're questions first.
    It strikes me that 2 things that new developers and designers using JS would get a lot of mileage out of is simply: adding and removing classes with pure JS. (I already have these functions built into the new version of the new theme) and understanding: functions, anonymous functions, iife, and the differences between function declarations, function expressions, function statements, and calling a function.
    Don't get me wrong, there are articles like that already but none that are as clear as I'd want them to be if I were learning.
    Steven Rosenberg
    @passthejoe
    @robreed_twitter Sounds very good to me.
    Steven Rosenberg
    @passthejoe
    There's been a lot of expansion since the last time I checked in with https://gitter.im/ode-community
    Rob Reed
    @robreed_twitter
    I'm just wanted to put a few of the more obvious pieces in place.
    Steven Rosenberg
    @passthejoe
    Hadn't been to Gitter in so long that I forgot the name for it.
    Rob Reed
    @robreed_twitter
    Yeah, I know what you mean. I've tried using this for a few different things and I'm not giving up on it but it's not the easiest thing to use. I find I'm a little reluctant about it.
    I think they've done a good job with Slack. I enjoy using that. But like many platforms today I don't like how they're positioning and selling it. Though the change from teams to workspaces is a step in the right direction for them.
    Steven Rosenberg
    @passthejoe
    My company is a heavy user of Slack, but we don't pay, so we lose the history basically every day. Plus with enough people, Slack is very noisy, just like email.
    Rob Reed
    @robreed_twitter

    I don't think there can ever be just 1 tool, which is a good thing. Try to go that route and you end up with Facebook or Amazon. I'm much more in favor of the small single purpose tools used in endless combinations strategy, as I'm sure you are. Integration becomes a problem, but I think integration is overrated, and may be a red herring.

    The right tool for me is a combination of email, and some kind of group IM, and an individual IM which might be the same as the group tool, and a forum, and personal blog, and group blog, (both with comments), and some kind of aggregator, and some form of document collaboration, and version control/version history like git, and… well that's a start.

    I like Slack because it behaves the way I except it too most of the time. I like the implementation. Git on the other hand, it wants to post every time I hit return. I really don't like the way they position Slack. Although I guess people are using it more and more as a public space, but I'm not sure I understand how that works.

    Steven Rosenberg
    @passthejoe
    I haven't joined any public Slacks yet, but I wonder why a Discourse forum isn't better for most things.
    Rob Reed
    @robreed_twitter
    I just think we should stop looking for single tools that work for every group and every kind of communication and start thinking in terms of valuing tools that work well together. IM is good. Email is good. Forums (especially Discourse) are good. But they're not all good for everything.
    Rob Reed
    @robreed_twitter
    New idea for Ode: Markup (standards compatible) to select a portion of a post that would be appropriate for a tweet. Also a special theme on the site that will present just that portion of each post along with a link to another theme (like the default theme) where the entire post is visible. So it's like a Twitter style UI for a site. What do you think?
    By the way do you see the other "conversations for Ode" - feature-requests etc? I'm afriad to use anything but the /Lobby because I'm afraid it's not visible.
    Steven Rosenberg
    @passthejoe
    Rob, I haven't been on here in a long time -- I looked at your site and don't see links where users can download Ode. I'm also wondering if you have the new theme packaged in there yet.
    Steven Rosenberg
    @passthejoe
    I just went to our Twitter DMs and found the version you sent me in February -- thanks. I'm getting ready to make my social-post site a separate one from my "traditional" site, and I wanted to use the new theme for one or both.
    Steven Rosenberg
    @passthejoe
    I thought I had ZIP copies of the Ode software and add-ins, but I can't find them.
    Rob Reed
    @robreed_twitter

    Sounds good and a lot of work, good job.

    "but individual users would need to "register" their apps with the Twitter API."

    I hate that. (I'm using the word hate here.) That is the point at which the open web started to die. That really made me upset and I'm still very sour about it. Anyway…

    I have my usual big (small) plans for Ode. I really want it to be a bulletproof local/remote writing and publishing solution and I want to use it to get a more diverse group of voices on the web. I've heard enough from the same people, especially in tech and web design and development. My attitude at this point is basically fuck them. We've been right about a lot of things over the years while they've gone with the flow. The flow sucks.

    Anyway, I like this path you're on.

    Steven Rosenberg
    @passthejoe
    Re the Twitter API, registering your app (or in my case my instance of my app) is a pain point, to be sure. A better idea is leveraging the Twitter authentication system to let the app post. I arrived where I did due to Ruby's Twitter gem. CPAN's Net::Twitter works the same way: https://metacpan.org/pod/Net::Twitter
    Steven Rosenberg
    @passthejoe
    The Twitter API can do a lot of things, and I'm only doing one of them (posting updates). It's likely possible to post to Facebook and other social sites in a similar manner, but my emphasis is on creating and posting that kind of update to my own sites. The Twitter posting code is really a bolt-on -- it's optional all the way through. What prompted me to include it was dlvr.it limiting the number of updates on free accounts to 10 per day. I moved my "automatic" posts from the blog to IFTTT.com and now get the Ruby script to do the social updates. I wasn't excited about paying $99.50 a year for "unlimited" dlvr.it posting from the blog to Twitter.
    Dlvr.it allows you to exclude a directory from posting to Twitter. In IFTTT, I had to code that in JavaScript. With separate Ode sites for social and not-social, I won't have that issue.
    Rob Reed
    @robreed_twitter
    Yeah I've played around with Net::Twitter. It's fine. I had a nice Twitter posting addin. It matained a loose connection to the Tweet by storing all of the meta-data for the tweet and allowed the user to delete the tweet and stuff like that after the fact. You could pick the part of the post you wanted to tweet. Lots of stuff like that. I'd have to dig it up.
    I think going directly with the service's API is way better than something like dlvr.it or IFTTT anyway. The fewer dependencies the better. I love the idea of having your own site and pushing content to social networks. Thats exactly how it should work. We should have independent websites and aggregators. Full stop.
    Steven Rosenberg
    @passthejoe
    That would be great as an add-in. My idea was to do all post creation outside of Ode and have the app be a blogging client
    Rob Reed
    @robreed_twitter
    I see a lot of potential in the Ode way of doing things as far as a CMS is concerned. I think you know I've started doing some teaching - I'm up to 3 classes and a weekly meetup. It's too much honestly especially considering I get paid for none of it. But it's giving me a lot of opportunity to think about stuff as has everything that's happening and not happening with social media these days. I have a good read on the situation I think. (After something like 15 years why not, right?) It doesn't mean what I think is right will "win". In fact I'm pretty sure the righter something is the less of a chance it has at "winning" (which is why I don't think we can make everything a competition).
    Steven Rosenberg
    @passthejoe
    I started hacking away at the old theme -- literally hacking, as in removing bits. More of that to come. Here is the site with content: http://updates.stevenrosenberg.net/cgi-bin/ode.cgi
    Rob Reed
    @robreed_twitter
    The old theme is rough.
    You've really got to care about everything or it starts out ehhh and later it's like ugghhh.
    Ha.
    Steven Rosenberg
    @passthejoe
    I forgot to turn on Markdown, I think. I'll get to that later. The new theme is so huge, I will tackle that one later.
    Rob Reed
    @robreed_twitter
    Huge meaning filesize?
    Page weight I mean?
    I still want to make my own version of markdown. I don't like all of the crap surrounding Markdown and the different dialects. I just want a simple lightweight markup format. I'm calling it unmarkup. I've probably told you that already.
    Steven Rosenberg
    @passthejoe
    Re the new theme -- I mean it's a lot of files, and there are a lot of areas/sections on the page, and I will want to make it more simple.
    Rob Reed
    @robreed_twitter
    Gotcha. As soon as you say that I want to go make it simpler. Ha. No time at the moment but as soon as I hear that anyone is doing something with Ode, that suddenly all I want to do.
    Steven Rosenberg
    @passthejoe
    Rob, while I was looking for .htaccess hacks, I found some things on caching. Would this work for Ode due to its dynamic nature? https://www.askapache.com/htaccess/speed-up-sites-with-htaccess-caching/
    Rob Reed
    @robreed_twitter
    I'll have to read that thing carefully. It's pretty confusing the way it's written. Also, I think I'll have to play around with it. Most if not all of them may work for Ode depending on how clients handle expiry dates. Ode is dynamic but doesn't use query strings mostly, so if it reads an address as a page then I don't see why it wouldn't work. But one of the suggestions is to generate static pages and that's what I want to do anyway. That will work with all caching methods AND even when the cache expires visitors will hit the static pages not the script anyway. The performance for a busy site should be just about on par with a purely static site with none of the drawbacks.
    Steven Rosenberg
    @passthejoe
    Sounds great.
    Rob Reed
    @robreed_twitter

    Hey Steven, I'm thinking of renaming Ode, "Ebeling". Any thoughts about that? It's because of this guy Robert Ebling. https://www.npr.org/sections/thetwo-way/2016/01/28/464744781/30-years-after-disaster-challenger-engineer-still-blames-himself

    He kind of epitomizes how I feel about technology – Going along with what everyone is doing because everyone else seems to be OK with it is in no way OK.

    I also like that the name is easier to pronounce and kind of sounds like an open source project.

    I'm just looking for a little feedback.

    jgbrwn
    @jgbrwn
    Hello, I remember looking at Ode many years ago, and stumbled back upon ode.io, but looks like it's not available to download currently?