Showing posts with label languages. Show all posts
Showing posts with label languages. Show all posts

Mozilla is Designing a New Programming Language Language Called Rust


Mozilla is designing a new multi-paradigm programming language called Rust. According to the Rust Project FAQ, the Rust team's goal is "To design and implement a safe, concurrent, practical, static systems language."
Rust began as a side project by Graydon Hoare in 2006, and Mozilla got involved in 2009 once the project was mature enough to run some basic tests. The language is now published on Github, but is in no sense production-ready.
Here's a code sample from the Rust Language FAQ:
Here's a list of features from the Language FAQ:
Safety oriented:
  • Memory safe. No null pointers, wild pointers, etc. Automatic storage management.
  • Mutability control. Immutable by default. No shared mutable state across tasks.
  • Dynamic execution safety: task failure / unwinding, trapping, logging. RAII / dtors.
  • Typestate system: ability to define complex invariants that hold over data structures.
Concurrency and efficiency oriented:
  • Explicit memory control. Layout and allocation control. Interior / value types.
  • Very lightweight tasks (coroutines). Cheap to spawn thousands-to-millions.
  • Stack iterators (effectively lambda-blocks w/o heap allocation).
  • Static, native compilation. Emits ELF / PE / Mach-o files.
  • Direct and simple interface to C code (switch stacks and call, ~8 insns).
Practicality oriented:
  • Multi-paradigm. pure-functional, concurrent-actor, imperative-procedural, OO.
  • First class functions with bindings.
  • Structurally-typed objects (no nominal types or type hierarchy).
  • Multi-platform. Developed on Windows, Linux, OSX.
  • UTF8 strings, assortment of machine-level types.
  • Works with existing native toolchains. GDB / Valgrind / Shark / etc.
  • Practical rule-breaking: can break safety rules, if explicit about where and how.
In addition to Hoare, other contributors include Ecma committee member Dave Herman and JavaScript creator and Mozilla CTO Brendan Eich.
Check out the list of Windows' failed rivals. Its longer than you think. Click here.
Some movies you should watch (Yes. Also 'The Social Networking'. :)
To subscribe to the "Guy WhoSteals" feed, click here.
You can add yourself to the GuyWhoSteals fanpage on Facebook or follow GuyWhoSteals on Twitter.

Strategies for becoming a better programmer

Do you want to become a much better programmer than the one you are now? Unless you really don't like being one then I am sure that the answer is yes!

The following list outlines a set of strategies that you can look over for some thoughts and techniques that I have found to work well, and that I have shared with others over the course of the years. This list encapsulates both lessons that I have learned on my own, as well as the many lessons that I have learned from many great people over the course of my years so far!!

Be Prepared To Unlearn

My definition of unlearning is the ability to "leave your baggage at the door" while you willingly step out into a realm of uncomfortability to explore new ideas with a fresh set of eyes. Being an effective unlearner enables you to take an unbiased look at a new way of approaching a situation/problem/challenge without the weight of being dragged down by your old baggage(ideas). It allows you to take the time to form a reasonable mental model of the new concept as you experiment with it and apply it; to see whether it is something that could be considered worthwhile.

It is a lot harder for people to unlearn bad practices and ideas. Unfortunately this can get in the way of allowing them to adopt and play around with potentially good and useful new ideas.

Give yourself small daily opportunities to practice "unlearning". Tackle a problem you have solved before and don't allow yourself to leverage your old ideas to solve it. As you practice unlearning, it can be helpful to remember that the process is often more important that solving the problem, as you are learning how to "leave your baggage at the door" as you work through the process. Which can have a dramatic impact on your ability to unlearn in the future.

Validate assumptions about your skillset

A lot of programmers believe that they posess a higher level of skill than they actually have. Unfortunately this, combined with comfortability, can keep people in this "twilight zone" for quite a long time. One strategy to minimize this is to seek out and collaborate with people who make you feel a little out of your element. This will ensure that you never allow yourself too much time to congratulate yourself; which keeps you in a mode of trying to continually improve yourself.

If you can also manage to surround yourself with people who you can form good relationships with, then it can be an encouraging thing that enables you to reach levels in your ability that you may not have able to realize on your own.

Do less reading about what others are doing,and more doing of things that others may want to read about

There is a constant flow of information coming at us all the time. One of the targets that I am going to pick on right now, ironically, is blogs. There are a lot of very skilled programmers out there who are more than happy to share their wisdom and experience with others through the means of blog posts. These can be valuable tools to help people keep plugged into speheres of knowledge and concepts that they may not have come across yet. Unfortunately, with the large number of these blogs, many people have fallen into the trap of subscribing to too many. They work hard to keep on top of the daily (sometime hourly updates) that these great developer care to share. In the hands of people who know how to manage the information carefully, these feeds can be extremely valuable resources.

There has, however, been something that I have observed of many developers that I met over the last couple of years. Let me describe this observation in the form of a short story:

CoderBoy is an average programmer who wants to become better. For the last year he has spent a lot of time picking up, and reading books on the latest and greatest technologies that have come down the pipe. This reading was purely passive in nature as he did not spend any time trying to practice and play with the concepts that he was reading about. Able to drop buzzwords like they were going out of style, he started to get frustrated by the abscensce of any new insights/techniques he was sure would magically manifest when working through coding sessions.

To remedy this; CoderBoy started reading blogs. Subscribed to a handful of aggregated feeds and lots of individual blogs, he spent the first part of his day at work reading about the discoveries, experiences, successes, and failures of other people. With each new blog read, there were more links to traverse, other blogs to read, more information to digest. By the time he got through his morning blog read ritual, he felt even more discouraged about his skill level than when he started.

And if that were not bad enough, he convinced himself that the things that people were writing about were much more engaging that the projects and challenges that he had to work on.

Attempting to shrug off this feeling, he dove into code. Only to be hit by another brick wall. He spent the next chunk of time thinking about all of the different ideas whirring around in his head. Instead of attempting (and potentially failing at implementing) a couple of different ideas, he got stuck seeking out the perfect solution. If he finally managed to find what he thought was a good solution, the next morning he would read something else which makes him feel terrible about the code that he wrote. And the cycle continues. This became a very destructive cycle that robbed him of the joy of creativity, exploration, and even the craft itself.
Reading is no substitute for doing. A great quote by Albert Einstein reads:
Any man who reads too much and uses his own brain too little falls into lazy habits of thinking.
We are all infused with the desire to create. When we fail to exercise that gift it can often leave us with a feeling that we are not quite living up to our potential. We each need to realize that the gifts we bring to the table are completely unique. Gifts, however , have to be opened, and then further used, if they are going to be of any value. Books and blogs can be great resources to inspire you to maximize and challenge your own creative potential. You have to make sure that you allow yourself time to flush out some independent ideas. Learn from the mistakes of others, but allow yourself plenty of room to come up with your own ideas. Give youself plenty of room to fail, and learn from those failures. The only real failure is the failure to try.

Allow yourself to get into mad scientist mode at least once a week

Going along with the idea of allowing yourself to cultivate and stretch your creative gifts. You should allow yourself time every week to just play with new ideas. The pupose of this is not about getting something right or wrong. It is about allowing yourself the freedom to have fun with just messing around with some code. It could be:
  • Great
  • Terrible
  • Unit Tested
  • Spaghetti
The point is to just let yourself "play". People who allow themselves to get into this mode more often can find that the spikes in creativity that result, can carry forward with them into the stuff that they have to tackle on a day to day basic. Also, this structured focus on allowing themselves room to experiment, frees them up to think about completely new ways to solve problems. Even if the way they solve the problem has been "found already", it does not negate that they have raised their level of skill by coming up with a "new" way of solving it. I am reminded of the story of how John Carmack created Carmacks Reverse:
Carmack's Reverse (formally known as z-fail stencil shadows) which he devised for Doom 3...While he was not the first to discover Carmack's Reverse, he developed it independently without knowing of the prior research done on the subject.
Do you think that was just reinventing the wheel? From his perspective he was not at all. He was trying to solve a problem (without knowledge that it was a solved problem). This provided him with an opportunity to stretch and maximize his creative ability to attack the problem for what it was.

Allow yourself to exhibit some planned NIH every once in a while

A lot of great programmers that I have met over they years would seem on the surface to exhibit temporal cases of extreme NIH. Lots of them have written their own version of [insert frameworks here]. Of course a principle tenet of a true NIH camper; is the unwillingness to leverage known solutions to existing problems (discounting truly not got implementations that is). In the software space this means, existing frameworks that solve the problem that they are trying to solve. The real question is, what is their motivation behind writing another [framework x]. Dig deeper and you will see that a lot of these "projects" start off as nothing more that a planned excursion into the realm of the mad scientist. They ask one question "I wonder if I could do this?" and they set off to try and answer the question. They don't have time to get caught up in the politics of whether one already exists or not, because for them, it is just a fun challenge that gives them an opportunity to stretch. It can give them an change to explore and think about problemsthat they may not feel comfortable with. This utlimately results in growth!! The periods of exploration will often come back to manifest as better ideas with which to tackle the challenges they are dealing with on their real project.

Don't compete against anyone else except yourself

It can be very easy to get caught up in the software version of keeping up with the Joneses. The proliferation of internet based information has made it even easier for people to continually find someone who they should be chasing after. Unfortunately, this is a never ending race. When you think you have caught up with the skill of [developer x], either their skill level has increased or you have found another developer whose skill you covet. Constantly wanting, never content.

Lots of people waste their lives, by measuring their own life against someone elses yardstick. It is a joy sapping journey to never feel satisfied with the gifts and abilities that your have been blessed with. You need to work hard to maximize the potential of the gifts you have been given (and we all have gifts that we can leverage). You need to also remember, that even with lots of work, the level of ability you are able to reach, may not be at the same level of someone else who has also worked hard. That, however, is ok. It's not about being the best. It's about being your best. As legendary coach John Wooden ("The Coach") said:
Don't think about what you have accomplished. Rather, what you should have accomplished with your abilities.
When I was younger my Dad gave me some great advice. He said:
There will always be someone who is better than you, there will always be someone who is not.
Simple, profound. This tiny bit of wisdom at a very young age helped me not to fall into the trap of self comparison.

There will always be a programmer who is more skilled than you; there will always be a programmer who is less skilled. The only thing that you should focus on is whether you are a striving to become a better programmer than the one you were yesterday. That is the real person to mercilessly compete against daily. Being able to track your progress against "that" guy, will help you see that day by day, in small increments, you are improving.

Don't waste your time

I think a lot of people would be unpleasantly surprised at how may inefficiencies are present in the way they utilize their workday. Running a tool like timesnapper can give them a nice unbiased snapshot into how they actually spend their time when in front of the computer. You would not think of fixing something that is not broken. One problem is not knowing that something is broken and in need of repair. Do you know how much time a day you spend in the following activities:
  • Web Surfing (unrelated to projects you are working on)
  • Social Media
  • Email
  • Flipping through your music list
Right now, you could probably make some guesses about how much time you spend on each. Most will grossly underestimate. I cannot stress enough how much you can make your workday count to your advantage. If you end your days with the persitent feeling of "I do not feel like I got enough done", it could be an indicator that some significant diagnostics need to be performed. The feeling of not getting enough done can unfortunately have ramifications on much more than your performance at work. It can carry on into your thoughts once your are home with your family, which can distract your from giving your full attention to them. It could also propogate into your sleep patterns, preventing you from being able to realize a good restful sleep. You owe it to your family, health, and employer, to take an active role in seeing how effectively your are leveraging your workday. Any extra time that you can free up in that timeline is time that you can allocate to more meaningful activities which could:
  • Make you an even more effective employee.
  • Enable you to end the work day feeling more accomplished.
  • Enable you to enjoy relaxing at home with your family.
  • Help you sleep better.
  • Give you time to pursue those dreams you have potentially put on the backburner; because you did not have enough "time".
Allowing yourself to do some deep introspection will often moved you to make changes that can have lasting ramifications.

Help the people around you to reach their full potential

It can be very easy to become so focused on your own individual improvement, that you can often forget about the people you are surrounded by who could greatly benefit from the skills that you already bring to the table. Making a concerted effort to show genuine interest and care for the well being, and development of your co-workers; can create an environment where synergy, collaboration, and friendly competitiveness raise the level of all of the people on the team. Here is a great poem that I was sent by a past student that outlines perfectly what it means to be a leader in the teams that you are in:

Do you want to change your team, or just one person on the team? Stop trying to change them with soapbox speeches and incessant rambling about how they should be improving their skillsets. All the while making sure to point their attention to all of the amazing stuff that you are doing that they should just be "on board" with. Roll up your sleeves and get involved in the work they are struggling with. Take time to understand them on a personal level. Get to grips with the concepts and ideas that fluster them on a daily basis. Don't make your goal to convince or change. Make developing the person, and investing in them the goal. This will most often open up the doors to a level of collaboration and improvement that would not have been possibile when you were just focused on youruself. In this type of environment, change and growth is now a natural side effect of the process of building people who build others.

Keep it fun

So simple, and yet very easy to lose sight of. The reality of keeping the element of fun present in the tasks that you do, can often be more about attitude than it is about aptitude.

Do you dread having to do that 5 minute a day FTP upload? Write an script to automate the task so that you can do another task that you would rather be doing.

Are you faced with a negative project situation and people who have succumbed to a defeatist attitude. Challenge yourself to be the voice of light in the darkness. It is not about denying the fact that there is a problem. It is being courageous enough to be someone who is still willing to press through and find potential solutions to remedy the problem.

Are you tired of writing the same thing over, and over, and over. That is not fun. Try to tackle the problem differently. Give your brain an opportunity to stretch itself. Find a way to make a seemingly mundane task something that allows you an opportunity to play.

I don't think anything really worth having, comes without some hard work involved. Be it a great relationship, or acheiving a high level of ability in a certain skill. There has to be a certain amount of effort exerted to cultivate that element into something great. Keeping the fun in what you do on a day to day basis (granted you will most likely go through periods where you are just not there!!) is something that requires just as much hard work. It requires an inquisitive eye, a high level of personal and environmental critiqueing. And ultimately, courage to take action to fix the elements that rob the joy from the task.

I have to stress that this does not necessarily mean that things have to "go your way" for things to be fun. You will often need to cultivate a mindset of being able to find the fun in a potentially not fun situation. This can often end up having a positive impact on both you and the people that you work with!!! You have to choose to make decisions that you know are right even when your "feelings" try to lead you astray.

We are blessed to be in a career that we chose to do. Let's enjoy the process of daily becoming better at it, and enjoy the journey!!!
Now over 30 years old, the UNIX command line utilities sed and awk are useful tools for cleaning up and manipulating data. In their Taxonomy of Data Science, Hilary Mason and Chris Wiggins note that when cleaning data, "Sed, awk, grep are enough for most small tasks, and using either Perl or Python should be good enough for the rest." A little aptitude with command line tools can go a long way.

sed is a stream editor: it operates on data in a serial fashion as it reads it. You can think of sed as a way to batch up a bunch of search and replace operations that you might perform in a text editor. For instance, this command will replace all instances of "foo" with "bar" within a file:
sed -e 's/foo/bar/g' myfile.txt
Anybody who has used regular expressions within a text editor or 
programming language
will find sed easy to grasp. Awk takes a 
little more getting used
to. A record-oriented tool, awk is the right tool to use when 
your data contains
delimited fields that you want to manipulate.
Consider this list of names, which we'll imagine lives in the file presidents.txt.
George Washington
John Adams
Thomas Jefferson
James Madison
James Monroe
To extract just the first names, we can use the following command:
$ awk '{ print $1 }' presidents.txt
George
John
Thomas
James
James
Or, to just find those records with "James" as the first name:
$ awk '$1 ~ /James/ { print }' presidents.txt
James Madison
James Monroe
Awk can do a lot more, and features programming concepts such as 
variables, conditionals
and loops. But just a basic grasp of how to match and extract fields 
will get you far.



You might want to have a look at the /etc/init.d directory in Linux based systems. Click here.
Learn a new command today from this blog post.
To subscribe to the "Guy WhoSteals" feed, click here.
You can add yourself to the GuyWhoSteals fanpage on Facebook or follow GuyWhoSteals on Twitter.
Guy's personal blog: here.

Catching up

OK. Where were we?

Let's get the mundane stuff out of the way first. Early spring has sprung. The trees are beginning to blossom here and there, and the bees are out in force. So are the August winds, and because everything is still bone dry after months of no precipitation at all, dust is everywhere. But at least the cold is gone - we've had a relatively mild winter this year, but with a few cold snaps that were downright spectacular: the aging water heater in the car port burst from the cold, and black frost killed off quite a few plants in the garden.

My vegetable garden is an out-an-out failure as a vegetable garden (the sum and total of the harvest was one cabbage the size of a golf ball) but as an experiment intended to find out what's what in this garden, it was a success. I now have learned that the veggie patch is useless in winter because it hardly gets any sun at all; that the soil is useless, and that the weather is something to be reckoned with. Five minutes down the road is a large(ish) estate where they have horses and vineyards, which means the soil is excellent (the gray/black stuff that I need, rather than the reddish clay that I have) and manure is available in abundance. What this garden needs is a load of crap, and new soil for the veggie patch, both of which will arrive shortly. :-)

I have sown most of my herbs in seeding trays - but being penniless, I used the plastic trays that my local supermarket sells tomatoes and other fruit and vegetables in. Which is fine, except that I now have the nagging suspicion that some of them may have been treated with some kind of fungicide to keep fruit from molding - and incidentally my seeds from germinating. So far some of it (dill weed, leek and thyme, for example) has started to sprout, but coriander, chives, parsley and basil have been in there for over three weeks now without any sign of life... except for two or three runty green pinheads in the center of the tray. Fortunately I haven't put all my eggs in one basket seeds in one tray, so I've re-sown some of that stuff in real seeding trays (i.e. ones sold for that purpose) that I managed to borrow.

The garden needs a lot of work. First, as soon as I have a bit of money to buy a few simple plumbing fixtures, I'll put in an irrigation system. Not the fancy stuff that you buy at garden centers; I'll make my own. :-) Then there's the usual cleaning upping to do after the winter. In spring the pine trees start growing new needles, and the old stuff is coming down like rain - along with green clouds of pollen, because how they're blooming and everything gets covered in this green stuff. :-) Then the grass needs some fertilizer, but that will have to wait until the growing season starts again. I'm hoping to get rich later this year and start building a garden shed, and some outside lights for the patio, and maybe an umbrella there and an electrical outlet, so that I can work outside in summer. We'll see.

Work-wise, things are quiet. A few weeks ago I did a small website for a deep sea fishing charter company in Shelly Beach, just south of Durban. It was a referral from a friend who has family there, which meant I could get a ride out there for free. They fetched me at four in the morning on a Friday, we drove out there, arrived just past noon, had a meeting, I made the website, and on Sunday afternoon we drove back. It's not great money but it all helps, and maybe it will generate some more business in that part of the country.

My permanent residence permit is still in the works - and the wheels turn slowly here. My police clearance is in, having been delayed by several months due to the Soccer World Cup games, and now I need to get another affidavit from a chartered accountant and a company valuation, I need to draw up a revised business plan, and I need to make a case for the fact that I'm not hiring large numbers of Africans and otherwise creating economic opportunities for the downtrodden masses.

Well, at least that last bit is easy - the downtrodden masses have once gain risen up in their might, with the soccer world cup out of the way and the eyes of the world safely turned elsewhere, and once again demanded more money. They do this at least once a year, for no specific reason other than that they want more, and more again, with quite arbitrary demands. This time it's the public sector again, and strikes here mean violence and vandalism. Striking hordes march through towns and across highways, overturning rubbish bins, breaking windows, setting fires, and wreaking general havoc and destruction. Striking hospital workers intimidated their working colleagues, dragged a nurse out of the operating room during an operation, and at least seven patients have died so far, including babies who were left without food or care all day long. Even emergency patients are denied care. And it's not just hospitals - similar atrocities happen in other sectors: government offices, schools, municipalities, and what not.

But at least we still know about all this. That may soon change... because the constitutional freedom of speech is about to be abolished in South Africa. The ANC is about to sign into law two draconian proposals intended to muzzle the free media in South Africa, following a spate of publications in the media on the excesses of various ANC heavies, including systematic abuse of power, conflicts of interests, hijacking of government tenders, nepotism, corruption, fraud, embezzlement and outright crime. These "fabrications" and "obviously false allegations" have outraged notonly the ANC, but also the ANC Youth League and the SA Communist Party (SACP); with an uncommon degree of co-operation they have labeled the media a threat to democracy, and accused some of the more daring investigative journalists of treason because their "lies" have "undermined security in the presidency" and constituted "a direct attack on the State and its people". At least one Sunday Times  reporter has been arrested. Meanwhile the new Protection of Information Bill is about to be summarily signed into law, which will give the government the authority to keep under wraps whatever they want, in what is nothing short of a revival of Apartheid-era secrecy and censorship, and a Media Tribunal which will adjudicate over "wrong reporting by all media". Guess who will decide what constitutes "confidential information" and "wrong reporting"? Exactly.

So my long silence in this weblog might be a taste of things to come...

Update:
Freedom of speech and freedom of press aren't the only things that will go out the window when the Protection of Information Bill comes into effect. It will also seriously hamper (or rather, defeat) attempts to hold the ANC and its members accountable for their actions. In fact it will make it virtually impossible for anyone, from the Public Protectorate to the Human Rights Commission to the Directorate of Public Proscecution, to adequately respond to any lawbreaking committed by the ruling party of its top figures. All the ANC has to do, as soon as embarrassing questions are asked or condemning evidence surfaces, is to declare the Bill applicable to whatever issue is being raised, and the whole thing will immediately disappear behind a screens of secrecy, not only safely out of view of the public, but also out of reach of any judicial representative, right up to the high court itself. How convenient.

Maybe it's time we all learned Chinese...
Related Posts Plugin for WordPress, Blogger...
top
Share